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