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