| 1 | /* |
| 2 | This file is part of the WebKit open source project. |
| 3 | This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Library General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Library General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Library General Public License |
| 16 | along with this library; see the file COPYING.LIB. If not, write to |
| 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 | Boston, MA 02110-1301, USA. |
| 19 | */ |
| 20 | |
| 21 | #include "config.h" |
| 22 | #include "JSDOMMatrixInit.h" |
| 23 | |
| 24 | #include "JSDOMConvertBoolean.h" |
| 25 | #include "JSDOMConvertNumbers.h" |
| 26 | #include <JavaScriptCore/JSCInlines.h> |
| 27 | |
| 28 | |
| 29 | namespace WebCore { |
| 30 | using namespace JSC; |
| 31 | |
| 32 | template<> DOMMatrixInit convertDictionary<DOMMatrixInit>(ExecState& state, JSValue value) |
| 33 | { |
| 34 | VM& vm = state.vm(); |
| 35 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 36 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
| 37 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
| 38 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
| 39 | throwTypeError(&state, throwScope); |
| 40 | return { }; |
| 41 | } |
| 42 | DOMMatrixInit result; |
| 43 | JSValue aValue; |
| 44 | if (isNullOrUndefined) |
| 45 | aValue = jsUndefined(); |
| 46 | else { |
| 47 | aValue = object->get(&state, Identifier::fromString(&state, "a" )); |
| 48 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 49 | } |
| 50 | if (!aValue.isUndefined()) { |
| 51 | result.a = convert<IDLUnrestrictedDouble>(state, aValue); |
| 52 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 53 | } |
| 54 | JSValue bValue; |
| 55 | if (isNullOrUndefined) |
| 56 | bValue = jsUndefined(); |
| 57 | else { |
| 58 | bValue = object->get(&state, Identifier::fromString(&state, "b" )); |
| 59 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 60 | } |
| 61 | if (!bValue.isUndefined()) { |
| 62 | result.b = convert<IDLUnrestrictedDouble>(state, bValue); |
| 63 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 64 | } |
| 65 | JSValue cValue; |
| 66 | if (isNullOrUndefined) |
| 67 | cValue = jsUndefined(); |
| 68 | else { |
| 69 | cValue = object->get(&state, Identifier::fromString(&state, "c" )); |
| 70 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 71 | } |
| 72 | if (!cValue.isUndefined()) { |
| 73 | result.c = convert<IDLUnrestrictedDouble>(state, cValue); |
| 74 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 75 | } |
| 76 | JSValue dValue; |
| 77 | if (isNullOrUndefined) |
| 78 | dValue = jsUndefined(); |
| 79 | else { |
| 80 | dValue = object->get(&state, Identifier::fromString(&state, "d" )); |
| 81 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 82 | } |
| 83 | if (!dValue.isUndefined()) { |
| 84 | result.d = convert<IDLUnrestrictedDouble>(state, dValue); |
| 85 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 86 | } |
| 87 | JSValue eValue; |
| 88 | if (isNullOrUndefined) |
| 89 | eValue = jsUndefined(); |
| 90 | else { |
| 91 | eValue = object->get(&state, Identifier::fromString(&state, "e" )); |
| 92 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 93 | } |
| 94 | if (!eValue.isUndefined()) { |
| 95 | result.e = convert<IDLUnrestrictedDouble>(state, eValue); |
| 96 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 97 | } |
| 98 | JSValue fValue; |
| 99 | if (isNullOrUndefined) |
| 100 | fValue = jsUndefined(); |
| 101 | else { |
| 102 | fValue = object->get(&state, Identifier::fromString(&state, "f" )); |
| 103 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 104 | } |
| 105 | if (!fValue.isUndefined()) { |
| 106 | result.f = convert<IDLUnrestrictedDouble>(state, fValue); |
| 107 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 108 | } |
| 109 | JSValue m11Value; |
| 110 | if (isNullOrUndefined) |
| 111 | m11Value = jsUndefined(); |
| 112 | else { |
| 113 | m11Value = object->get(&state, Identifier::fromString(&state, "m11" )); |
| 114 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 115 | } |
| 116 | if (!m11Value.isUndefined()) { |
| 117 | result.m11 = convert<IDLUnrestrictedDouble>(state, m11Value); |
| 118 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 119 | } |
| 120 | JSValue m12Value; |
| 121 | if (isNullOrUndefined) |
| 122 | m12Value = jsUndefined(); |
| 123 | else { |
| 124 | m12Value = object->get(&state, Identifier::fromString(&state, "m12" )); |
| 125 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 126 | } |
| 127 | if (!m12Value.isUndefined()) { |
| 128 | result.m12 = convert<IDLUnrestrictedDouble>(state, m12Value); |
| 129 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 130 | } |
| 131 | JSValue m21Value; |
| 132 | if (isNullOrUndefined) |
| 133 | m21Value = jsUndefined(); |
| 134 | else { |
| 135 | m21Value = object->get(&state, Identifier::fromString(&state, "m21" )); |
| 136 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 137 | } |
| 138 | if (!m21Value.isUndefined()) { |
| 139 | result.m21 = convert<IDLUnrestrictedDouble>(state, m21Value); |
| 140 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 141 | } |
| 142 | JSValue m22Value; |
| 143 | if (isNullOrUndefined) |
| 144 | m22Value = jsUndefined(); |
| 145 | else { |
| 146 | m22Value = object->get(&state, Identifier::fromString(&state, "m22" )); |
| 147 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 148 | } |
| 149 | if (!m22Value.isUndefined()) { |
| 150 | result.m22 = convert<IDLUnrestrictedDouble>(state, m22Value); |
| 151 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 152 | } |
| 153 | JSValue m41Value; |
| 154 | if (isNullOrUndefined) |
| 155 | m41Value = jsUndefined(); |
| 156 | else { |
| 157 | m41Value = object->get(&state, Identifier::fromString(&state, "m41" )); |
| 158 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 159 | } |
| 160 | if (!m41Value.isUndefined()) { |
| 161 | result.m41 = convert<IDLUnrestrictedDouble>(state, m41Value); |
| 162 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 163 | } |
| 164 | JSValue m42Value; |
| 165 | if (isNullOrUndefined) |
| 166 | m42Value = jsUndefined(); |
| 167 | else { |
| 168 | m42Value = object->get(&state, Identifier::fromString(&state, "m42" )); |
| 169 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 170 | } |
| 171 | if (!m42Value.isUndefined()) { |
| 172 | result.m42 = convert<IDLUnrestrictedDouble>(state, m42Value); |
| 173 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 174 | } |
| 175 | JSValue is2DValue; |
| 176 | if (isNullOrUndefined) |
| 177 | is2DValue = jsUndefined(); |
| 178 | else { |
| 179 | is2DValue = object->get(&state, Identifier::fromString(&state, "is2D" )); |
| 180 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 181 | } |
| 182 | if (!is2DValue.isUndefined()) { |
| 183 | result.is2D = convert<IDLBoolean>(state, is2DValue); |
| 184 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 185 | } |
| 186 | JSValue m13Value; |
| 187 | if (isNullOrUndefined) |
| 188 | m13Value = jsUndefined(); |
| 189 | else { |
| 190 | m13Value = object->get(&state, Identifier::fromString(&state, "m13" )); |
| 191 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 192 | } |
| 193 | if (!m13Value.isUndefined()) { |
| 194 | result.m13 = convert<IDLUnrestrictedDouble>(state, m13Value); |
| 195 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 196 | } else |
| 197 | result.m13 = 0; |
| 198 | JSValue m14Value; |
| 199 | if (isNullOrUndefined) |
| 200 | m14Value = jsUndefined(); |
| 201 | else { |
| 202 | m14Value = object->get(&state, Identifier::fromString(&state, "m14" )); |
| 203 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 204 | } |
| 205 | if (!m14Value.isUndefined()) { |
| 206 | result.m14 = convert<IDLUnrestrictedDouble>(state, m14Value); |
| 207 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 208 | } else |
| 209 | result.m14 = 0; |
| 210 | JSValue m23Value; |
| 211 | if (isNullOrUndefined) |
| 212 | m23Value = jsUndefined(); |
| 213 | else { |
| 214 | m23Value = object->get(&state, Identifier::fromString(&state, "m23" )); |
| 215 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 216 | } |
| 217 | if (!m23Value.isUndefined()) { |
| 218 | result.m23 = convert<IDLUnrestrictedDouble>(state, m23Value); |
| 219 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 220 | } else |
| 221 | result.m23 = 0; |
| 222 | JSValue m24Value; |
| 223 | if (isNullOrUndefined) |
| 224 | m24Value = jsUndefined(); |
| 225 | else { |
| 226 | m24Value = object->get(&state, Identifier::fromString(&state, "m24" )); |
| 227 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 228 | } |
| 229 | if (!m24Value.isUndefined()) { |
| 230 | result.m24 = convert<IDLUnrestrictedDouble>(state, m24Value); |
| 231 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 232 | } else |
| 233 | result.m24 = 0; |
| 234 | JSValue m31Value; |
| 235 | if (isNullOrUndefined) |
| 236 | m31Value = jsUndefined(); |
| 237 | else { |
| 238 | m31Value = object->get(&state, Identifier::fromString(&state, "m31" )); |
| 239 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 240 | } |
| 241 | if (!m31Value.isUndefined()) { |
| 242 | result.m31 = convert<IDLUnrestrictedDouble>(state, m31Value); |
| 243 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 244 | } else |
| 245 | result.m31 = 0; |
| 246 | JSValue m32Value; |
| 247 | if (isNullOrUndefined) |
| 248 | m32Value = jsUndefined(); |
| 249 | else { |
| 250 | m32Value = object->get(&state, Identifier::fromString(&state, "m32" )); |
| 251 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 252 | } |
| 253 | if (!m32Value.isUndefined()) { |
| 254 | result.m32 = convert<IDLUnrestrictedDouble>(state, m32Value); |
| 255 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 256 | } else |
| 257 | result.m32 = 0; |
| 258 | JSValue m33Value; |
| 259 | if (isNullOrUndefined) |
| 260 | m33Value = jsUndefined(); |
| 261 | else { |
| 262 | m33Value = object->get(&state, Identifier::fromString(&state, "m33" )); |
| 263 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 264 | } |
| 265 | if (!m33Value.isUndefined()) { |
| 266 | result.m33 = convert<IDLUnrestrictedDouble>(state, m33Value); |
| 267 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 268 | } else |
| 269 | result.m33 = 1; |
| 270 | JSValue m34Value; |
| 271 | if (isNullOrUndefined) |
| 272 | m34Value = jsUndefined(); |
| 273 | else { |
| 274 | m34Value = object->get(&state, Identifier::fromString(&state, "m34" )); |
| 275 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 276 | } |
| 277 | if (!m34Value.isUndefined()) { |
| 278 | result.m34 = convert<IDLUnrestrictedDouble>(state, m34Value); |
| 279 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 280 | } else |
| 281 | result.m34 = 0; |
| 282 | JSValue m43Value; |
| 283 | if (isNullOrUndefined) |
| 284 | m43Value = jsUndefined(); |
| 285 | else { |
| 286 | m43Value = object->get(&state, Identifier::fromString(&state, "m43" )); |
| 287 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 288 | } |
| 289 | if (!m43Value.isUndefined()) { |
| 290 | result.m43 = convert<IDLUnrestrictedDouble>(state, m43Value); |
| 291 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 292 | } else |
| 293 | result.m43 = 0; |
| 294 | JSValue m44Value; |
| 295 | if (isNullOrUndefined) |
| 296 | m44Value = jsUndefined(); |
| 297 | else { |
| 298 | m44Value = object->get(&state, Identifier::fromString(&state, "m44" )); |
| 299 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 300 | } |
| 301 | if (!m44Value.isUndefined()) { |
| 302 | result.m44 = convert<IDLUnrestrictedDouble>(state, m44Value); |
| 303 | RETURN_IF_EXCEPTION(throwScope, { }); |
| 304 | } else |
| 305 | result.m44 = 1; |
| 306 | return result; |
| 307 | } |
| 308 | |
| 309 | } // namespace WebCore |
| 310 | |