Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGSVGElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "DOMSVGLength.h"
4 : #include "DOMSVGNumber.h"
5 : #include "SVGAnimatedPreserveAspectRatio.h"
6 : #include "SVGGraphicsElementBinding.h"
7 : #include "SVGSVGElementBinding.h"
8 : #include "WrapperFactory.h"
9 : #include "mozilla/FloatingPoint.h"
10 : #include "mozilla/OwningNonNull.h"
11 : #include "mozilla/UseCounter.h"
12 : #include "mozilla/dom/BindingUtils.h"
13 : #include "mozilla/dom/DOMJSClass.h"
14 : #include "mozilla/dom/Element.h"
15 : #include "mozilla/dom/NonRefcountedDOMObject.h"
16 : #include "mozilla/dom/Nullable.h"
17 : #include "mozilla/dom/PrimitiveConversions.h"
18 : #include "mozilla/dom/SVGAngle.h"
19 : #include "mozilla/dom/SVGAnimatedLength.h"
20 : #include "mozilla/dom/SVGAnimatedRect.h"
21 : #include "mozilla/dom/SVGIRect.h"
22 : #include "mozilla/dom/SVGMatrix.h"
23 : #include "mozilla/dom/SVGSVGElement.h"
24 : #include "mozilla/dom/SVGTransform.h"
25 : #include "mozilla/dom/XrayExpandoClass.h"
26 : #include "nsISVGPoint.h"
27 :
28 : namespace mozilla {
29 : namespace dom {
30 :
31 : namespace SVGSVGElementBinding {
32 :
33 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGGraphicsElementBinding::NativeType>::value,
34 : "Can't inherit from an interface with a different ownership model.");
35 :
36 : static bool
37 0 : get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
38 : {
39 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
40 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
41 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
42 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
43 0 : return false;
44 : }
45 0 : return true;
46 : }
47 :
48 : static const JSJitInfo x_getterinfo = {
49 : { (JSJitGetterOp)get_x },
50 : { prototypes::id::SVGSVGElement },
51 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
52 : JSJitInfo::Getter,
53 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
54 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
55 : false, /* isInfallible. False in setters. */
56 : true, /* isMovable. Not relevant for setters. */
57 : true, /* 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 :
66 : static bool
67 0 : get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
68 : {
69 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
70 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
71 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
72 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
73 0 : return false;
74 : }
75 0 : return true;
76 : }
77 :
78 : static const JSJitInfo y_getterinfo = {
79 : { (JSJitGetterOp)get_y },
80 : { prototypes::id::SVGSVGElement },
81 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
82 : JSJitInfo::Getter,
83 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
84 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
85 : false, /* isInfallible. False in setters. */
86 : true, /* isMovable. Not relevant for setters. */
87 : true, /* isEliminatable. Not relevant for setters. */
88 : false, /* isAlwaysInSlot. Only relevant for getters. */
89 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
90 : false, /* isTypedMethod. Only relevant for methods. */
91 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
92 : };
93 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
94 : static_assert(0 < 1, "There is no slot for us");
95 :
96 : static bool
97 0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
98 : {
99 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
100 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
101 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
102 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
103 0 : return false;
104 : }
105 0 : return true;
106 : }
107 :
108 : static const JSJitInfo width_getterinfo = {
109 : { (JSJitGetterOp)get_width },
110 : { prototypes::id::SVGSVGElement },
111 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
112 : JSJitInfo::Getter,
113 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
114 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
115 : false, /* isInfallible. False in setters. */
116 : true, /* isMovable. Not relevant for setters. */
117 : true, /* isEliminatable. Not relevant for setters. */
118 : false, /* isAlwaysInSlot. Only relevant for getters. */
119 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
120 : false, /* isTypedMethod. Only relevant for methods. */
121 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
122 : };
123 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
124 : static_assert(0 < 1, "There is no slot for us");
125 :
126 : static bool
127 0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
128 : {
129 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
130 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
131 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
132 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
133 0 : return false;
134 : }
135 0 : return true;
136 : }
137 :
138 : static const JSJitInfo height_getterinfo = {
139 : { (JSJitGetterOp)get_height },
140 : { prototypes::id::SVGSVGElement },
141 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
142 : JSJitInfo::Getter,
143 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
144 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
145 : false, /* isInfallible. False in setters. */
146 : true, /* isMovable. Not relevant for setters. */
147 : true, /* isEliminatable. Not relevant for setters. */
148 : false, /* isAlwaysInSlot. Only relevant for getters. */
149 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
150 : false, /* isTypedMethod. Only relevant for methods. */
151 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
152 : };
153 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
154 : static_assert(0 < 1, "There is no slot for us");
155 :
156 : static bool
157 0 : get_pixelUnitToMillimeterX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
158 : {
159 0 : float result(self->PixelUnitToMillimeterX());
160 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
161 0 : args.rval().set(JS_NumberValue(double(result)));
162 0 : return true;
163 : }
164 :
165 : static const JSJitInfo pixelUnitToMillimeterX_getterinfo = {
166 : { (JSJitGetterOp)get_pixelUnitToMillimeterX },
167 : { prototypes::id::SVGSVGElement },
168 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
169 : JSJitInfo::Getter,
170 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
171 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
172 : true, /* isInfallible. False in setters. */
173 : true, /* isMovable. Not relevant for setters. */
174 : true, /* isEliminatable. Not relevant for setters. */
175 : false, /* isAlwaysInSlot. Only relevant for getters. */
176 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
177 : false, /* isTypedMethod. Only relevant for methods. */
178 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
179 : };
180 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
181 : static_assert(0 < 1, "There is no slot for us");
182 :
183 : static bool
184 0 : get_pixelUnitToMillimeterY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
185 : {
186 0 : float result(self->PixelUnitToMillimeterY());
187 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
188 0 : args.rval().set(JS_NumberValue(double(result)));
189 0 : return true;
190 : }
191 :
192 : static const JSJitInfo pixelUnitToMillimeterY_getterinfo = {
193 : { (JSJitGetterOp)get_pixelUnitToMillimeterY },
194 : { prototypes::id::SVGSVGElement },
195 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
196 : JSJitInfo::Getter,
197 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
198 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
199 : true, /* isInfallible. False in setters. */
200 : true, /* isMovable. Not relevant for setters. */
201 : true, /* isEliminatable. Not relevant for setters. */
202 : false, /* isAlwaysInSlot. Only relevant for getters. */
203 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
204 : false, /* isTypedMethod. Only relevant for methods. */
205 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
206 : };
207 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
208 : static_assert(0 < 1, "There is no slot for us");
209 :
210 : static bool
211 0 : get_screenPixelToMillimeterX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
212 : {
213 0 : float result(self->ScreenPixelToMillimeterX());
214 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
215 0 : args.rval().set(JS_NumberValue(double(result)));
216 0 : return true;
217 : }
218 :
219 : static const JSJitInfo screenPixelToMillimeterX_getterinfo = {
220 : { (JSJitGetterOp)get_screenPixelToMillimeterX },
221 : { prototypes::id::SVGSVGElement },
222 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
223 : JSJitInfo::Getter,
224 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
225 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
226 : true, /* isInfallible. False in setters. */
227 : true, /* isMovable. Not relevant for setters. */
228 : true, /* isEliminatable. Not relevant for setters. */
229 : false, /* isAlwaysInSlot. Only relevant for getters. */
230 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
231 : false, /* isTypedMethod. Only relevant for methods. */
232 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
233 : };
234 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
235 : static_assert(0 < 1, "There is no slot for us");
236 :
237 : static bool
238 0 : get_screenPixelToMillimeterY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
239 : {
240 0 : float result(self->ScreenPixelToMillimeterY());
241 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
242 0 : args.rval().set(JS_NumberValue(double(result)));
243 0 : return true;
244 : }
245 :
246 : static const JSJitInfo screenPixelToMillimeterY_getterinfo = {
247 : { (JSJitGetterOp)get_screenPixelToMillimeterY },
248 : { prototypes::id::SVGSVGElement },
249 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
250 : JSJitInfo::Getter,
251 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
252 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
253 : true, /* isInfallible. False in setters. */
254 : true, /* isMovable. Not relevant for setters. */
255 : true, /* isEliminatable. Not relevant for setters. */
256 : false, /* isAlwaysInSlot. Only relevant for getters. */
257 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
258 : false, /* isTypedMethod. Only relevant for methods. */
259 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
260 : };
261 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
262 : static_assert(0 < 1, "There is no slot for us");
263 :
264 : static bool
265 0 : get_useCurrentView(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
266 : {
267 0 : bool result(self->UseCurrentView());
268 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
269 0 : args.rval().setBoolean(result);
270 0 : return true;
271 : }
272 :
273 : static const JSJitInfo useCurrentView_getterinfo = {
274 : { (JSJitGetterOp)get_useCurrentView },
275 : { prototypes::id::SVGSVGElement },
276 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
277 : JSJitInfo::Getter,
278 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
279 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
280 : true, /* isInfallible. False in setters. */
281 : false, /* isMovable. Not relevant for setters. */
282 : false, /* isEliminatable. Not relevant for setters. */
283 : false, /* isAlwaysInSlot. Only relevant for getters. */
284 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
285 : false, /* isTypedMethod. Only relevant for methods. */
286 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
287 : };
288 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
289 : static_assert(0 < 1, "There is no slot for us");
290 :
291 : static bool
292 0 : get_currentScale(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
293 : {
294 0 : float result(self->CurrentScale());
295 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
296 0 : SetDocumentAndPageUseCounter(cx, obj, eUseCounter_SVGSVGElement_currentScale_getter);
297 0 : args.rval().set(JS_NumberValue(double(result)));
298 0 : return true;
299 : }
300 :
301 : static bool
302 0 : set_currentScale(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitSetterCallArgs args)
303 : {
304 : float arg0;
305 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
306 0 : return false;
307 0 : } else if (!mozilla::IsFinite(arg0)) {
308 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Value being assigned to SVGSVGElement.currentScale");
309 0 : return false;
310 : }
311 0 : self->SetCurrentScale(arg0);
312 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
313 0 : SetDocumentAndPageUseCounter(cx, obj, eUseCounter_SVGSVGElement_currentScale_setter);
314 :
315 0 : return true;
316 : }
317 :
318 : static const JSJitInfo currentScale_getterinfo = {
319 : { (JSJitGetterOp)get_currentScale },
320 : { prototypes::id::SVGSVGElement },
321 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
322 : JSJitInfo::Getter,
323 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
324 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
325 : true, /* isInfallible. False in setters. */
326 : false, /* isMovable. Not relevant for setters. */
327 : false, /* isEliminatable. Not relevant for setters. */
328 : false, /* isAlwaysInSlot. Only relevant for getters. */
329 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
330 : false, /* isTypedMethod. Only relevant for methods. */
331 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
332 : };
333 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
334 : static_assert(0 < 1, "There is no slot for us");
335 : static const JSJitInfo currentScale_setterinfo = {
336 : { (JSJitGetterOp)set_currentScale },
337 : { prototypes::id::SVGSVGElement },
338 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
339 : JSJitInfo::Setter,
340 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
341 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
342 : false, /* isInfallible. False in setters. */
343 : false, /* isMovable. Not relevant for setters. */
344 : false, /* isEliminatable. Not relevant for setters. */
345 : false, /* isAlwaysInSlot. Only relevant for getters. */
346 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
347 : false, /* isTypedMethod. Only relevant for methods. */
348 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
349 : };
350 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
351 : static_assert(0 < 1, "There is no slot for us");
352 :
353 : static bool
354 0 : get_currentTranslate(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
355 : {
356 0 : auto result(StrongOrRawPtr<mozilla::nsISVGPoint>(self->CurrentTranslate()));
357 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
358 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
359 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
360 0 : return false;
361 : }
362 0 : return true;
363 : }
364 :
365 : static const JSJitInfo currentTranslate_getterinfo = {
366 : { (JSJitGetterOp)get_currentTranslate },
367 : { prototypes::id::SVGSVGElement },
368 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
369 : JSJitInfo::Getter,
370 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
371 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
372 : false, /* isInfallible. False in setters. */
373 : false, /* isMovable. Not relevant for setters. */
374 : false, /* isEliminatable. Not relevant for setters. */
375 : false, /* isAlwaysInSlot. Only relevant for getters. */
376 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
377 : false, /* isTypedMethod. Only relevant for methods. */
378 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
379 : };
380 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
381 : static_assert(0 < 1, "There is no slot for us");
382 :
383 : static bool
384 0 : suspendRedraw(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
385 : {
386 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
387 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGSVGElement.suspendRedraw");
388 : }
389 : uint32_t arg0;
390 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
391 0 : return false;
392 : }
393 0 : uint32_t result(self->SuspendRedraw(arg0));
394 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
395 0 : args.rval().setNumber(result);
396 0 : return true;
397 : }
398 :
399 : static const JSJitInfo::ArgType suspendRedraw_methodinfo_argTypes[] = { JSJitInfo::Double, JSJitInfo::ArgTypeListEnd };
400 : static const JSTypedMethodJitInfo suspendRedraw_methodinfo = {
401 : {
402 : { (JSJitGetterOp)suspendRedraw },
403 : { prototypes::id::SVGSVGElement },
404 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
405 : JSJitInfo::Method,
406 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
407 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
408 : false, /* isInfallible. False in setters. */
409 : true, /* isMovable. Not relevant for setters. */
410 : true, /* isEliminatable. Not relevant for setters. */
411 : false, /* isAlwaysInSlot. Only relevant for getters. */
412 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
413 : true, /* isTypedMethod. Only relevant for methods. */
414 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
415 : },
416 : suspendRedraw_methodinfo_argTypes
417 : };
418 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
419 : static_assert(0 < 1, "There is no slot for us");
420 :
421 : static bool
422 0 : unsuspendRedraw(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
423 : {
424 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
425 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGSVGElement.unsuspendRedraw");
426 : }
427 : uint32_t arg0;
428 0 : if (!ValueToPrimitive<uint32_t, eDefault>(cx, args[0], &arg0)) {
429 0 : return false;
430 : }
431 0 : self->UnsuspendRedraw(arg0);
432 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
433 0 : args.rval().setUndefined();
434 0 : return true;
435 : }
436 :
437 : static const JSJitInfo::ArgType unsuspendRedraw_methodinfo_argTypes[] = { JSJitInfo::Double, JSJitInfo::ArgTypeListEnd };
438 : static const JSTypedMethodJitInfo unsuspendRedraw_methodinfo = {
439 : {
440 : { (JSJitGetterOp)unsuspendRedraw },
441 : { prototypes::id::SVGSVGElement },
442 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
443 : JSJitInfo::Method,
444 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
445 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
446 : false, /* isInfallible. False in setters. */
447 : true, /* isMovable. Not relevant for setters. */
448 : true, /* isEliminatable. Not relevant for setters. */
449 : false, /* isAlwaysInSlot. Only relevant for getters. */
450 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
451 : true, /* isTypedMethod. Only relevant for methods. */
452 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
453 : },
454 : unsuspendRedraw_methodinfo_argTypes
455 : };
456 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
457 : static_assert(0 < 1, "There is no slot for us");
458 :
459 : static bool
460 0 : unsuspendRedrawAll(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
461 : {
462 0 : self->UnsuspendRedrawAll();
463 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
464 0 : args.rval().setUndefined();
465 0 : return true;
466 : }
467 :
468 : static const JSJitInfo::ArgType unsuspendRedrawAll_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd };
469 : static const JSTypedMethodJitInfo unsuspendRedrawAll_methodinfo = {
470 : {
471 : { (JSJitGetterOp)unsuspendRedrawAll },
472 : { prototypes::id::SVGSVGElement },
473 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
474 : JSJitInfo::Method,
475 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
476 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
477 : true, /* isInfallible. False in setters. */
478 : true, /* isMovable. Not relevant for setters. */
479 : true, /* isEliminatable. Not relevant for setters. */
480 : false, /* isAlwaysInSlot. Only relevant for getters. */
481 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
482 : true, /* isTypedMethod. Only relevant for methods. */
483 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
484 : },
485 : unsuspendRedrawAll_methodinfo_argTypes
486 : };
487 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
488 : static_assert(0 < 1, "There is no slot for us");
489 :
490 : static bool
491 0 : forceRedraw(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
492 : {
493 0 : self->ForceRedraw();
494 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
495 0 : args.rval().setUndefined();
496 0 : return true;
497 : }
498 :
499 : static const JSJitInfo::ArgType forceRedraw_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd };
500 : static const JSTypedMethodJitInfo forceRedraw_methodinfo = {
501 : {
502 : { (JSJitGetterOp)forceRedraw },
503 : { prototypes::id::SVGSVGElement },
504 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
505 : JSJitInfo::Method,
506 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
507 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
508 : true, /* isInfallible. False in setters. */
509 : true, /* isMovable. Not relevant for setters. */
510 : true, /* isEliminatable. Not relevant for setters. */
511 : false, /* isAlwaysInSlot. Only relevant for getters. */
512 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
513 : true, /* isTypedMethod. Only relevant for methods. */
514 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
515 : },
516 : forceRedraw_methodinfo_argTypes
517 : };
518 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
519 : static_assert(0 < 1, "There is no slot for us");
520 :
521 : static bool
522 0 : pauseAnimations(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
523 : {
524 0 : self->PauseAnimations();
525 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
526 0 : args.rval().setUndefined();
527 0 : return true;
528 : }
529 :
530 : static const JSJitInfo pauseAnimations_methodinfo = {
531 : { (JSJitGetterOp)pauseAnimations },
532 : { prototypes::id::SVGSVGElement },
533 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
534 : JSJitInfo::Method,
535 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
536 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
537 : true, /* isInfallible. False in setters. */
538 : false, /* isMovable. Not relevant for setters. */
539 : false, /* isEliminatable. Not relevant for setters. */
540 : false, /* isAlwaysInSlot. Only relevant for getters. */
541 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
542 : false, /* isTypedMethod. Only relevant for methods. */
543 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
544 : };
545 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
546 : static_assert(0 < 1, "There is no slot for us");
547 :
548 : static bool
549 0 : unpauseAnimations(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
550 : {
551 0 : self->UnpauseAnimations();
552 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
553 0 : args.rval().setUndefined();
554 0 : return true;
555 : }
556 :
557 : static const JSJitInfo unpauseAnimations_methodinfo = {
558 : { (JSJitGetterOp)unpauseAnimations },
559 : { prototypes::id::SVGSVGElement },
560 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
561 : JSJitInfo::Method,
562 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
563 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
564 : true, /* isInfallible. False in setters. */
565 : false, /* isMovable. Not relevant for setters. */
566 : false, /* isEliminatable. Not relevant for setters. */
567 : false, /* isAlwaysInSlot. Only relevant for getters. */
568 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
569 : false, /* isTypedMethod. Only relevant for methods. */
570 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
571 : };
572 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
573 : static_assert(0 < 1, "There is no slot for us");
574 :
575 : static bool
576 0 : animationsPaused(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
577 : {
578 0 : bool result(self->AnimationsPaused());
579 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
580 0 : args.rval().setBoolean(result);
581 0 : return true;
582 : }
583 :
584 : static const JSJitInfo animationsPaused_methodinfo = {
585 : { (JSJitGetterOp)animationsPaused },
586 : { prototypes::id::SVGSVGElement },
587 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
588 : JSJitInfo::Method,
589 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
590 : JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */
591 : true, /* isInfallible. False in setters. */
592 : false, /* isMovable. Not relevant for setters. */
593 : false, /* isEliminatable. Not relevant for setters. */
594 : false, /* isAlwaysInSlot. Only relevant for getters. */
595 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
596 : false, /* isTypedMethod. Only relevant for methods. */
597 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
598 : };
599 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
600 : static_assert(0 < 1, "There is no slot for us");
601 :
602 : static bool
603 0 : getCurrentTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
604 : {
605 0 : float result(self->GetCurrentTime());
606 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
607 0 : args.rval().set(JS_NumberValue(double(result)));
608 0 : return true;
609 : }
610 :
611 : static const JSJitInfo getCurrentTime_methodinfo = {
612 : { (JSJitGetterOp)getCurrentTime },
613 : { prototypes::id::SVGSVGElement },
614 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
615 : JSJitInfo::Method,
616 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
617 : JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */
618 : true, /* isInfallible. False in setters. */
619 : false, /* isMovable. Not relevant for setters. */
620 : false, /* isEliminatable. Not relevant for setters. */
621 : false, /* isAlwaysInSlot. Only relevant for getters. */
622 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
623 : false, /* isTypedMethod. Only relevant for methods. */
624 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
625 : };
626 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
627 : static_assert(0 < 1, "There is no slot for us");
628 :
629 : static bool
630 0 : setCurrentTime(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
631 : {
632 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
633 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGSVGElement.setCurrentTime");
634 : }
635 : float arg0;
636 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
637 0 : return false;
638 0 : } else if (!mozilla::IsFinite(arg0)) {
639 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGSVGElement.setCurrentTime");
640 0 : return false;
641 : }
642 0 : self->SetCurrentTime(arg0);
643 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
644 0 : args.rval().setUndefined();
645 0 : return true;
646 : }
647 :
648 : static const JSJitInfo setCurrentTime_methodinfo = {
649 : { (JSJitGetterOp)setCurrentTime },
650 : { prototypes::id::SVGSVGElement },
651 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
652 : JSJitInfo::Method,
653 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
654 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
655 : false, /* isInfallible. False in setters. */
656 : false, /* isMovable. Not relevant for setters. */
657 : false, /* isEliminatable. Not relevant for setters. */
658 : false, /* isAlwaysInSlot. Only relevant for getters. */
659 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
660 : false, /* isTypedMethod. Only relevant for methods. */
661 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
662 : };
663 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
664 : static_assert(0 < 1, "There is no slot for us");
665 :
666 : static bool
667 0 : deselectAll(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
668 : {
669 0 : self->DeselectAll();
670 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
671 0 : args.rval().setUndefined();
672 0 : return true;
673 : }
674 :
675 : static const JSJitInfo deselectAll_methodinfo = {
676 : { (JSJitGetterOp)deselectAll },
677 : { prototypes::id::SVGSVGElement },
678 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
679 : JSJitInfo::Method,
680 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
681 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
682 : true, /* isInfallible. False in setters. */
683 : false, /* isMovable. Not relevant for setters. */
684 : false, /* isEliminatable. Not relevant for setters. */
685 : false, /* isAlwaysInSlot. Only relevant for getters. */
686 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
687 : false, /* isTypedMethod. Only relevant for methods. */
688 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
689 : };
690 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
691 : static_assert(0 < 1, "There is no slot for us");
692 :
693 : static bool
694 0 : createSVGNumber(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
695 : {
696 0 : auto result(StrongOrRawPtr<mozilla::DOMSVGNumber>(self->CreateSVGNumber()));
697 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
698 : static_assert(!IsPointer<decltype(result)>::value,
699 : "NewObject implies that we need to keep the object alive with a strong reference.");
700 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
701 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
702 0 : return false;
703 : }
704 0 : return true;
705 : }
706 :
707 : static const JSJitInfo createSVGNumber_methodinfo = {
708 : { (JSJitGetterOp)createSVGNumber },
709 : { prototypes::id::SVGSVGElement },
710 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
711 : JSJitInfo::Method,
712 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
713 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
714 : false, /* isInfallible. False in setters. */
715 : false, /* isMovable. Not relevant for setters. */
716 : false, /* isEliminatable. Not relevant for setters. */
717 : false, /* isAlwaysInSlot. Only relevant for getters. */
718 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
719 : false, /* isTypedMethod. Only relevant for methods. */
720 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
721 : };
722 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
723 : static_assert(0 < 1, "There is no slot for us");
724 :
725 : static bool
726 0 : createSVGLength(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
727 : {
728 0 : auto result(StrongOrRawPtr<mozilla::DOMSVGLength>(self->CreateSVGLength()));
729 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
730 : static_assert(!IsPointer<decltype(result)>::value,
731 : "NewObject implies that we need to keep the object alive with a strong reference.");
732 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
733 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
734 0 : return false;
735 : }
736 0 : return true;
737 : }
738 :
739 : static const JSJitInfo createSVGLength_methodinfo = {
740 : { (JSJitGetterOp)createSVGLength },
741 : { prototypes::id::SVGSVGElement },
742 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
743 : JSJitInfo::Method,
744 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
745 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
746 : false, /* isInfallible. False in setters. */
747 : false, /* isMovable. Not relevant for setters. */
748 : false, /* isEliminatable. Not relevant for setters. */
749 : false, /* isAlwaysInSlot. Only relevant for getters. */
750 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
751 : false, /* isTypedMethod. Only relevant for methods. */
752 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
753 : };
754 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
755 : static_assert(0 < 1, "There is no slot for us");
756 :
757 : static bool
758 0 : createSVGAngle(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
759 : {
760 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAngle>(self->CreateSVGAngle()));
761 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
762 : static_assert(!IsPointer<decltype(result)>::value,
763 : "NewObject implies that we need to keep the object alive with a strong reference.");
764 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
765 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
766 0 : return false;
767 : }
768 0 : return true;
769 : }
770 :
771 : static const JSJitInfo createSVGAngle_methodinfo = {
772 : { (JSJitGetterOp)createSVGAngle },
773 : { prototypes::id::SVGSVGElement },
774 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
775 : JSJitInfo::Method,
776 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
777 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
778 : false, /* isInfallible. False in setters. */
779 : false, /* isMovable. Not relevant for setters. */
780 : false, /* isEliminatable. Not relevant for setters. */
781 : false, /* isAlwaysInSlot. Only relevant for getters. */
782 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
783 : false, /* isTypedMethod. Only relevant for methods. */
784 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
785 : };
786 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
787 : static_assert(0 < 1, "There is no slot for us");
788 :
789 : static bool
790 0 : createSVGPoint(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
791 : {
792 0 : auto result(StrongOrRawPtr<mozilla::nsISVGPoint>(self->CreateSVGPoint()));
793 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
794 : static_assert(!IsPointer<decltype(result)>::value,
795 : "NewObject implies that we need to keep the object alive with a strong reference.");
796 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
797 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
798 0 : return false;
799 : }
800 0 : return true;
801 : }
802 :
803 : static const JSJitInfo createSVGPoint_methodinfo = {
804 : { (JSJitGetterOp)createSVGPoint },
805 : { prototypes::id::SVGSVGElement },
806 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
807 : JSJitInfo::Method,
808 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
809 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
810 : false, /* isInfallible. False in setters. */
811 : false, /* isMovable. Not relevant for setters. */
812 : false, /* isEliminatable. Not relevant for setters. */
813 : false, /* isAlwaysInSlot. Only relevant for getters. */
814 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
815 : false, /* isTypedMethod. Only relevant for methods. */
816 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
817 : };
818 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
819 : static_assert(0 < 1, "There is no slot for us");
820 :
821 : static bool
822 0 : createSVGMatrix(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
823 : {
824 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGMatrix>(self->CreateSVGMatrix()));
825 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
826 : static_assert(!IsPointer<decltype(result)>::value,
827 : "NewObject implies that we need to keep the object alive with a strong reference.");
828 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
829 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
830 0 : return false;
831 : }
832 0 : return true;
833 : }
834 :
835 : static const JSJitInfo createSVGMatrix_methodinfo = {
836 : { (JSJitGetterOp)createSVGMatrix },
837 : { prototypes::id::SVGSVGElement },
838 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
839 : JSJitInfo::Method,
840 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
841 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
842 : false, /* isInfallible. False in setters. */
843 : false, /* isMovable. Not relevant for setters. */
844 : false, /* isEliminatable. Not relevant for setters. */
845 : false, /* isAlwaysInSlot. Only relevant for getters. */
846 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
847 : false, /* isTypedMethod. Only relevant for methods. */
848 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
849 : };
850 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
851 : static_assert(0 < 1, "There is no slot for us");
852 :
853 : static bool
854 0 : createSVGRect(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
855 : {
856 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGIRect>(self->CreateSVGRect()));
857 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
858 : static_assert(!IsPointer<decltype(result)>::value,
859 : "NewObject implies that we need to keep the object alive with a strong reference.");
860 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
861 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
862 0 : return false;
863 : }
864 0 : return true;
865 : }
866 :
867 : static const JSJitInfo createSVGRect_methodinfo = {
868 : { (JSJitGetterOp)createSVGRect },
869 : { prototypes::id::SVGSVGElement },
870 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
871 : JSJitInfo::Method,
872 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
873 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
874 : false, /* isInfallible. False in setters. */
875 : false, /* isMovable. Not relevant for setters. */
876 : false, /* isEliminatable. Not relevant for setters. */
877 : false, /* isAlwaysInSlot. Only relevant for getters. */
878 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
879 : false, /* isTypedMethod. Only relevant for methods. */
880 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
881 : };
882 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
883 : static_assert(0 < 1, "There is no slot for us");
884 :
885 : static bool
886 0 : createSVGTransform(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
887 : {
888 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGTransform>(self->CreateSVGTransform()));
889 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
890 : static_assert(!IsPointer<decltype(result)>::value,
891 : "NewObject implies that we need to keep the object alive with a strong reference.");
892 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
893 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
894 0 : return false;
895 : }
896 0 : return true;
897 : }
898 :
899 : static const JSJitInfo createSVGTransform_methodinfo = {
900 : { (JSJitGetterOp)createSVGTransform },
901 : { prototypes::id::SVGSVGElement },
902 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
903 : JSJitInfo::Method,
904 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
905 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
906 : false, /* isInfallible. False in setters. */
907 : false, /* isMovable. Not relevant for setters. */
908 : false, /* isEliminatable. Not relevant for setters. */
909 : false, /* isAlwaysInSlot. Only relevant for getters. */
910 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
911 : false, /* isTypedMethod. Only relevant for methods. */
912 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
913 : };
914 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
915 : static_assert(0 < 1, "There is no slot for us");
916 :
917 : static bool
918 0 : createSVGTransformFromMatrix(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
919 : {
920 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
921 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGSVGElement.createSVGTransformFromMatrix");
922 : }
923 0 : NonNull<mozilla::dom::SVGMatrix> arg0;
924 0 : if (args[0].isObject()) {
925 : {
926 0 : nsresult rv = UnwrapObject<prototypes::id::SVGMatrix, mozilla::dom::SVGMatrix>(args[0], arg0);
927 0 : if (NS_FAILED(rv)) {
928 0 : ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of SVGSVGElement.createSVGTransformFromMatrix", "SVGMatrix");
929 0 : return false;
930 : }
931 : }
932 : } else {
933 0 : ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of SVGSVGElement.createSVGTransformFromMatrix");
934 0 : return false;
935 : }
936 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGTransform>(self->CreateSVGTransformFromMatrix(NonNullHelper(arg0))));
937 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
938 : static_assert(!IsPointer<decltype(result)>::value,
939 : "NewObject implies that we need to keep the object alive with a strong reference.");
940 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
941 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
942 0 : return false;
943 : }
944 0 : return true;
945 : }
946 :
947 : static const JSJitInfo createSVGTransformFromMatrix_methodinfo = {
948 : { (JSJitGetterOp)createSVGTransformFromMatrix },
949 : { prototypes::id::SVGSVGElement },
950 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
951 : JSJitInfo::Method,
952 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
953 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
954 : false, /* isInfallible. False in setters. */
955 : false, /* isMovable. Not relevant for setters. */
956 : false, /* isEliminatable. Not relevant for setters. */
957 : false, /* isAlwaysInSlot. Only relevant for getters. */
958 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
959 : false, /* isTypedMethod. Only relevant for methods. */
960 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
961 : };
962 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
963 : static_assert(0 < 1, "There is no slot for us");
964 :
965 : static bool
966 0 : getElementById(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, const JSJitMethodCallArgs& args)
967 : {
968 0 : if (MOZ_UNLIKELY(args.length() < 1)) {
969 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGSVGElement.getElementById");
970 : }
971 0 : binding_detail::FakeString arg0;
972 0 : if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
973 0 : return false;
974 : }
975 0 : auto result(StrongOrRawPtr<mozilla::dom::Element>(self->GetElementById(NonNullHelper(Constify(arg0)))));
976 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
977 0 : SetDocumentAndPageUseCounter(cx, obj, eUseCounter_SVGSVGElement_getElementById);
978 0 : if (!result) {
979 0 : args.rval().setNull();
980 0 : return true;
981 : }
982 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
983 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
984 0 : return false;
985 : }
986 0 : return true;
987 : }
988 :
989 : static const JSJitInfo getElementById_methodinfo = {
990 : { (JSJitGetterOp)getElementById },
991 : { prototypes::id::SVGSVGElement },
992 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
993 : JSJitInfo::Method,
994 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
995 : JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */
996 : false, /* isInfallible. False in setters. */
997 : false, /* isMovable. Not relevant for setters. */
998 : false, /* isEliminatable. Not relevant for setters. */
999 : false, /* isAlwaysInSlot. Only relevant for getters. */
1000 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1001 : false, /* isTypedMethod. Only relevant for methods. */
1002 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1003 : };
1004 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1005 : static_assert(0 < 1, "There is no slot for us");
1006 :
1007 : static bool
1008 0 : get_viewBox(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
1009 : {
1010 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedRect>(self->ViewBox()));
1011 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1012 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
1013 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1014 0 : return false;
1015 : }
1016 0 : return true;
1017 : }
1018 :
1019 : static const JSJitInfo viewBox_getterinfo = {
1020 : { (JSJitGetterOp)get_viewBox },
1021 : { prototypes::id::SVGSVGElement },
1022 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
1023 : JSJitInfo::Getter,
1024 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
1025 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
1026 : false, /* isInfallible. False in setters. */
1027 : true, /* isMovable. Not relevant for setters. */
1028 : true, /* isEliminatable. Not relevant for setters. */
1029 : false, /* isAlwaysInSlot. Only relevant for getters. */
1030 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1031 : false, /* isTypedMethod. Only relevant for methods. */
1032 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1033 : };
1034 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1035 : static_assert(0 < 1, "There is no slot for us");
1036 :
1037 : static bool
1038 0 : get_preserveAspectRatio(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
1039 : {
1040 0 : auto result(StrongOrRawPtr<mozilla::dom::DOMSVGAnimatedPreserveAspectRatio>(self->PreserveAspectRatio()));
1041 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1042 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
1043 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
1044 0 : return false;
1045 : }
1046 0 : return true;
1047 : }
1048 :
1049 : static const JSJitInfo preserveAspectRatio_getterinfo = {
1050 : { (JSJitGetterOp)get_preserveAspectRatio },
1051 : { prototypes::id::SVGSVGElement },
1052 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
1053 : JSJitInfo::Getter,
1054 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
1055 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
1056 : false, /* isInfallible. False in setters. */
1057 : true, /* isMovable. Not relevant for setters. */
1058 : true, /* isEliminatable. Not relevant for setters. */
1059 : false, /* isAlwaysInSlot. Only relevant for getters. */
1060 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1061 : false, /* isTypedMethod. Only relevant for methods. */
1062 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1063 : };
1064 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1065 : static_assert(0 < 1, "There is no slot for us");
1066 :
1067 : static bool
1068 0 : get_zoomAndPan(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitGetterCallArgs args)
1069 : {
1070 0 : uint16_t result(self->ZoomAndPan());
1071 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1072 0 : args.rval().setInt32(int32_t(result));
1073 0 : return true;
1074 : }
1075 :
1076 : static bool
1077 0 : set_zoomAndPan(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGSVGElement* self, JSJitSetterCallArgs args)
1078 : {
1079 : uint16_t arg0;
1080 0 : if (!ValueToPrimitive<uint16_t, eDefault>(cx, args[0], &arg0)) {
1081 0 : return false;
1082 : }
1083 0 : binding_detail::FastErrorResult rv;
1084 0 : self->SetZoomAndPan(arg0, rv);
1085 0 : if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
1086 0 : return false;
1087 : }
1088 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
1089 :
1090 0 : return true;
1091 : }
1092 :
1093 : static const JSJitInfo zoomAndPan_getterinfo = {
1094 : { (JSJitGetterOp)get_zoomAndPan },
1095 : { prototypes::id::SVGSVGElement },
1096 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
1097 : JSJitInfo::Getter,
1098 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1099 : JSVAL_TYPE_INT32, /* returnType. Not relevant for setters. */
1100 : true, /* isInfallible. False in setters. */
1101 : false, /* isMovable. Not relevant for setters. */
1102 : false, /* isEliminatable. Not relevant for setters. */
1103 : false, /* isAlwaysInSlot. Only relevant for getters. */
1104 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1105 : false, /* isTypedMethod. Only relevant for methods. */
1106 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1107 : };
1108 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1109 : static_assert(0 < 1, "There is no slot for us");
1110 : static const JSJitInfo zoomAndPan_setterinfo = {
1111 : { (JSJitGetterOp)set_zoomAndPan },
1112 : { prototypes::id::SVGSVGElement },
1113 : { PrototypeTraits<prototypes::id::SVGSVGElement>::Depth },
1114 : JSJitInfo::Setter,
1115 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
1116 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
1117 : false, /* isInfallible. False in setters. */
1118 : false, /* isMovable. Not relevant for setters. */
1119 : false, /* isEliminatable. Not relevant for setters. */
1120 : false, /* isAlwaysInSlot. Only relevant for getters. */
1121 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
1122 : false, /* isTypedMethod. Only relevant for methods. */
1123 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
1124 : };
1125 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
1126 : static_assert(0 < 1, "There is no slot for us");
1127 :
1128 : static bool
1129 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
1130 : {
1131 0 : mozilla::dom::SVGSVGElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGSVGElement>(obj);
1132 : // We don't want to preserve if we don't have a wrapper, and we
1133 : // obviously can't preserve if we're not initialized.
1134 0 : if (self && self->GetWrapperPreserveColor()) {
1135 0 : PreserveWrapper(self);
1136 : }
1137 0 : return true;
1138 : }
1139 :
1140 : static void
1141 0 : _finalize(js::FreeOp* fop, JSObject* obj)
1142 : {
1143 0 : mozilla::dom::SVGSVGElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGSVGElement>(obj);
1144 0 : if (self) {
1145 0 : ClearWrapper(self, self, obj);
1146 0 : AddForDeferredFinalization<mozilla::dom::SVGSVGElement>(self);
1147 : }
1148 0 : }
1149 :
1150 : static void
1151 0 : _objectMoved(JSObject* obj, const JSObject* old)
1152 : {
1153 0 : mozilla::dom::SVGSVGElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGSVGElement>(obj);
1154 0 : if (self) {
1155 0 : UpdateWrapper(self, self, obj, old);
1156 : }
1157 0 : }
1158 :
1159 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1160 : #if defined(__clang__)
1161 : #pragma clang diagnostic push
1162 : #pragma clang diagnostic ignored "-Wmissing-braces"
1163 : #endif
1164 : static const JSFunctionSpec sMethods_specs[] = {
1165 : JS_FNSPEC("suspendRedraw", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&suspendRedraw_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1166 : JS_FNSPEC("unsuspendRedraw", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&unsuspendRedraw_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1167 : JS_FNSPEC("unsuspendRedrawAll", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&unsuspendRedrawAll_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1168 : JS_FNSPEC("forceRedraw", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&forceRedraw_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1169 : JS_FNSPEC("pauseAnimations", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&pauseAnimations_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1170 : JS_FNSPEC("unpauseAnimations", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&unpauseAnimations_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1171 : JS_FNSPEC("animationsPaused", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&animationsPaused_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1172 : JS_FNSPEC("getCurrentTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getCurrentTime_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1173 : JS_FNSPEC("setCurrentTime", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setCurrentTime_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1174 : JS_FNSPEC("deselectAll", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&deselectAll_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1175 : JS_FNSPEC("createSVGNumber", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createSVGNumber_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1176 : JS_FNSPEC("createSVGLength", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createSVGLength_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1177 : JS_FNSPEC("createSVGAngle", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createSVGAngle_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1178 : JS_FNSPEC("createSVGPoint", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createSVGPoint_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1179 : JS_FNSPEC("createSVGMatrix", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createSVGMatrix_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1180 : JS_FNSPEC("createSVGRect", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createSVGRect_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1181 : JS_FNSPEC("createSVGTransform", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createSVGTransform_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
1182 : JS_FNSPEC("createSVGTransformFromMatrix", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&createSVGTransformFromMatrix_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1183 : JS_FNSPEC("getElementById", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&getElementById_methodinfo), 1, JSPROP_ENUMERATE, nullptr),
1184 : JS_FS_END
1185 : };
1186 : #if defined(__clang__)
1187 : #pragma clang diagnostic pop
1188 : #endif
1189 :
1190 :
1191 : // Can't be const because the pref-enabled boolean needs to be writable
1192 : static Prefable<const JSFunctionSpec> sMethods[] = {
1193 : { nullptr, &sMethods_specs[0] },
1194 : { nullptr, nullptr }
1195 : };
1196 :
1197 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1198 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1199 : static_assert(19 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1200 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1201 :
1202 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1203 : #if defined(__clang__)
1204 : #pragma clang diagnostic push
1205 : #pragma clang diagnostic ignored "-Wmissing-braces"
1206 : #endif
1207 : static const JSPropertySpec sAttributes_specs[] = {
1208 : { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
1209 : { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
1210 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
1211 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
1212 : { "pixelUnitToMillimeterX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &pixelUnitToMillimeterX_getterinfo, nullptr, nullptr },
1213 : { "pixelUnitToMillimeterY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &pixelUnitToMillimeterY_getterinfo, nullptr, nullptr },
1214 : { "screenPixelToMillimeterX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &screenPixelToMillimeterX_getterinfo, nullptr, nullptr },
1215 : { "screenPixelToMillimeterY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &screenPixelToMillimeterY_getterinfo, nullptr, nullptr },
1216 : { "useCurrentView", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &useCurrentView_getterinfo, nullptr, nullptr },
1217 : { "currentScale", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, ¤tScale_getterinfo, GenericBindingSetter, ¤tScale_setterinfo },
1218 : { "currentTranslate", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, ¤tTranslate_getterinfo, nullptr, nullptr },
1219 : { "viewBox", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &viewBox_getterinfo, nullptr, nullptr },
1220 : { "preserveAspectRatio", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &preserveAspectRatio_getterinfo, nullptr, nullptr },
1221 : { "zoomAndPan", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &zoomAndPan_getterinfo, GenericBindingSetter, &zoomAndPan_setterinfo },
1222 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
1223 : };
1224 : #if defined(__clang__)
1225 : #pragma clang diagnostic pop
1226 : #endif
1227 :
1228 :
1229 : // Can't be const because the pref-enabled boolean needs to be writable
1230 : static Prefable<const JSPropertySpec> sAttributes[] = {
1231 : { nullptr, &sAttributes_specs[0] },
1232 : { nullptr, nullptr }
1233 : };
1234 :
1235 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1236 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1237 : static_assert(14 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1238 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1239 :
1240 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
1241 : #if defined(__clang__)
1242 : #pragma clang diagnostic push
1243 : #pragma clang diagnostic ignored "-Wmissing-braces"
1244 : #endif
1245 : static const ConstantSpec sConstants_specs[] = {
1246 : { "SVG_ZOOMANDPAN_UNKNOWN", JS::Int32Value(0) },
1247 : { "SVG_ZOOMANDPAN_DISABLE", JS::Int32Value(1) },
1248 : { "SVG_ZOOMANDPAN_MAGNIFY", JS::Int32Value(2) },
1249 : { 0, JS::UndefinedValue() }
1250 : };
1251 : #if defined(__clang__)
1252 : #pragma clang diagnostic pop
1253 : #endif
1254 :
1255 :
1256 : // Can't be const because the pref-enabled boolean needs to be writable
1257 : static Prefable<const ConstantSpec> sConstants[] = {
1258 : { nullptr, &sConstants_specs[0] },
1259 : { nullptr, nullptr }
1260 : };
1261 :
1262 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
1263 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
1264 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
1265 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
1266 :
1267 :
1268 : static uint16_t sNativeProperties_sortedPropertyIndices[36];
1269 : static PropertyInfo sNativeProperties_propertyInfos[36];
1270 :
1271 : static const NativePropertiesN<3> sNativeProperties = {
1272 : false, 0,
1273 : false, 0,
1274 : true, 0 /* sMethods */,
1275 : true, 1 /* sAttributes */,
1276 : false, 0,
1277 : false, 0,
1278 : true, 2 /* sConstants */,
1279 : -1,
1280 : 36,
1281 : sNativeProperties_sortedPropertyIndices,
1282 : {
1283 : { sMethods, &sNativeProperties_propertyInfos[0] },
1284 : { sAttributes, &sNativeProperties_propertyInfos[19] },
1285 : { sConstants, &sNativeProperties_propertyInfos[33] }
1286 : }
1287 : };
1288 : static_assert(36 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
1289 : "We have a property info count that is oversized");
1290 :
1291 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
1292 : {
1293 : "Function",
1294 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
1295 : &sBoringInterfaceObjectClassClassOps,
1296 : JS_NULL_CLASS_SPEC,
1297 : JS_NULL_CLASS_EXT,
1298 : &sInterfaceObjectClassObjectOps
1299 : },
1300 : eInterface,
1301 : true,
1302 : prototypes::id::SVGSVGElement,
1303 : PrototypeTraits<prototypes::id::SVGSVGElement>::Depth,
1304 : sNativePropertyHooks,
1305 : "function SVGSVGElement() {\n [native code]\n}",
1306 : SVGGraphicsElementBinding::GetConstructorObject
1307 : };
1308 :
1309 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
1310 : {
1311 : "SVGSVGElementPrototype",
1312 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
1313 : JS_NULL_CLASS_OPS,
1314 : JS_NULL_CLASS_SPEC,
1315 : JS_NULL_CLASS_EXT,
1316 : JS_NULL_OBJECT_OPS
1317 : },
1318 : eInterfacePrototype,
1319 : false,
1320 : prototypes::id::SVGSVGElement,
1321 : PrototypeTraits<prototypes::id::SVGSVGElement>::Depth,
1322 : sNativePropertyHooks,
1323 : "[object SVGSVGElementPrototype]",
1324 : SVGGraphicsElementBinding::GetProtoObject
1325 : };
1326 :
1327 : JSObject*
1328 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
1329 : {
1330 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
1331 : }
1332 :
1333 : static const js::ClassOps sClassOps = {
1334 : _addProperty, /* addProperty */
1335 : nullptr, /* delProperty */
1336 : nullptr, /* getProperty */
1337 : nullptr, /* setProperty */
1338 : nullptr, /* enumerate */
1339 : nullptr, /* newEnumerate */
1340 : nullptr, /* resolve */
1341 : nullptr, /* mayResolve */
1342 : _finalize, /* finalize */
1343 : nullptr, /* call */
1344 : nullptr, /* hasInstance */
1345 : nullptr, /* construct */
1346 : nullptr, /* trace */
1347 : };
1348 :
1349 : static const js::ClassExtension sClassExtension = {
1350 : nullptr, /* weakmapKeyDelegateOp */
1351 : _objectMoved /* objectMovedOp */
1352 : };
1353 :
1354 : static const DOMJSClass sClass = {
1355 : { "SVGSVGElement",
1356 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
1357 : &sClassOps,
1358 : JS_NULL_CLASS_SPEC,
1359 : &sClassExtension,
1360 : JS_NULL_OBJECT_OPS
1361 : },
1362 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGGraphicsElement, prototypes::id::SVGSVGElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
1363 : IsBaseOf<nsISupports, mozilla::dom::SVGSVGElement >::value,
1364 : sNativePropertyHooks,
1365 : FindAssociatedGlobalForNative<mozilla::dom::SVGSVGElement>::Get,
1366 : GetProtoObjectHandle,
1367 : GetCCParticipant<mozilla::dom::SVGSVGElement>::Get()
1368 : };
1369 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
1370 : "Must have the right minimal number of reserved slots.");
1371 : static_assert(1 >= 1,
1372 : "Must have enough reserved slots.");
1373 :
1374 : const JSClass*
1375 0 : GetJSClass()
1376 : {
1377 0 : return sClass.ToJSClass();
1378 : }
1379 :
1380 : bool
1381 0 : Wrap(JSContext* aCx, mozilla::dom::SVGSVGElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
1382 : {
1383 : MOZ_ASSERT(static_cast<mozilla::dom::SVGSVGElement*>(aObject) ==
1384 : reinterpret_cast<mozilla::dom::SVGSVGElement*>(aObject),
1385 : "Multiple inheritance for mozilla::dom::SVGSVGElement is broken.");
1386 : MOZ_ASSERT(static_cast<mozilla::dom::SVGGraphicsElement*>(aObject) ==
1387 : reinterpret_cast<mozilla::dom::SVGGraphicsElement*>(aObject),
1388 : "Multiple inheritance for mozilla::dom::SVGGraphicsElement is broken.");
1389 : MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
1390 : reinterpret_cast<nsSVGElement*>(aObject),
1391 : "Multiple inheritance for nsSVGElement is broken.");
1392 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
1393 : reinterpret_cast<mozilla::dom::Element*>(aObject),
1394 : "Multiple inheritance for mozilla::dom::Element is broken.");
1395 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
1396 : reinterpret_cast<nsINode*>(aObject),
1397 : "Multiple inheritance for nsINode is broken.");
1398 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
1399 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
1400 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
1401 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
1402 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
1403 0 : MOZ_ASSERT(!aCache->GetWrapper(),
1404 : "You should probably not be using Wrap() directly; use "
1405 : "GetOrCreateDOMReflector instead");
1406 :
1407 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
1408 : "nsISupports must be on our primary inheritance chain");
1409 :
1410 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
1411 0 : if (!global) {
1412 0 : return false;
1413 : }
1414 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
1415 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
1416 :
1417 : // That might have ended up wrapping us already, due to the wonders
1418 : // of XBL. Check for that, and bail out as needed.
1419 0 : aReflector.set(aCache->GetWrapper());
1420 0 : if (aReflector) {
1421 : #ifdef DEBUG
1422 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
1423 : #endif // DEBUG
1424 0 : return true;
1425 : }
1426 :
1427 0 : JSAutoCompartment ac(aCx, global);
1428 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
1429 0 : if (!canonicalProto) {
1430 0 : return false;
1431 : }
1432 0 : JS::Rooted<JSObject*> proto(aCx);
1433 0 : if (aGivenProto) {
1434 0 : proto = aGivenProto;
1435 : // Unfortunately, while aGivenProto was in the compartment of aCx
1436 : // coming in, we changed compartments to that of "parent" so may need
1437 : // to wrap the proto here.
1438 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
1439 0 : if (!JS_WrapObject(aCx, &proto)) {
1440 0 : return false;
1441 : }
1442 : }
1443 : } else {
1444 0 : proto = canonicalProto;
1445 : }
1446 :
1447 0 : BindingJSObjectCreator<mozilla::dom::SVGSVGElement> creator(aCx);
1448 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
1449 0 : if (!aReflector) {
1450 0 : return false;
1451 : }
1452 :
1453 0 : aCache->SetWrapper(aReflector);
1454 0 : creator.InitializationSucceeded();
1455 :
1456 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
1457 : aCache->GetWrapperPreserveColor() == aReflector);
1458 : // If proto != canonicalProto, we have to preserve our wrapper;
1459 : // otherwise we won't be able to properly recreate it later, since
1460 : // we won't know what proto to use. Note that we don't check
1461 : // aGivenProto here, since it's entirely possible (and even
1462 : // somewhat common) to have a non-null aGivenProto which is the
1463 : // same as canonicalProto.
1464 0 : if (proto != canonicalProto) {
1465 0 : PreserveWrapper(aObject);
1466 : }
1467 :
1468 0 : return true;
1469 : }
1470 :
1471 : const NativePropertyHooks sNativePropertyHooks[] = { {
1472 : nullptr,
1473 : nullptr,
1474 : nullptr,
1475 : { sNativeProperties.Upcast(), nullptr },
1476 : prototypes::id::SVGSVGElement,
1477 : constructors::id::SVGSVGElement,
1478 : SVGGraphicsElementBinding::sNativePropertyHooks,
1479 : &DefaultXrayExpandoObjectClass
1480 : } };
1481 :
1482 : void
1483 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
1484 : {
1485 0 : JS::Handle<JSObject*> parentProto(SVGGraphicsElementBinding::GetProtoObjectHandle(aCx));
1486 0 : if (!parentProto) {
1487 0 : return;
1488 : }
1489 :
1490 0 : JS::Handle<JSObject*> constructorProto(SVGGraphicsElementBinding::GetConstructorObjectHandle(aCx));
1491 0 : if (!constructorProto) {
1492 0 : return;
1493 : }
1494 :
1495 : static bool sIdsInited = false;
1496 0 : if (!sIdsInited && NS_IsMainThread()) {
1497 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
1498 0 : return;
1499 : }
1500 0 : sIdsInited = true;
1501 : }
1502 :
1503 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGSVGElement);
1504 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGSVGElement);
1505 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
1506 : &sPrototypeClass.mBase, protoCache,
1507 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
1508 : interfaceCache,
1509 : sNativeProperties.Upcast(),
1510 : nullptr,
1511 : "SVGSVGElement", aDefineOnGlobal,
1512 : nullptr,
1513 0 : false);
1514 : }
1515 :
1516 : JS::Handle<JSObject*>
1517 0 : GetProtoObjectHandle(JSContext* aCx)
1518 : {
1519 : /* Get the interface prototype object for this class. This will create the
1520 : object as needed. */
1521 0 : bool aDefineOnGlobal = true;
1522 :
1523 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1524 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1525 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1526 0 : return nullptr;
1527 : }
1528 :
1529 : /* Check to see whether the interface objects are already installed */
1530 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1531 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGSVGElement)) {
1532 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1533 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1534 : }
1535 :
1536 : /*
1537 : * The object might _still_ be null, but that's OK.
1538 : *
1539 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1540 : * traced by TraceProtoAndIfaceCache() and its contents are never
1541 : * changed after they have been set.
1542 : *
1543 : * Calling address() avoids the read read barrier that does gray
1544 : * unmarking, but it's not possible for the object to be gray here.
1545 : */
1546 :
1547 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGSVGElement);
1548 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1549 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1550 : }
1551 :
1552 : JS::Handle<JSObject*>
1553 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
1554 : {
1555 : /* Get the interface object for this class. This will create the object as
1556 : needed. */
1557 :
1558 : /* Make sure our global is sane. Hopefully we can remove this sometime */
1559 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
1560 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
1561 0 : return nullptr;
1562 : }
1563 :
1564 : /* Check to see whether the interface objects are already installed */
1565 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
1566 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGSVGElement)) {
1567 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
1568 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
1569 : }
1570 :
1571 : /*
1572 : * The object might _still_ be null, but that's OK.
1573 : *
1574 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
1575 : * traced by TraceProtoAndIfaceCache() and its contents are never
1576 : * changed after they have been set.
1577 : *
1578 : * Calling address() avoids the read read barrier that does gray
1579 : * unmarking, but it's not possible for the object to be gray here.
1580 : */
1581 :
1582 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGSVGElement);
1583 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
1584 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
1585 : }
1586 :
1587 : JSObject*
1588 0 : GetConstructorObject(JSContext* aCx)
1589 : {
1590 0 : return GetConstructorObjectHandle(aCx);
1591 : }
1592 :
1593 : } // namespace SVGSVGElementBinding
1594 :
1595 :
1596 :
1597 : } // namespace dom
1598 : } // namespace mozilla
|