Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGMatrix.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGMatrixBinding.h"
4 : #include "WrapperFactory.h"
5 : #include "mozilla/FloatingPoint.h"
6 : #include "mozilla/OwningNonNull.h"
7 : #include "mozilla/dom/BindingUtils.h"
8 : #include "mozilla/dom/DOMJSClass.h"
9 : #include "mozilla/dom/NonRefcountedDOMObject.h"
10 : #include "mozilla/dom/PrimitiveConversions.h"
11 : #include "mozilla/dom/SVGMatrix.h"
12 : #include "mozilla/dom/XrayExpandoClass.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : namespace SVGMatrixBinding {
18 :
19 : static bool
20 0 : get_a(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args)
21 : {
22 0 : float result(self->A());
23 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
24 0 : args.rval().set(JS_NumberValue(double(result)));
25 0 : return true;
26 : }
27 :
28 : static bool
29 0 : set_a(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args)
30 : {
31 : float arg0;
32 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
33 0 : return false;
34 0 : } else if (!mozilla::IsFinite(arg0)) {
35 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.a");
36 0 : return false;
37 : }
38 0 : binding_detail::FastErrorResult rv;
39 0 : self->SetA(arg0, rv);
40 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
41 0 : return false;
42 : }
43 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
44 :
45 0 : return true;
46 : }
47 :
48 : static const JSJitInfo a_getterinfo = {
49 : { (JSJitGetterOp)get_a },
50 : { prototypes::id::SVGMatrix },
51 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
52 : JSJitInfo::Getter,
53 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
54 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
55 : true, /* isInfallible. False in setters. */
56 : false, /* isMovable. Not relevant for setters. */
57 : false, /* isEliminatable. Not relevant for setters. */
58 : false, /* isAlwaysInSlot. Only relevant for getters. */
59 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
60 : false, /* isTypedMethod. Only relevant for methods. */
61 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
62 : };
63 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
64 : static_assert(0 < 1, "There is no slot for us");
65 : static const JSJitInfo a_setterinfo = {
66 : { (JSJitGetterOp)set_a },
67 : { prototypes::id::SVGMatrix },
68 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
69 : JSJitInfo::Setter,
70 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
71 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
72 : false, /* isInfallible. False in setters. */
73 : false, /* isMovable. Not relevant for setters. */
74 : false, /* isEliminatable. Not relevant for setters. */
75 : false, /* isAlwaysInSlot. Only relevant for getters. */
76 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
77 : false, /* isTypedMethod. Only relevant for methods. */
78 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
79 : };
80 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
81 : static_assert(0 < 1, "There is no slot for us");
82 :
83 : static bool
84 0 : get_b(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args)
85 : {
86 0 : float result(self->B());
87 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
88 0 : args.rval().set(JS_NumberValue(double(result)));
89 0 : return true;
90 : }
91 :
92 : static bool
93 0 : set_b(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args)
94 : {
95 : float arg0;
96 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
97 0 : return false;
98 0 : } else if (!mozilla::IsFinite(arg0)) {
99 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.b");
100 0 : return false;
101 : }
102 0 : binding_detail::FastErrorResult rv;
103 0 : self->SetB(arg0, rv);
104 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
105 0 : return false;
106 : }
107 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
108 :
109 0 : return true;
110 : }
111 :
112 : static const JSJitInfo b_getterinfo = {
113 : { (JSJitGetterOp)get_b },
114 : { prototypes::id::SVGMatrix },
115 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
116 : JSJitInfo::Getter,
117 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
118 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
119 : true, /* isInfallible. False in setters. */
120 : false, /* isMovable. Not relevant for setters. */
121 : false, /* isEliminatable. Not relevant for setters. */
122 : false, /* isAlwaysInSlot. Only relevant for getters. */
123 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
124 : false, /* isTypedMethod. Only relevant for methods. */
125 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
126 : };
127 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
128 : static_assert(0 < 1, "There is no slot for us");
129 : static const JSJitInfo b_setterinfo = {
130 : { (JSJitGetterOp)set_b },
131 : { prototypes::id::SVGMatrix },
132 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
133 : JSJitInfo::Setter,
134 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
135 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
136 : false, /* isInfallible. False in setters. */
137 : false, /* isMovable. Not relevant for setters. */
138 : false, /* isEliminatable. Not relevant for setters. */
139 : false, /* isAlwaysInSlot. Only relevant for getters. */
140 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
141 : false, /* isTypedMethod. Only relevant for methods. */
142 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
143 : };
144 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
145 : static_assert(0 < 1, "There is no slot for us");
146 :
147 : static bool
148 0 : get_c(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args)
149 : {
150 0 : float result(self->C());
151 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
152 0 : args.rval().set(JS_NumberValue(double(result)));
153 0 : return true;
154 : }
155 :
156 : static bool
157 0 : set_c(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args)
158 : {
159 : float arg0;
160 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
161 0 : return false;
162 0 : } else if (!mozilla::IsFinite(arg0)) {
163 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.c");
164 0 : return false;
165 : }
166 0 : binding_detail::FastErrorResult rv;
167 0 : self->SetC(arg0, rv);
168 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
169 0 : return false;
170 : }
171 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
172 :
173 0 : return true;
174 : }
175 :
176 : static const JSJitInfo c_getterinfo = {
177 : { (JSJitGetterOp)get_c },
178 : { prototypes::id::SVGMatrix },
179 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
180 : JSJitInfo::Getter,
181 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
182 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
183 : true, /* isInfallible. False in setters. */
184 : false, /* isMovable. Not relevant for setters. */
185 : false, /* isEliminatable. Not relevant for setters. */
186 : false, /* isAlwaysInSlot. Only relevant for getters. */
187 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
188 : false, /* isTypedMethod. Only relevant for methods. */
189 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
190 : };
191 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
192 : static_assert(0 < 1, "There is no slot for us");
193 : static const JSJitInfo c_setterinfo = {
194 : { (JSJitGetterOp)set_c },
195 : { prototypes::id::SVGMatrix },
196 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
197 : JSJitInfo::Setter,
198 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
199 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
200 : false, /* isInfallible. False in setters. */
201 : false, /* isMovable. Not relevant for setters. */
202 : false, /* isEliminatable. Not relevant for setters. */
203 : false, /* isAlwaysInSlot. Only relevant for getters. */
204 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
205 : false, /* isTypedMethod. Only relevant for methods. */
206 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
207 : };
208 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
209 : static_assert(0 < 1, "There is no slot for us");
210 :
211 : static bool
212 0 : get_d(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args)
213 : {
214 0 : float result(self->D());
215 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
216 0 : args.rval().set(JS_NumberValue(double(result)));
217 0 : return true;
218 : }
219 :
220 : static bool
221 0 : set_d(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args)
222 : {
223 : float arg0;
224 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
225 0 : return false;
226 0 : } else if (!mozilla::IsFinite(arg0)) {
227 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.d");
228 0 : return false;
229 : }
230 0 : binding_detail::FastErrorResult rv;
231 0 : self->SetD(arg0, rv);
232 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
233 0 : return false;
234 : }
235 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
236 :
237 0 : return true;
238 : }
239 :
240 : static const JSJitInfo d_getterinfo = {
241 : { (JSJitGetterOp)get_d },
242 : { prototypes::id::SVGMatrix },
243 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
244 : JSJitInfo::Getter,
245 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
246 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
247 : true, /* isInfallible. False in setters. */
248 : false, /* isMovable. Not relevant for setters. */
249 : false, /* isEliminatable. Not relevant for setters. */
250 : false, /* isAlwaysInSlot. Only relevant for getters. */
251 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
252 : false, /* isTypedMethod. Only relevant for methods. */
253 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
254 : };
255 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
256 : static_assert(0 < 1, "There is no slot for us");
257 : static const JSJitInfo d_setterinfo = {
258 : { (JSJitGetterOp)set_d },
259 : { prototypes::id::SVGMatrix },
260 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
261 : JSJitInfo::Setter,
262 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
263 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
264 : false, /* isInfallible. False in setters. */
265 : false, /* isMovable. Not relevant for setters. */
266 : false, /* isEliminatable. Not relevant for setters. */
267 : false, /* isAlwaysInSlot. Only relevant for getters. */
268 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
269 : false, /* isTypedMethod. Only relevant for methods. */
270 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
271 : };
272 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
273 : static_assert(0 < 1, "There is no slot for us");
274 :
275 : static bool
276 0 : get_e(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args)
277 : {
278 0 : float result(self->E());
279 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
280 0 : args.rval().set(JS_NumberValue(double(result)));
281 0 : return true;
282 : }
283 :
284 : static bool
285 0 : set_e(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args)
286 : {
287 : float arg0;
288 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
289 0 : return false;
290 0 : } else if (!mozilla::IsFinite(arg0)) {
291 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.e");
292 0 : return false;
293 : }
294 0 : binding_detail::FastErrorResult rv;
295 0 : self->SetE(arg0, rv);
296 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
297 0 : return false;
298 : }
299 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
300 :
301 0 : return true;
302 : }
303 :
304 : static const JSJitInfo e_getterinfo = {
305 : { (JSJitGetterOp)get_e },
306 : { prototypes::id::SVGMatrix },
307 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
308 : JSJitInfo::Getter,
309 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
310 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
311 : true, /* isInfallible. False in setters. */
312 : false, /* isMovable. Not relevant for setters. */
313 : false, /* isEliminatable. Not relevant for setters. */
314 : false, /* isAlwaysInSlot. Only relevant for getters. */
315 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
316 : false, /* isTypedMethod. Only relevant for methods. */
317 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
318 : };
319 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
320 : static_assert(0 < 1, "There is no slot for us");
321 : static const JSJitInfo e_setterinfo = {
322 : { (JSJitGetterOp)set_e },
323 : { prototypes::id::SVGMatrix },
324 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
325 : JSJitInfo::Setter,
326 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
327 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
328 : false, /* isInfallible. False in setters. */
329 : false, /* isMovable. Not relevant for setters. */
330 : false, /* isEliminatable. Not relevant for setters. */
331 : false, /* isAlwaysInSlot. Only relevant for getters. */
332 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
333 : false, /* isTypedMethod. Only relevant for methods. */
334 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
335 : };
336 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
337 : static_assert(0 < 1, "There is no slot for us");
338 :
339 : static bool
340 0 : get_f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitGetterCallArgs args)
341 : {
342 0 : float result(self->F());
343 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
344 0 : args.rval().set(JS_NumberValue(double(result)));
345 0 : return true;
346 : }
347 :
348 : static bool
349 0 : set_f(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, JSJitSetterCallArgs args)
350 : {
351 : float arg0;
352 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
353 0 : return false;
354 0 : } else if (!mozilla::IsFinite(arg0)) {
355 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGMatrix.f");
356 0 : return false;
357 : }
358 0 : binding_detail::FastErrorResult rv;
359 0 : self->SetF(arg0, rv);
360 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
361 0 : return false;
362 : }
363 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
364 :
365 0 : return true;
366 : }
367 :
368 : static const JSJitInfo f_getterinfo = {
369 : { (JSJitGetterOp)get_f },
370 : { prototypes::id::SVGMatrix },
371 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
372 : JSJitInfo::Getter,
373 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
374 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
375 : true, /* isInfallible. False in setters. */
376 : false, /* isMovable. Not relevant for setters. */
377 : false, /* isEliminatable. Not relevant for setters. */
378 : false, /* isAlwaysInSlot. Only relevant for getters. */
379 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
380 : false, /* isTypedMethod. Only relevant for methods. */
381 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
382 : };
383 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
384 : static_assert(0 < 1, "There is no slot for us");
385 : static const JSJitInfo f_setterinfo = {
386 : { (JSJitGetterOp)set_f },
387 : { prototypes::id::SVGMatrix },
388 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
389 : JSJitInfo::Setter,
390 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
391 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
392 : false, /* isInfallible. False in setters. */
393 : false, /* isMovable. Not relevant for setters. */
394 : false, /* isEliminatable. Not relevant for setters. */
395 : false, /* isAlwaysInSlot. Only relevant for getters. */
396 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
397 : false, /* isTypedMethod. Only relevant for methods. */
398 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
399 : };
400 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
401 : static_assert(0 < 1, "There is no slot for us");
402 :
403 : static bool
404 0 : multiply(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
405 : {
406 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
407 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.multiply");
408 : }
409 0 : NonNull<mozilla::dom::SVGMatrix> arg0;
410 0 : if (args[0].isObject()) {
411 : {
412 0 : nsresult rv = UnwrapObject<prototypes::id::SVGMatrix, mozilla::dom::SVGMatrix>(args[0], arg0);
413 0 : if (NS_FAILED(rv)) {
414 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGMatrix.multiply", "SVGMatrix");
415 0 : return false;
416 : }
417 : }
418 : } else {
419 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGMatrix.multiply");
420 0 : return false;
421 : }
422 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Multiply(NonNullHelper(arg0))));
423 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
424 : static_assert(!IsPointer<decltype(result)>::value,
425 : "NewObject implies that we need to keep the object alive with a strong reference.");
426 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
427 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
428 0 : return false;
429 : }
430 0 : return true;
431 : }
432 :
433 : static const JSJitInfo multiply_methodinfo = {
434 : { (JSJitGetterOp)multiply },
435 : { prototypes::id::SVGMatrix },
436 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
437 : JSJitInfo::Method,
438 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
439 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
440 : false, /* isInfallible. False in setters. */
441 : false, /* isMovable. Not relevant for setters. */
442 : false, /* isEliminatable. Not relevant for setters. */
443 : false, /* isAlwaysInSlot. Only relevant for getters. */
444 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
445 : false, /* isTypedMethod. Only relevant for methods. */
446 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
447 : };
448 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
449 : static_assert(0 < 1, "There is no slot for us");
450 :
451 : static bool
452 0 : inverse(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
453 : {
454 0 : binding_detail::FastErrorResult rv;
455 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Inverse(rv)));
456 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
457 0 : return false;
458 : }
459 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
460 : static_assert(!IsPointer<decltype(result)>::value,
461 : "NewObject implies that we need to keep the object alive with a strong reference.");
462 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
463 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
464 0 : return false;
465 : }
466 0 : return true;
467 : }
468 :
469 : static const JSJitInfo inverse_methodinfo = {
470 : { (JSJitGetterOp)inverse },
471 : { prototypes::id::SVGMatrix },
472 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
473 : JSJitInfo::Method,
474 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
475 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
476 : false, /* isInfallible. False in setters. */
477 : false, /* isMovable. Not relevant for setters. */
478 : false, /* isEliminatable. Not relevant for setters. */
479 : false, /* isAlwaysInSlot. Only relevant for getters. */
480 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
481 : false, /* isTypedMethod. Only relevant for methods. */
482 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
483 : };
484 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
485 : static_assert(0 < 1, "There is no slot for us");
486 :
487 : static bool
488 0 : translate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
489 : {
490 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
491 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.translate");
492 : }
493 : float arg0;
494 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
495 0 : return false;
496 0 : } else if (!mozilla::IsFinite(arg0)) {
497 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.translate");
498 0 : return false;
499 : }
500 : float arg1;
501 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
502 0 : return false;
503 0 : } else if (!mozilla::IsFinite(arg1)) {
504 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of SVGMatrix.translate");
505 0 : return false;
506 : }
507 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Translate(arg0, arg1)));
508 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
509 : static_assert(!IsPointer<decltype(result)>::value,
510 : "NewObject implies that we need to keep the object alive with a strong reference.");
511 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
512 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
513 0 : return false;
514 : }
515 0 : return true;
516 : }
517 :
518 : static const JSJitInfo translate_methodinfo = {
519 : { (JSJitGetterOp)translate },
520 : { prototypes::id::SVGMatrix },
521 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
522 : JSJitInfo::Method,
523 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
524 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
525 : false, /* isInfallible. False in setters. */
526 : false, /* isMovable. Not relevant for setters. */
527 : false, /* isEliminatable. Not relevant for setters. */
528 : false, /* isAlwaysInSlot. Only relevant for getters. */
529 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
530 : false, /* isTypedMethod. Only relevant for methods. */
531 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
532 : };
533 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
534 : static_assert(0 < 1, "There is no slot for us");
535 :
536 : static bool
537 0 : scale(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
538 : {
539 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
540 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.scale");
541 : }
542 : float arg0;
543 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
544 0 : return false;
545 0 : } else if (!mozilla::IsFinite(arg0)) {
546 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.scale");
547 0 : return false;
548 : }
549 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Scale(arg0)));
550 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
551 : static_assert(!IsPointer<decltype(result)>::value,
552 : "NewObject implies that we need to keep the object alive with a strong reference.");
553 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
554 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
555 0 : return false;
556 : }
557 0 : return true;
558 : }
559 :
560 : static const JSJitInfo scale_methodinfo = {
561 : { (JSJitGetterOp)scale },
562 : { prototypes::id::SVGMatrix },
563 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
564 : JSJitInfo::Method,
565 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
566 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
567 : false, /* isInfallible. False in setters. */
568 : false, /* isMovable. Not relevant for setters. */
569 : false, /* isEliminatable. Not relevant for setters. */
570 : false, /* isAlwaysInSlot. Only relevant for getters. */
571 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
572 : false, /* isTypedMethod. Only relevant for methods. */
573 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
574 : };
575 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
576 : static_assert(0 < 1, "There is no slot for us");
577 :
578 : static bool
579 0 : scaleNonUniform(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
580 : {
581 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
582 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.scaleNonUniform");
583 : }
584 : float arg0;
585 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
586 0 : return false;
587 0 : } else if (!mozilla::IsFinite(arg0)) {
588 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.scaleNonUniform");
589 0 : return false;
590 : }
591 : float arg1;
592 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
593 0 : return false;
594 0 : } else if (!mozilla::IsFinite(arg1)) {
595 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of SVGMatrix.scaleNonUniform");
596 0 : return false;
597 : }
598 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->ScaleNonUniform(arg0, arg1)));
599 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
600 : static_assert(!IsPointer<decltype(result)>::value,
601 : "NewObject implies that we need to keep the object alive with a strong reference.");
602 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
603 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
604 0 : return false;
605 : }
606 0 : return true;
607 : }
608 :
609 : static const JSJitInfo scaleNonUniform_methodinfo = {
610 : { (JSJitGetterOp)scaleNonUniform },
611 : { prototypes::id::SVGMatrix },
612 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
613 : JSJitInfo::Method,
614 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
615 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
616 : false, /* isInfallible. False in setters. */
617 : false, /* isMovable. Not relevant for setters. */
618 : false, /* isEliminatable. Not relevant for setters. */
619 : false, /* isAlwaysInSlot. Only relevant for getters. */
620 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
621 : false, /* isTypedMethod. Only relevant for methods. */
622 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
623 : };
624 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
625 : static_assert(0 < 1, "There is no slot for us");
626 :
627 : static bool
628 0 : rotate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
629 : {
630 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
631 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.rotate");
632 : }
633 : float arg0;
634 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
635 0 : return false;
636 0 : } else if (!mozilla::IsFinite(arg0)) {
637 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.rotate");
638 0 : return false;
639 : }
640 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->Rotate(arg0)));
641 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
642 : static_assert(!IsPointer<decltype(result)>::value,
643 : "NewObject implies that we need to keep the object alive with a strong reference.");
644 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
645 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
646 0 : return false;
647 : }
648 0 : return true;
649 : }
650 :
651 : static const JSJitInfo rotate_methodinfo = {
652 : { (JSJitGetterOp)rotate },
653 : { prototypes::id::SVGMatrix },
654 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
655 : JSJitInfo::Method,
656 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
657 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
658 : false, /* isInfallible. False in setters. */
659 : false, /* isMovable. Not relevant for setters. */
660 : false, /* isEliminatable. Not relevant for setters. */
661 : false, /* isAlwaysInSlot. Only relevant for getters. */
662 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
663 : false, /* isTypedMethod. Only relevant for methods. */
664 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
665 : };
666 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
667 : static_assert(0 < 1, "There is no slot for us");
668 :
669 : static bool
670 0 : rotateFromVector(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
671 : {
672 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
673 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.rotateFromVector");
674 : }
675 : float arg0;
676 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
677 0 : return false;
678 0 : } else if (!mozilla::IsFinite(arg0)) {
679 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.rotateFromVector");
680 0 : return false;
681 : }
682 : float arg1;
683 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
684 0 : return false;
685 0 : } else if (!mozilla::IsFinite(arg1)) {
686 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of SVGMatrix.rotateFromVector");
687 0 : return false;
688 : }
689 0 : binding_detail::FastErrorResult rv;
690 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->RotateFromVector(arg0, arg1, rv)));
691 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
692 0 : return false;
693 : }
694 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
695 : static_assert(!IsPointer<decltype(result)>::value,
696 : "NewObject implies that we need to keep the object alive with a strong reference.");
697 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
698 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
699 0 : return false;
700 : }
701 0 : return true;
702 : }
703 :
704 : static const JSJitInfo rotateFromVector_methodinfo = {
705 : { (JSJitGetterOp)rotateFromVector },
706 : { prototypes::id::SVGMatrix },
707 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
708 : JSJitInfo::Method,
709 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
710 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
711 : false, /* isInfallible. False in setters. */
712 : false, /* isMovable. Not relevant for setters. */
713 : false, /* isEliminatable. Not relevant for setters. */
714 : false, /* isAlwaysInSlot. Only relevant for getters. */
715 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
716 : false, /* isTypedMethod. Only relevant for methods. */
717 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
718 : };
719 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
720 : static_assert(0 < 1, "There is no slot for us");
721 :
722 : static bool
723 0 : flipX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
724 : {
725 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->FlipX()));
726 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
727 : static_assert(!IsPointer<decltype(result)>::value,
728 : "NewObject implies that we need to keep the object alive with a strong reference.");
729 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
730 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
731 0 : return false;
732 : }
733 0 : return true;
734 : }
735 :
736 : static const JSJitInfo flipX_methodinfo = {
737 : { (JSJitGetterOp)flipX },
738 : { prototypes::id::SVGMatrix },
739 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
740 : JSJitInfo::Method,
741 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
742 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
743 : false, /* isInfallible. False in setters. */
744 : false, /* isMovable. Not relevant for setters. */
745 : false, /* isEliminatable. Not relevant for setters. */
746 : false, /* isAlwaysInSlot. Only relevant for getters. */
747 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
748 : false, /* isTypedMethod. Only relevant for methods. */
749 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
750 : };
751 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
752 : static_assert(0 < 1, "There is no slot for us");
753 :
754 : static bool
755 0 : flipY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
756 : {
757 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->FlipY()));
758 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
759 : static_assert(!IsPointer<decltype(result)>::value,
760 : "NewObject implies that we need to keep the object alive with a strong reference.");
761 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
762 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
763 0 : return false;
764 : }
765 0 : return true;
766 : }
767 :
768 : static const JSJitInfo flipY_methodinfo = {
769 : { (JSJitGetterOp)flipY },
770 : { prototypes::id::SVGMatrix },
771 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
772 : JSJitInfo::Method,
773 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
774 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
775 : false, /* isInfallible. False in setters. */
776 : false, /* isMovable. Not relevant for setters. */
777 : false, /* isEliminatable. Not relevant for setters. */
778 : false, /* isAlwaysInSlot. Only relevant for getters. */
779 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
780 : false, /* isTypedMethod. Only relevant for methods. */
781 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
782 : };
783 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
784 : static_assert(0 < 1, "There is no slot for us");
785 :
786 : static bool
787 0 : skewX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
788 : {
789 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
790 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.skewX");
791 : }
792 : float arg0;
793 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
794 0 : return false;
795 0 : } else if (!mozilla::IsFinite(arg0)) {
796 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.skewX");
797 0 : return false;
798 : }
799 0 : binding_detail::FastErrorResult rv;
800 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->SkewX(arg0, rv)));
801 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
802 0 : return false;
803 : }
804 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
805 : static_assert(!IsPointer<decltype(result)>::value,
806 : "NewObject implies that we need to keep the object alive with a strong reference.");
807 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
808 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
809 0 : return false;
810 : }
811 0 : return true;
812 : }
813 :
814 : static const JSJitInfo skewX_methodinfo = {
815 : { (JSJitGetterOp)skewX },
816 : { prototypes::id::SVGMatrix },
817 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
818 : JSJitInfo::Method,
819 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
820 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
821 : false, /* isInfallible. False in setters. */
822 : false, /* isMovable. Not relevant for setters. */
823 : false, /* isEliminatable. Not relevant for setters. */
824 : false, /* isAlwaysInSlot. Only relevant for getters. */
825 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
826 : false, /* isTypedMethod. Only relevant for methods. */
827 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
828 : };
829 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
830 : static_assert(0 < 1, "There is no slot for us");
831 :
832 : static bool
833 0 : skewY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGMatrix* self, const JSJitMethodCallArgs& args)
834 : {
835 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
836 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGMatrix.skewY");
837 : }
838 : float arg0;
839 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
840 0 : return false;
841 0 : } else if (!mozilla::IsFinite(arg0)) {
842 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGMatrix.skewY");
843 0 : return false;
844 : }
845 0 : binding_detail::FastErrorResult rv;
846 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->SkewY(arg0, rv)));
847 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
848 0 : return false;
849 : }
850 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
851 : static_assert(!IsPointer<decltype(result)>::value,
852 : "NewObject implies that we need to keep the object alive with a strong reference.");
853 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
854 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
855 0 : return false;
856 : }
857 0 : return true;
858 : }
859 :
860 : static const JSJitInfo skewY_methodinfo = {
861 : { (JSJitGetterOp)skewY },
862 : { prototypes::id::SVGMatrix },
863 : { PrototypeTraits<prototypes::id::SVGMatrix>::Depth },
864 : JSJitInfo::Method,
865 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
866 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
867 : false, /* isInfallible. False in setters. */
868 : false, /* isMovable. Not relevant for setters. */
869 : false, /* isEliminatable. Not relevant for setters. */
870 : false, /* isAlwaysInSlot. Only relevant for getters. */
871 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
872 : false, /* isTypedMethod. Only relevant for methods. */
873 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
874 : };
875 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
876 : static_assert(0 < 1, "There is no slot for us");
877 :
878 : static bool
879 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
880 : {
881 0 : mozilla::dom::SVGMatrix* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMatrix>(obj);
882 : // We don't want to preserve if we don't have a wrapper, and we
883 : // obviously can't preserve if we're not initialized.
884 0 : if (self && self->GetWrapperPreserveColor()) {
885 0 : PreserveWrapper(self);
886 : }
887 0 : return true;
888 : }
889 :
890 : static void
891 0 : _finalize(js::FreeOp* fop, JSObject* obj)
892 : {
893 0 : mozilla::dom::SVGMatrix* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMatrix>(obj);
894 0 : if (self) {
895 0 : ClearWrapper(self, self, obj);
896 0 : AddForDeferredFinalization<mozilla::dom::SVGMatrix>(self);
897 : }
898 0 : }
899 :
900 : static void
901 0 : _objectMoved(JSObject* obj, const JSObject* old)
902 : {
903 0 : mozilla::dom::SVGMatrix* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGMatrix>(obj);
904 0 : if (self) {
905 0 : UpdateWrapper(self, self, obj, old);
906 : }
907 0 : }
908 :
909 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
910 : #if defined(__clang__)
911 : #pragma clang diagnostic push
912 : #pragma clang diagnostic ignored "-Wmissing-braces"
913 : #endif
914 : static const JSFunctionSpec sMethods_specs[] = {
915 : JS_FNSPEC("multiply", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&multiply_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
916 : JS_FNSPEC("inverse", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&inverse_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
917 : JS_FNSPEC("translate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&translate_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
918 : JS_FNSPEC("scale", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scale_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
919 : JS_FNSPEC("scaleNonUniform", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&scaleNonUniform_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
920 : JS_FNSPEC("rotate", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&rotate_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
921 : JS_FNSPEC("rotateFromVector", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&rotateFromVector_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
922 : JS_FNSPEC("flipX", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&flipX_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
923 : JS_FNSPEC("flipY", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&flipY_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
924 : JS_FNSPEC("skewX", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&skewX_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
925 : JS_FNSPEC("skewY", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&skewY_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
926 : JS_FS_END
927 : };
928 : #if defined(__clang__)
929 : #pragma clang diagnostic pop
930 : #endif
931 :
932 :
933 : // Can't be const because the pref-enabled boolean needs to be writable
934 : static Prefable<const JSFunctionSpec> sMethods[] = {
935 : { nullptr, &sMethods_specs[0] },
936 : { nullptr, nullptr }
937 : };
938 :
939 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
940 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
941 : static_assert(11 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
942 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
943 :
944 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
945 : #if defined(__clang__)
946 : #pragma clang diagnostic push
947 : #pragma clang diagnostic ignored "-Wmissing-braces"
948 : #endif
949 : static const JSPropertySpec sAttributes_specs[] = {
950 : { "a", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &a_getterinfo, GenericBindingSetter, &a_setterinfo },
951 : { "b", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &b_getterinfo, GenericBindingSetter, &b_setterinfo },
952 : { "c", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &c_getterinfo, GenericBindingSetter, &c_setterinfo },
953 : { "d", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &d_getterinfo, GenericBindingSetter, &d_setterinfo },
954 : { "e", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &e_getterinfo, GenericBindingSetter, &e_setterinfo },
955 : { "f", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &f_getterinfo, GenericBindingSetter, &f_setterinfo },
956 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
957 : };
958 : #if defined(__clang__)
959 : #pragma clang diagnostic pop
960 : #endif
961 :
962 :
963 : // Can't be const because the pref-enabled boolean needs to be writable
964 : static Prefable<const JSPropertySpec> sAttributes[] = {
965 : { nullptr, &sAttributes_specs[0] },
966 : { nullptr, nullptr }
967 : };
968 :
969 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
970 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
971 : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
972 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
973 :
974 :
975 : static uint16_t sNativeProperties_sortedPropertyIndices[17];
976 : static PropertyInfo sNativeProperties_propertyInfos[17];
977 :
978 : static const NativePropertiesN<2> sNativeProperties = {
979 : false, 0,
980 : false, 0,
981 : true, 0 /* sMethods */,
982 : true, 1 /* sAttributes */,
983 : false, 0,
984 : false, 0,
985 : false, 0,
986 : -1,
987 : 17,
988 : sNativeProperties_sortedPropertyIndices,
989 : {
990 : { sMethods, &sNativeProperties_propertyInfos[0] },
991 : { sAttributes, &sNativeProperties_propertyInfos[11] }
992 : }
993 : };
994 : static_assert(17 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
995 : "We have a property info count that is oversized");
996 :
997 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
998 : {
999 : "Function",
1000 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1001 : &sBoringInterfaceObjectClassClassOps,
1002 : JS_NULL_CLASS_SPEC,
1003 : JS_NULL_CLASS_EXT,
1004 : &sInterfaceObjectClassObjectOps
1005 : },
1006 : eInterface,
1007 : true,
1008 : prototypes::id::SVGMatrix,
1009 : PrototypeTraits<prototypes::id::SVGMatrix>::Depth,
1010 : sNativePropertyHooks,
1011 : "function SVGMatrix() {\n [native code]\n}",
1012 : JS::GetRealmFunctionPrototype
1013 : };
1014 :
1015 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1016 : {
1017 : "SVGMatrixPrototype",
1018 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1019 : JS_NULL_CLASS_OPS,
1020 : JS_NULL_CLASS_SPEC,
1021 : JS_NULL_CLASS_EXT,
1022 : JS_NULL_OBJECT_OPS
1023 : },
1024 : eInterfacePrototype,
1025 : false,
1026 : prototypes::id::SVGMatrix,
1027 : PrototypeTraits<prototypes::id::SVGMatrix>::Depth,
1028 : sNativePropertyHooks,
1029 : "[object SVGMatrixPrototype]",
1030 : JS::GetRealmObjectPrototype
1031 : };
1032 :
1033 : JSObject*
1034 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
1035 : {
1036 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
1037 : }
1038 :
1039 : static const js::ClassOps sClassOps = {
1040 : _addProperty, /* addProperty */
1041 : nullptr, /* delProperty */
1042 : nullptr, /* getProperty */
1043 : nullptr, /* setProperty */
1044 : nullptr, /* enumerate */
1045 : nullptr, /* newEnumerate */
1046 : nullptr, /* resolve */
1047 : nullptr, /* mayResolve */
1048 : _finalize, /* finalize */
1049 : nullptr, /* call */
1050 : nullptr, /* hasInstance */
1051 : nullptr, /* construct */
1052 : nullptr, /* trace */
1053 : };
1054 :
1055 : static const js::ClassExtension sClassExtension = {
1056 : nullptr, /* weakmapKeyDelegateOp */
1057 : _objectMoved /* objectMovedOp */
1058 : };
1059 :
1060 : static const DOMJSClass sClass = {
1061 : { "SVGMatrix",
1062 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1063 : &sClassOps,
1064 : JS_NULL_CLASS_SPEC,
1065 : &sClassExtension,
1066 : JS_NULL_OBJECT_OPS
1067 : },
1068 : { prototypes::id::SVGMatrix, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1069 : IsBaseOf<nsISupports, mozilla::dom::SVGMatrix >::value,
1070 : sNativePropertyHooks,
1071 : FindAssociatedGlobalForNative<mozilla::dom::SVGMatrix>::Get,
1072 : GetProtoObjectHandle,
1073 : GetCCParticipant<mozilla::dom::SVGMatrix>::Get()
1074 : };
1075 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1076 : "Must have the right minimal number of reserved slots.");
1077 : static_assert(1 >= 1,
1078 : "Must have enough reserved slots.");
1079 :
1080 : const JSClass*
1081 0 : GetJSClass()
1082 : {
1083 0 : return sClass.ToJSClass();
1084 : }
1085 :
1086 : bool
1087 0 : Wrap(JSContext* aCx, mozilla::dom::SVGMatrix* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1088 : {
1089 : MOZ_ASSERT(static_cast<mozilla::dom::SVGMatrix*>(aObject) ==
1090 : reinterpret_cast<mozilla::dom::SVGMatrix*>(aObject),
1091 : "Multiple inheritance for mozilla::dom::SVGMatrix is broken.");
1092 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1093 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1094 0 : MOZ_ASSERT(!aCache->GetWrapper(),
1095 : "You should probably not be using Wrap() directly; use "
1096 : "GetOrCreateDOMReflector instead");
1097 :
1098 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1099 : "nsISupports must be on our primary inheritance chain");
1100 :
1101 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1102 0 : if (!global) {
1103 0 : return false;
1104 : }
1105 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
1106 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
1107 :
1108 : // That might have ended up wrapping us already, due to the wonders
1109 : // of XBL. Check for that, and bail out as needed.
1110 0 : aReflector.set(aCache->GetWrapper());
1111 0 : if (aReflector) {
1112 : #ifdef DEBUG
1113 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1114 : #endif // DEBUG
1115 0 : return true;
1116 : }
1117 :
1118 0 : JSAutoCompartment ac(aCx, global);
1119 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1120 0 : if (!canonicalProto) {
1121 0 : return false;
1122 : }
1123 0 : JS::Rooted<JSObject*> proto(aCx);
1124 0 : if (aGivenProto) {
1125 0 : proto = aGivenProto;
1126 : // Unfortunately, while aGivenProto was in the compartment of aCx
1127 : // coming in, we changed compartments to that of "parent" so may need
1128 : // to wrap the proto here.
1129 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1130 0 : if (!JS_WrapObject(aCx, &proto)) {
1131 0 : return false;
1132 : }
1133 : }
1134 : } else {
1135 0 : proto = canonicalProto;
1136 : }
1137 :
1138 0 : BindingJSObjectCreator<mozilla::dom::SVGMatrix> creator(aCx);
1139 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1140 0 : if (!aReflector) {
1141 0 : return false;
1142 : }
1143 :
1144 0 : aCache->SetWrapper(aReflector);
1145 0 : creator.InitializationSucceeded();
1146 :
1147 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1148 : aCache->GetWrapperPreserveColor() == aReflector);
1149 : // If proto != canonicalProto, we have to preserve our wrapper;
1150 : // otherwise we won't be able to properly recreate it later, since
1151 : // we won't know what proto to use. Note that we don't check
1152 : // aGivenProto here, since it's entirely possible (and even
1153 : // somewhat common) to have a non-null aGivenProto which is the
1154 : // same as canonicalProto.
1155 0 : if (proto != canonicalProto) {
1156 0 : PreserveWrapper(aObject);
1157 : }
1158 :
1159 0 : return true;
1160 : }
1161 :
1162 : const NativePropertyHooks sNativePropertyHooks[] = { {
1163 : nullptr,
1164 : nullptr,
1165 : nullptr,
1166 : { sNativeProperties.Upcast(), nullptr },
1167 : prototypes::id::SVGMatrix,
1168 : constructors::id::SVGMatrix,
1169 : nullptr,
1170 : &DefaultXrayExpandoObjectClass
1171 : } };
1172 :
1173 : void
1174 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1175 : {
1176 0 : JS::Rooted<JSObject*> parentProto(aCx, JS::GetRealmObjectPrototype(aCx));
1177 0 : if (!parentProto) {
1178 0 : return;
1179 : }
1180 :
1181 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
1182 0 : if (!constructorProto) {
1183 0 : return;
1184 : }
1185 :
1186 : static bool sIdsInited = false;
1187 0 : if (!sIdsInited && NS_IsMainThread()) {
1188 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
1189 0 : return;
1190 : }
1191 0 : sIdsInited = true;
1192 : }
1193 :
1194 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGMatrix);
1195 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGMatrix);
1196 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1197 : &sPrototypeClass.mBase, protoCache,
1198 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
1199 : interfaceCache,
1200 : sNativeProperties.Upcast(),
1201 : nullptr,
1202 : "SVGMatrix", aDefineOnGlobal,
1203 : nullptr,
1204 0 : false);
1205 : }
1206 :
1207 : JS::Handle<JSObject*>
1208 0 : GetProtoObjectHandle(JSContext* aCx)
1209 : {
1210 : /* Get the interface prototype object for this class. This will create the
1211 : object as needed. */
1212 0 : bool aDefineOnGlobal = true;
1213 :
1214 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1215 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1216 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1217 0 : return nullptr;
1218 : }
1219 :
1220 : /* Check to see whether the interface objects are already installed */
1221 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1222 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGMatrix)) {
1223 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1224 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1225 : }
1226 :
1227 : /*
1228 : * The object might _still_ be null, but that's OK.
1229 : *
1230 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1231 : * traced by TraceProtoAndIfaceCache() and its contents are never
1232 : * changed after they have been set.
1233 : *
1234 : * Calling address() avoids the read read barrier that does gray
1235 : * unmarking, but it's not possible for the object to be gray here.
1236 : */
1237 :
1238 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGMatrix);
1239 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1240 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1241 : }
1242 :
1243 : JS::Handle<JSObject*>
1244 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
1245 : {
1246 : /* Get the interface object for this class. This will create the object as
1247 : needed. */
1248 :
1249 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1250 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1251 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1252 0 : return nullptr;
1253 : }
1254 :
1255 : /* Check to see whether the interface objects are already installed */
1256 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1257 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGMatrix)) {
1258 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1259 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1260 : }
1261 :
1262 : /*
1263 : * The object might _still_ be null, but that's OK.
1264 : *
1265 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1266 : * traced by TraceProtoAndIfaceCache() and its contents are never
1267 : * changed after they have been set.
1268 : *
1269 : * Calling address() avoids the read read barrier that does gray
1270 : * unmarking, but it's not possible for the object to be gray here.
1271 : */
1272 :
1273 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGMatrix);
1274 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1275 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1276 : }
1277 :
1278 : JSObject*
1279 0 : GetConstructorObject(JSContext* aCx)
1280 : {
1281 0 : return GetConstructorObjectHandle(aCx);
1282 : }
1283 :
1284 : } // namespace SVGMatrixBinding
1285 :
1286 :
1287 :
1288 : } // namespace dom
1289 : } // namespace mozilla
|