Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGFETurbulenceElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGElementBinding.h"
4 : #include "SVGFETurbulenceElementBinding.h"
5 : #include "WrapperFactory.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/SVGAnimatedEnumeration.h"
11 : #include "mozilla/dom/SVGAnimatedInteger.h"
12 : #include "mozilla/dom/SVGAnimatedLength.h"
13 : #include "mozilla/dom/SVGAnimatedNumber.h"
14 : #include "mozilla/dom/SVGAnimatedString.h"
15 : #include "mozilla/dom/SVGFETurbulenceElement.h"
16 : #include "mozilla/dom/XrayExpandoClass.h"
17 :
18 : namespace mozilla {
19 : namespace dom {
20 :
21 : namespace SVGFETurbulenceElementBinding {
22 :
23 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElementBinding::NativeType>::value,
24 : "Can't inherit from an interface with a different ownership model.");
25 :
26 : static bool
27 0 : get_baseFrequencyX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
28 : {
29 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->BaseFrequencyX()));
30 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
31 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
32 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
33 0 : return false;
34 : }
35 0 : return true;
36 : }
37 :
38 : static const JSJitInfo baseFrequencyX_getterinfo = {
39 : { (JSJitGetterOp)get_baseFrequencyX },
40 : { prototypes::id::SVGFETurbulenceElement },
41 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
42 : JSJitInfo::Getter,
43 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
44 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
45 : false, /* isInfallible. False in setters. */
46 : true, /* isMovable. Not relevant for setters. */
47 : true, /* isEliminatable. Not relevant for setters. */
48 : false, /* isAlwaysInSlot. Only relevant for getters. */
49 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
50 : false, /* isTypedMethod. Only relevant for methods. */
51 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
52 : };
53 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
54 : static_assert(0 < 1, "There is no slot for us");
55 :
56 : static bool
57 0 : get_baseFrequencyY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
58 : {
59 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->BaseFrequencyY()));
60 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
61 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
62 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
63 0 : return false;
64 : }
65 0 : return true;
66 : }
67 :
68 : static const JSJitInfo baseFrequencyY_getterinfo = {
69 : { (JSJitGetterOp)get_baseFrequencyY },
70 : { prototypes::id::SVGFETurbulenceElement },
71 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
72 : JSJitInfo::Getter,
73 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
74 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
75 : false, /* isInfallible. False in setters. */
76 : true, /* isMovable. Not relevant for setters. */
77 : true, /* isEliminatable. Not relevant for setters. */
78 : false, /* isAlwaysInSlot. Only relevant for getters. */
79 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
80 : false, /* isTypedMethod. Only relevant for methods. */
81 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
82 : };
83 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
84 : static_assert(0 < 1, "There is no slot for us");
85 :
86 : static bool
87 0 : get_numOctaves(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
88 : {
89 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedInteger>(self->NumOctaves()));
90 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
91 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
92 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
93 0 : return false;
94 : }
95 0 : return true;
96 : }
97 :
98 : static const JSJitInfo numOctaves_getterinfo = {
99 : { (JSJitGetterOp)get_numOctaves },
100 : { prototypes::id::SVGFETurbulenceElement },
101 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
102 : JSJitInfo::Getter,
103 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
104 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
105 : false, /* isInfallible. False in setters. */
106 : true, /* isMovable. Not relevant for setters. */
107 : true, /* isEliminatable. Not relevant for setters. */
108 : false, /* isAlwaysInSlot. Only relevant for getters. */
109 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
110 : false, /* isTypedMethod. Only relevant for methods. */
111 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
112 : };
113 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
114 : static_assert(0 < 1, "There is no slot for us");
115 :
116 : static bool
117 0 : get_seed(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
118 : {
119 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Seed()));
120 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
121 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
122 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
123 0 : return false;
124 : }
125 0 : return true;
126 : }
127 :
128 : static const JSJitInfo seed_getterinfo = {
129 : { (JSJitGetterOp)get_seed },
130 : { prototypes::id::SVGFETurbulenceElement },
131 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
132 : JSJitInfo::Getter,
133 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
134 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
135 : false, /* isInfallible. False in setters. */
136 : true, /* isMovable. Not relevant for setters. */
137 : true, /* isEliminatable. Not relevant for setters. */
138 : false, /* isAlwaysInSlot. Only relevant for getters. */
139 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
140 : false, /* isTypedMethod. Only relevant for methods. */
141 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
142 : };
143 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
144 : static_assert(0 < 1, "There is no slot for us");
145 :
146 : static bool
147 0 : get_stitchTiles(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
148 : {
149 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->StitchTiles()));
150 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
151 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
152 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
153 0 : return false;
154 : }
155 0 : return true;
156 : }
157 :
158 : static const JSJitInfo stitchTiles_getterinfo = {
159 : { (JSJitGetterOp)get_stitchTiles },
160 : { prototypes::id::SVGFETurbulenceElement },
161 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
162 : JSJitInfo::Getter,
163 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
164 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
165 : false, /* isInfallible. False in setters. */
166 : true, /* isMovable. Not relevant for setters. */
167 : true, /* isEliminatable. Not relevant for setters. */
168 : false, /* isAlwaysInSlot. Only relevant for getters. */
169 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
170 : false, /* isTypedMethod. Only relevant for methods. */
171 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
172 : };
173 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
174 : static_assert(0 < 1, "There is no slot for us");
175 :
176 : static bool
177 0 : get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
178 : {
179 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->Type()));
180 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
181 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
182 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
183 0 : return false;
184 : }
185 0 : return true;
186 : }
187 :
188 : static const JSJitInfo type_getterinfo = {
189 : { (JSJitGetterOp)get_type },
190 : { prototypes::id::SVGFETurbulenceElement },
191 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
192 : JSJitInfo::Getter,
193 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
194 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
195 : false, /* isInfallible. False in setters. */
196 : true, /* isMovable. Not relevant for setters. */
197 : true, /* isEliminatable. Not relevant for setters. */
198 : false, /* isAlwaysInSlot. Only relevant for getters. */
199 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
200 : false, /* isTypedMethod. Only relevant for methods. */
201 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
202 : };
203 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
204 : static_assert(0 < 1, "There is no slot for us");
205 :
206 : static bool
207 0 : get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
208 : {
209 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
210 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
211 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
212 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
213 0 : return false;
214 : }
215 0 : return true;
216 : }
217 :
218 : static const JSJitInfo x_getterinfo = {
219 : { (JSJitGetterOp)get_x },
220 : { prototypes::id::SVGFETurbulenceElement },
221 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
222 : JSJitInfo::Getter,
223 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
224 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
225 : false, /* isInfallible. False in setters. */
226 : true, /* isMovable. Not relevant for setters. */
227 : true, /* isEliminatable. Not relevant for setters. */
228 : false, /* isAlwaysInSlot. Only relevant for getters. */
229 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
230 : false, /* isTypedMethod. Only relevant for methods. */
231 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
232 : };
233 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
234 : static_assert(0 < 1, "There is no slot for us");
235 :
236 : static bool
237 0 : get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
238 : {
239 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
240 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
241 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
242 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
243 0 : return false;
244 : }
245 0 : return true;
246 : }
247 :
248 : static const JSJitInfo y_getterinfo = {
249 : { (JSJitGetterOp)get_y },
250 : { prototypes::id::SVGFETurbulenceElement },
251 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
252 : JSJitInfo::Getter,
253 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
254 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
255 : false, /* isInfallible. False in setters. */
256 : true, /* isMovable. Not relevant for setters. */
257 : true, /* isEliminatable. Not relevant for setters. */
258 : false, /* isAlwaysInSlot. Only relevant for getters. */
259 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
260 : false, /* isTypedMethod. Only relevant for methods. */
261 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
262 : };
263 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
264 : static_assert(0 < 1, "There is no slot for us");
265 :
266 : static bool
267 0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
268 : {
269 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
270 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
271 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
272 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
273 0 : return false;
274 : }
275 0 : return true;
276 : }
277 :
278 : static const JSJitInfo width_getterinfo = {
279 : { (JSJitGetterOp)get_width },
280 : { prototypes::id::SVGFETurbulenceElement },
281 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
282 : JSJitInfo::Getter,
283 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
284 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
285 : false, /* isInfallible. False in setters. */
286 : true, /* isMovable. Not relevant for setters. */
287 : true, /* isEliminatable. Not relevant for setters. */
288 : false, /* isAlwaysInSlot. Only relevant for getters. */
289 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
290 : false, /* isTypedMethod. Only relevant for methods. */
291 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
292 : };
293 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
294 : static_assert(0 < 1, "There is no slot for us");
295 :
296 : static bool
297 0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
298 : {
299 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
300 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
301 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
302 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
303 0 : return false;
304 : }
305 0 : return true;
306 : }
307 :
308 : static const JSJitInfo height_getterinfo = {
309 : { (JSJitGetterOp)get_height },
310 : { prototypes::id::SVGFETurbulenceElement },
311 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
312 : JSJitInfo::Getter,
313 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
314 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
315 : false, /* isInfallible. False in setters. */
316 : true, /* isMovable. Not relevant for setters. */
317 : true, /* isEliminatable. Not relevant for setters. */
318 : false, /* isAlwaysInSlot. Only relevant for getters. */
319 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
320 : false, /* isTypedMethod. Only relevant for methods. */
321 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
322 : };
323 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
324 : static_assert(0 < 1, "There is no slot for us");
325 :
326 : static bool
327 0 : get_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFETurbulenceElement* self, JSJitGetterCallArgs args)
328 : {
329 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
330 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
331 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
332 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
333 0 : return false;
334 : }
335 0 : return true;
336 : }
337 :
338 : static const JSJitInfo result_getterinfo = {
339 : { (JSJitGetterOp)get_result },
340 : { prototypes::id::SVGFETurbulenceElement },
341 : { PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth },
342 : JSJitInfo::Getter,
343 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
344 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
345 : false, /* isInfallible. False in setters. */
346 : true, /* isMovable. Not relevant for setters. */
347 : true, /* isEliminatable. Not relevant for setters. */
348 : false, /* isAlwaysInSlot. Only relevant for getters. */
349 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
350 : false, /* isTypedMethod. Only relevant for methods. */
351 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
352 : };
353 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
354 : static_assert(0 < 1, "There is no slot for us");
355 :
356 : static bool
357 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
358 : {
359 0 : mozilla::dom::SVGFETurbulenceElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFETurbulenceElement>(obj);
360 : // We don't want to preserve if we don't have a wrapper, and we
361 : // obviously can't preserve if we're not initialized.
362 0 : if (self && self->GetWrapperPreserveColor()) {
363 0 : PreserveWrapper(self);
364 : }
365 0 : return true;
366 : }
367 :
368 : static void
369 0 : _finalize(js::FreeOp* fop, JSObject* obj)
370 : {
371 0 : mozilla::dom::SVGFETurbulenceElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFETurbulenceElement>(obj);
372 0 : if (self) {
373 0 : ClearWrapper(self, self, obj);
374 0 : AddForDeferredFinalization<mozilla::dom::SVGFETurbulenceElement>(self);
375 : }
376 0 : }
377 :
378 : static void
379 0 : _objectMoved(JSObject* obj, const JSObject* old)
380 : {
381 0 : mozilla::dom::SVGFETurbulenceElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFETurbulenceElement>(obj);
382 0 : if (self) {
383 0 : UpdateWrapper(self, self, obj, old);
384 : }
385 0 : }
386 :
387 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
388 : #if defined(__clang__)
389 : #pragma clang diagnostic push
390 : #pragma clang diagnostic ignored "-Wmissing-braces"
391 : #endif
392 : static const JSPropertySpec sAttributes_specs[] = {
393 : { "baseFrequencyX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &baseFrequencyX_getterinfo, nullptr, nullptr },
394 : { "baseFrequencyY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &baseFrequencyY_getterinfo, nullptr, nullptr },
395 : { "numOctaves", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &numOctaves_getterinfo, nullptr, nullptr },
396 : { "seed", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &seed_getterinfo, nullptr, nullptr },
397 : { "stitchTiles", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &stitchTiles_getterinfo, nullptr, nullptr },
398 : { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, nullptr, nullptr },
399 : { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
400 : { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
401 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
402 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
403 : { "result", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &result_getterinfo, nullptr, nullptr },
404 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
405 : };
406 : #if defined(__clang__)
407 : #pragma clang diagnostic pop
408 : #endif
409 :
410 :
411 : // Can't be const because the pref-enabled boolean needs to be writable
412 : static Prefable<const JSPropertySpec> sAttributes[] = {
413 : { nullptr, &sAttributes_specs[0] },
414 : { nullptr, nullptr }
415 : };
416 :
417 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
418 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
419 : static_assert(11 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
420 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
421 :
422 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
423 : #if defined(__clang__)
424 : #pragma clang diagnostic push
425 : #pragma clang diagnostic ignored "-Wmissing-braces"
426 : #endif
427 : static const ConstantSpec sConstants_specs[] = {
428 : { "SVG_TURBULENCE_TYPE_UNKNOWN", JS::Int32Value(0) },
429 : { "SVG_TURBULENCE_TYPE_FRACTALNOISE", JS::Int32Value(1) },
430 : { "SVG_TURBULENCE_TYPE_TURBULENCE", JS::Int32Value(2) },
431 : { "SVG_STITCHTYPE_UNKNOWN", JS::Int32Value(0) },
432 : { "SVG_STITCHTYPE_STITCH", JS::Int32Value(1) },
433 : { "SVG_STITCHTYPE_NOSTITCH", JS::Int32Value(2) },
434 : { 0, JS::UndefinedValue() }
435 : };
436 : #if defined(__clang__)
437 : #pragma clang diagnostic pop
438 : #endif
439 :
440 :
441 : // Can't be const because the pref-enabled boolean needs to be writable
442 : static Prefable<const ConstantSpec> sConstants[] = {
443 : { nullptr, &sConstants_specs[0] },
444 : { nullptr, nullptr }
445 : };
446 :
447 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
448 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
449 : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
450 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
451 :
452 :
453 : static uint16_t sNativeProperties_sortedPropertyIndices[17];
454 : static PropertyInfo sNativeProperties_propertyInfos[17];
455 :
456 : static const NativePropertiesN<2> sNativeProperties = {
457 : false, 0,
458 : false, 0,
459 : false, 0,
460 : true, 0 /* sAttributes */,
461 : false, 0,
462 : false, 0,
463 : true, 1 /* sConstants */,
464 : -1,
465 : 17,
466 : sNativeProperties_sortedPropertyIndices,
467 : {
468 : { sAttributes, &sNativeProperties_propertyInfos[0] },
469 : { sConstants, &sNativeProperties_propertyInfos[11] }
470 : }
471 : };
472 : static_assert(17 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
473 : "We have a property info count that is oversized");
474 :
475 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
476 : {
477 : "Function",
478 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
479 : &sBoringInterfaceObjectClassClassOps,
480 : JS_NULL_CLASS_SPEC,
481 : JS_NULL_CLASS_EXT,
482 : &sInterfaceObjectClassObjectOps
483 : },
484 : eInterface,
485 : true,
486 : prototypes::id::SVGFETurbulenceElement,
487 : PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth,
488 : sNativePropertyHooks,
489 : "function SVGFETurbulenceElement() {\n [native code]\n}",
490 : SVGElementBinding::GetConstructorObject
491 : };
492 :
493 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
494 : {
495 : "SVGFETurbulenceElementPrototype",
496 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
497 : JS_NULL_CLASS_OPS,
498 : JS_NULL_CLASS_SPEC,
499 : JS_NULL_CLASS_EXT,
500 : JS_NULL_OBJECT_OPS
501 : },
502 : eInterfacePrototype,
503 : false,
504 : prototypes::id::SVGFETurbulenceElement,
505 : PrototypeTraits<prototypes::id::SVGFETurbulenceElement>::Depth,
506 : sNativePropertyHooks,
507 : "[object SVGFETurbulenceElementPrototype]",
508 : SVGElementBinding::GetProtoObject
509 : };
510 :
511 : JSObject*
512 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
513 : {
514 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
515 : }
516 :
517 : static const js::ClassOps sClassOps = {
518 : _addProperty, /* addProperty */
519 : nullptr, /* delProperty */
520 : nullptr, /* getProperty */
521 : nullptr, /* setProperty */
522 : nullptr, /* enumerate */
523 : nullptr, /* newEnumerate */
524 : nullptr, /* resolve */
525 : nullptr, /* mayResolve */
526 : _finalize, /* finalize */
527 : nullptr, /* call */
528 : nullptr, /* hasInstance */
529 : nullptr, /* construct */
530 : nullptr, /* trace */
531 : };
532 :
533 : static const js::ClassExtension sClassExtension = {
534 : nullptr, /* weakmapKeyDelegateOp */
535 : _objectMoved /* objectMovedOp */
536 : };
537 :
538 : static const DOMJSClass sClass = {
539 : { "SVGFETurbulenceElement",
540 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
541 : &sClassOps,
542 : JS_NULL_CLASS_SPEC,
543 : &sClassExtension,
544 : JS_NULL_OBJECT_OPS
545 : },
546 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFETurbulenceElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
547 : IsBaseOf<nsISupports, mozilla::dom::SVGFETurbulenceElement >::value,
548 : sNativePropertyHooks,
549 : FindAssociatedGlobalForNative<mozilla::dom::SVGFETurbulenceElement>::Get,
550 : GetProtoObjectHandle,
551 : GetCCParticipant<mozilla::dom::SVGFETurbulenceElement>::Get()
552 : };
553 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
554 : "Must have the right minimal number of reserved slots.");
555 : static_assert(1 >= 1,
556 : "Must have enough reserved slots.");
557 :
558 : const JSClass*
559 0 : GetJSClass()
560 : {
561 0 : return sClass.ToJSClass();
562 : }
563 :
564 : bool
565 0 : Wrap(JSContext* aCx, mozilla::dom::SVGFETurbulenceElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
566 : {
567 : MOZ_ASSERT(static_cast<mozilla::dom::SVGFETurbulenceElement*>(aObject) ==
568 : reinterpret_cast<mozilla::dom::SVGFETurbulenceElement*>(aObject),
569 : "Multiple inheritance for mozilla::dom::SVGFETurbulenceElement is broken.");
570 : MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
571 : reinterpret_cast<nsSVGElement*>(aObject),
572 : "Multiple inheritance for nsSVGElement is broken.");
573 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
574 : reinterpret_cast<mozilla::dom::Element*>(aObject),
575 : "Multiple inheritance for mozilla::dom::Element is broken.");
576 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
577 : reinterpret_cast<nsINode*>(aObject),
578 : "Multiple inheritance for nsINode is broken.");
579 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
580 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
581 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
582 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
583 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
584 0 : MOZ_ASSERT(!aCache->GetWrapper(),
585 : "You should probably not be using Wrap() directly; use "
586 : "GetOrCreateDOMReflector instead");
587 :
588 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
589 : "nsISupports must be on our primary inheritance chain");
590 :
591 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
592 0 : if (!global) {
593 0 : return false;
594 : }
595 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
596 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
597 :
598 : // That might have ended up wrapping us already, due to the wonders
599 : // of XBL. Check for that, and bail out as needed.
600 0 : aReflector.set(aCache->GetWrapper());
601 0 : if (aReflector) {
602 : #ifdef DEBUG
603 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
604 : #endif // DEBUG
605 0 : return true;
606 : }
607 :
608 0 : JSAutoCompartment ac(aCx, global);
609 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
610 0 : if (!canonicalProto) {
611 0 : return false;
612 : }
613 0 : JS::Rooted<JSObject*> proto(aCx);
614 0 : if (aGivenProto) {
615 0 : proto = aGivenProto;
616 : // Unfortunately, while aGivenProto was in the compartment of aCx
617 : // coming in, we changed compartments to that of "parent" so may need
618 : // to wrap the proto here.
619 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
620 0 : if (!JS_WrapObject(aCx, &proto)) {
621 0 : return false;
622 : }
623 : }
624 : } else {
625 0 : proto = canonicalProto;
626 : }
627 :
628 0 : BindingJSObjectCreator<mozilla::dom::SVGFETurbulenceElement> creator(aCx);
629 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
630 0 : if (!aReflector) {
631 0 : return false;
632 : }
633 :
634 0 : aCache->SetWrapper(aReflector);
635 0 : creator.InitializationSucceeded();
636 :
637 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
638 : aCache->GetWrapperPreserveColor() == aReflector);
639 : // If proto != canonicalProto, we have to preserve our wrapper;
640 : // otherwise we won't be able to properly recreate it later, since
641 : // we won't know what proto to use. Note that we don't check
642 : // aGivenProto here, since it's entirely possible (and even
643 : // somewhat common) to have a non-null aGivenProto which is the
644 : // same as canonicalProto.
645 0 : if (proto != canonicalProto) {
646 0 : PreserveWrapper(aObject);
647 : }
648 :
649 0 : return true;
650 : }
651 :
652 : const NativePropertyHooks sNativePropertyHooks[] = { {
653 : nullptr,
654 : nullptr,
655 : nullptr,
656 : { sNativeProperties.Upcast(), nullptr },
657 : prototypes::id::SVGFETurbulenceElement,
658 : constructors::id::SVGFETurbulenceElement,
659 : SVGElementBinding::sNativePropertyHooks,
660 : &DefaultXrayExpandoObjectClass
661 : } };
662 :
663 : void
664 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
665 : {
666 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
667 0 : if (!parentProto) {
668 0 : return;
669 : }
670 :
671 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
672 0 : if (!constructorProto) {
673 0 : return;
674 : }
675 :
676 : static bool sIdsInited = false;
677 0 : if (!sIdsInited && NS_IsMainThread()) {
678 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
679 0 : return;
680 : }
681 0 : sIdsInited = true;
682 : }
683 :
684 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFETurbulenceElement);
685 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFETurbulenceElement);
686 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
687 : &sPrototypeClass.mBase, protoCache,
688 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
689 : interfaceCache,
690 : sNativeProperties.Upcast(),
691 : nullptr,
692 : "SVGFETurbulenceElement", aDefineOnGlobal,
693 : nullptr,
694 0 : false);
695 : }
696 :
697 : JS::Handle<JSObject*>
698 0 : GetProtoObjectHandle(JSContext* aCx)
699 : {
700 : /* Get the interface prototype object for this class. This will create the
701 : object as needed. */
702 0 : bool aDefineOnGlobal = true;
703 :
704 : /* Make sure our global is sane. Hopefully we can remove this sometime */
705 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
706 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
707 0 : return nullptr;
708 : }
709 :
710 : /* Check to see whether the interface objects are already installed */
711 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
712 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGFETurbulenceElement)) {
713 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
714 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
715 : }
716 :
717 : /*
718 : * The object might _still_ be null, but that's OK.
719 : *
720 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
721 : * traced by TraceProtoAndIfaceCache() and its contents are never
722 : * changed after they have been set.
723 : *
724 : * Calling address() avoids the read read barrier that does gray
725 : * unmarking, but it's not possible for the object to be gray here.
726 : */
727 :
728 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGFETurbulenceElement);
729 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
730 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
731 : }
732 :
733 : JS::Handle<JSObject*>
734 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
735 : {
736 : /* Get the interface object for this class. This will create the object as
737 : needed. */
738 :
739 : /* Make sure our global is sane. Hopefully we can remove this sometime */
740 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
741 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
742 0 : return nullptr;
743 : }
744 :
745 : /* Check to see whether the interface objects are already installed */
746 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
747 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGFETurbulenceElement)) {
748 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
749 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
750 : }
751 :
752 : /*
753 : * The object might _still_ be null, but that's OK.
754 : *
755 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
756 : * traced by TraceProtoAndIfaceCache() and its contents are never
757 : * changed after they have been set.
758 : *
759 : * Calling address() avoids the read read barrier that does gray
760 : * unmarking, but it's not possible for the object to be gray here.
761 : */
762 :
763 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGFETurbulenceElement);
764 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
765 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
766 : }
767 :
768 : JSObject*
769 0 : GetConstructorObject(JSContext* aCx)
770 : {
771 0 : return GetConstructorObjectHandle(aCx);
772 : }
773 :
774 : } // namespace SVGFETurbulenceElementBinding
775 :
776 :
777 :
778 : } // namespace dom
779 : } // namespace mozilla
|