Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGFEDiffuseLightingElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGElementBinding.h"
4 : #include "SVGFEDiffuseLightingElementBinding.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/SVGAnimatedLength.h"
11 : #include "mozilla/dom/SVGAnimatedNumber.h"
12 : #include "mozilla/dom/SVGAnimatedString.h"
13 : #include "mozilla/dom/SVGFEDiffuseLightingElement.h"
14 : #include "mozilla/dom/XrayExpandoClass.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : namespace SVGFEDiffuseLightingElementBinding {
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::SVGFEDiffuseLightingElement* 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::SVGFEDiffuseLightingElement },
39 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::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_surfaceScale(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
56 : {
57 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->SurfaceScale()));
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 surfaceScale_getterinfo = {
67 : { (JSJitGetterOp)get_surfaceScale },
68 : { prototypes::id::SVGFEDiffuseLightingElement },
69 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::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_diffuseConstant(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
86 : {
87 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->DiffuseConstant()));
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 diffuseConstant_getterinfo = {
97 : { (JSJitGetterOp)get_diffuseConstant },
98 : { prototypes::id::SVGFEDiffuseLightingElement },
99 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::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_kernelUnitLengthX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
116 : {
117 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->KernelUnitLengthX()));
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 kernelUnitLengthX_getterinfo = {
127 : { (JSJitGetterOp)get_kernelUnitLengthX },
128 : { prototypes::id::SVGFEDiffuseLightingElement },
129 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::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_kernelUnitLengthY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
146 : {
147 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->KernelUnitLengthY()));
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 kernelUnitLengthY_getterinfo = {
157 : { (JSJitGetterOp)get_kernelUnitLengthY },
158 : { prototypes::id::SVGFEDiffuseLightingElement },
159 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::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_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
176 : {
177 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
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 x_getterinfo = {
187 : { (JSJitGetterOp)get_x },
188 : { prototypes::id::SVGFEDiffuseLightingElement },
189 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::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_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
206 : {
207 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
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 y_getterinfo = {
217 : { (JSJitGetterOp)get_y },
218 : { prototypes::id::SVGFEDiffuseLightingElement },
219 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::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_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
236 : {
237 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
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 width_getterinfo = {
247 : { (JSJitGetterOp)get_width },
248 : { prototypes::id::SVGFEDiffuseLightingElement },
249 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::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 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
266 : {
267 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
268 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
269 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
270 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
271 0 : return false;
272 : }
273 0 : return true;
274 : }
275 :
276 : static const JSJitInfo height_getterinfo = {
277 : { (JSJitGetterOp)get_height },
278 : { prototypes::id::SVGFEDiffuseLightingElement },
279 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::Depth },
280 : JSJitInfo::Getter,
281 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
282 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
283 : false, /* isInfallible. False in setters. */
284 : true, /* isMovable. Not relevant for setters. */
285 : true, /* isEliminatable. Not relevant for setters. */
286 : false, /* isAlwaysInSlot. Only relevant for getters. */
287 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
288 : false, /* isTypedMethod. Only relevant for methods. */
289 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
290 : };
291 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
292 : static_assert(0 < 1, "There is no slot for us");
293 :
294 : static bool
295 0 : get_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDiffuseLightingElement* self, JSJitGetterCallArgs args)
296 : {
297 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
298 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
299 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
300 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
301 0 : return false;
302 : }
303 0 : return true;
304 : }
305 :
306 : static const JSJitInfo result_getterinfo = {
307 : { (JSJitGetterOp)get_result },
308 : { prototypes::id::SVGFEDiffuseLightingElement },
309 : { PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::Depth },
310 : JSJitInfo::Getter,
311 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
312 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
313 : false, /* isInfallible. False in setters. */
314 : true, /* isMovable. Not relevant for setters. */
315 : true, /* isEliminatable. Not relevant for setters. */
316 : false, /* isAlwaysInSlot. Only relevant for getters. */
317 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
318 : false, /* isTypedMethod. Only relevant for methods. */
319 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
320 : };
321 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
322 : static_assert(0 < 1, "There is no slot for us");
323 :
324 : static bool
325 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
326 : {
327 0 : mozilla::dom::SVGFEDiffuseLightingElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDiffuseLightingElement>(obj);
328 : // We don't want to preserve if we don't have a wrapper, and we
329 : // obviously can't preserve if we're not initialized.
330 0 : if (self && self->GetWrapperPreserveColor()) {
331 0 : PreserveWrapper(self);
332 : }
333 0 : return true;
334 : }
335 :
336 : static void
337 0 : _finalize(js::FreeOp* fop, JSObject* obj)
338 : {
339 0 : mozilla::dom::SVGFEDiffuseLightingElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDiffuseLightingElement>(obj);
340 0 : if (self) {
341 0 : ClearWrapper(self, self, obj);
342 0 : AddForDeferredFinalization<mozilla::dom::SVGFEDiffuseLightingElement>(self);
343 : }
344 0 : }
345 :
346 : static void
347 0 : _objectMoved(JSObject* obj, const JSObject* old)
348 : {
349 0 : mozilla::dom::SVGFEDiffuseLightingElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDiffuseLightingElement>(obj);
350 0 : if (self) {
351 0 : UpdateWrapper(self, self, obj, old);
352 : }
353 0 : }
354 :
355 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
356 : #if defined(__clang__)
357 : #pragma clang diagnostic push
358 : #pragma clang diagnostic ignored "-Wmissing-braces"
359 : #endif
360 : static const JSPropertySpec sAttributes_specs[] = {
361 : { "in1", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &in1_getterinfo, nullptr, nullptr },
362 : { "surfaceScale", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &surfaceScale_getterinfo, nullptr, nullptr },
363 : { "diffuseConstant", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &diffuseConstant_getterinfo, nullptr, nullptr },
364 : { "kernelUnitLengthX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &kernelUnitLengthX_getterinfo, nullptr, nullptr },
365 : { "kernelUnitLengthY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &kernelUnitLengthY_getterinfo, nullptr, nullptr },
366 : { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
367 : { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
368 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
369 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
370 : { "result", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &result_getterinfo, nullptr, nullptr },
371 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
372 : };
373 : #if defined(__clang__)
374 : #pragma clang diagnostic pop
375 : #endif
376 :
377 :
378 : // Can't be const because the pref-enabled boolean needs to be writable
379 : static Prefable<const JSPropertySpec> sAttributes[] = {
380 : { nullptr, &sAttributes_specs[0] },
381 : { nullptr, nullptr }
382 : };
383 :
384 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
385 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
386 : static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
387 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
388 :
389 :
390 : static uint16_t sNativeProperties_sortedPropertyIndices[10];
391 : static PropertyInfo sNativeProperties_propertyInfos[10];
392 :
393 : static const NativePropertiesN<1> sNativeProperties = {
394 : false, 0,
395 : false, 0,
396 : false, 0,
397 : true, 0 /* sAttributes */,
398 : false, 0,
399 : false, 0,
400 : false, 0,
401 : -1,
402 : 10,
403 : sNativeProperties_sortedPropertyIndices,
404 : {
405 : { sAttributes, &sNativeProperties_propertyInfos[0] }
406 : }
407 : };
408 : static_assert(10 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
409 : "We have a property info count that is oversized");
410 :
411 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
412 : {
413 : "Function",
414 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
415 : &sBoringInterfaceObjectClassClassOps,
416 : JS_NULL_CLASS_SPEC,
417 : JS_NULL_CLASS_EXT,
418 : &sInterfaceObjectClassObjectOps
419 : },
420 : eInterface,
421 : true,
422 : prototypes::id::SVGFEDiffuseLightingElement,
423 : PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::Depth,
424 : sNativePropertyHooks,
425 : "function SVGFEDiffuseLightingElement() {\n [native code]\n}",
426 : SVGElementBinding::GetConstructorObject
427 : };
428 :
429 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
430 : {
431 : "SVGFEDiffuseLightingElementPrototype",
432 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
433 : JS_NULL_CLASS_OPS,
434 : JS_NULL_CLASS_SPEC,
435 : JS_NULL_CLASS_EXT,
436 : JS_NULL_OBJECT_OPS
437 : },
438 : eInterfacePrototype,
439 : false,
440 : prototypes::id::SVGFEDiffuseLightingElement,
441 : PrototypeTraits<prototypes::id::SVGFEDiffuseLightingElement>::Depth,
442 : sNativePropertyHooks,
443 : "[object SVGFEDiffuseLightingElementPrototype]",
444 : SVGElementBinding::GetProtoObject
445 : };
446 :
447 : JSObject*
448 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
449 : {
450 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
451 : }
452 :
453 : static const js::ClassOps sClassOps = {
454 : _addProperty, /* addProperty */
455 : nullptr, /* delProperty */
456 : nullptr, /* getProperty */
457 : nullptr, /* setProperty */
458 : nullptr, /* enumerate */
459 : nullptr, /* newEnumerate */
460 : nullptr, /* resolve */
461 : nullptr, /* mayResolve */
462 : _finalize, /* finalize */
463 : nullptr, /* call */
464 : nullptr, /* hasInstance */
465 : nullptr, /* construct */
466 : nullptr, /* trace */
467 : };
468 :
469 : static const js::ClassExtension sClassExtension = {
470 : nullptr, /* weakmapKeyDelegateOp */
471 : _objectMoved /* objectMovedOp */
472 : };
473 :
474 : static const DOMJSClass sClass = {
475 : { "SVGFEDiffuseLightingElement",
476 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
477 : &sClassOps,
478 : JS_NULL_CLASS_SPEC,
479 : &sClassExtension,
480 : JS_NULL_OBJECT_OPS
481 : },
482 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFEDiffuseLightingElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
483 : IsBaseOf<nsISupports, mozilla::dom::SVGFEDiffuseLightingElement >::value,
484 : sNativePropertyHooks,
485 : FindAssociatedGlobalForNative<mozilla::dom::SVGFEDiffuseLightingElement>::Get,
486 : GetProtoObjectHandle,
487 : GetCCParticipant<mozilla::dom::SVGFEDiffuseLightingElement>::Get()
488 : };
489 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
490 : "Must have the right minimal number of reserved slots.");
491 : static_assert(1 >= 1,
492 : "Must have enough reserved slots.");
493 :
494 : const JSClass*
495 0 : GetJSClass()
496 : {
497 0 : return sClass.ToJSClass();
498 : }
499 :
500 : bool
501 0 : Wrap(JSContext* aCx, mozilla::dom::SVGFEDiffuseLightingElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
502 : {
503 : MOZ_ASSERT(static_cast<mozilla::dom::SVGFEDiffuseLightingElement*>(aObject) ==
504 : reinterpret_cast<mozilla::dom::SVGFEDiffuseLightingElement*>(aObject),
505 : "Multiple inheritance for mozilla::dom::SVGFEDiffuseLightingElement is broken.");
506 : MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
507 : reinterpret_cast<nsSVGElement*>(aObject),
508 : "Multiple inheritance for nsSVGElement is broken.");
509 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
510 : reinterpret_cast<mozilla::dom::Element*>(aObject),
511 : "Multiple inheritance for mozilla::dom::Element is broken.");
512 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
513 : reinterpret_cast<nsINode*>(aObject),
514 : "Multiple inheritance for nsINode is broken.");
515 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
516 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
517 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
518 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
519 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
520 0 : MOZ_ASSERT(!aCache->GetWrapper(),
521 : "You should probably not be using Wrap() directly; use "
522 : "GetOrCreateDOMReflector instead");
523 :
524 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
525 : "nsISupports must be on our primary inheritance chain");
526 :
527 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
528 0 : if (!global) {
529 0 : return false;
530 : }
531 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
532 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
533 :
534 : // That might have ended up wrapping us already, due to the wonders
535 : // of XBL. Check for that, and bail out as needed.
536 0 : aReflector.set(aCache->GetWrapper());
537 0 : if (aReflector) {
538 : #ifdef DEBUG
539 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
540 : #endif // DEBUG
541 0 : return true;
542 : }
543 :
544 0 : JSAutoCompartment ac(aCx, global);
545 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
546 0 : if (!canonicalProto) {
547 0 : return false;
548 : }
549 0 : JS::Rooted<JSObject*> proto(aCx);
550 0 : if (aGivenProto) {
551 0 : proto = aGivenProto;
552 : // Unfortunately, while aGivenProto was in the compartment of aCx
553 : // coming in, we changed compartments to that of "parent" so may need
554 : // to wrap the proto here.
555 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
556 0 : if (!JS_WrapObject(aCx, &proto)) {
557 0 : return false;
558 : }
559 : }
560 : } else {
561 0 : proto = canonicalProto;
562 : }
563 :
564 0 : BindingJSObjectCreator<mozilla::dom::SVGFEDiffuseLightingElement> creator(aCx);
565 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
566 0 : if (!aReflector) {
567 0 : return false;
568 : }
569 :
570 0 : aCache->SetWrapper(aReflector);
571 0 : creator.InitializationSucceeded();
572 :
573 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
574 : aCache->GetWrapperPreserveColor() == aReflector);
575 : // If proto != canonicalProto, we have to preserve our wrapper;
576 : // otherwise we won't be able to properly recreate it later, since
577 : // we won't know what proto to use. Note that we don't check
578 : // aGivenProto here, since it's entirely possible (and even
579 : // somewhat common) to have a non-null aGivenProto which is the
580 : // same as canonicalProto.
581 0 : if (proto != canonicalProto) {
582 0 : PreserveWrapper(aObject);
583 : }
584 :
585 0 : return true;
586 : }
587 :
588 : const NativePropertyHooks sNativePropertyHooks[] = { {
589 : nullptr,
590 : nullptr,
591 : nullptr,
592 : { sNativeProperties.Upcast(), nullptr },
593 : prototypes::id::SVGFEDiffuseLightingElement,
594 : constructors::id::SVGFEDiffuseLightingElement,
595 : SVGElementBinding::sNativePropertyHooks,
596 : &DefaultXrayExpandoObjectClass
597 : } };
598 :
599 : void
600 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
601 : {
602 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
603 0 : if (!parentProto) {
604 0 : return;
605 : }
606 :
607 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
608 0 : if (!constructorProto) {
609 0 : return;
610 : }
611 :
612 : static bool sIdsInited = false;
613 0 : if (!sIdsInited && NS_IsMainThread()) {
614 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
615 0 : return;
616 : }
617 0 : sIdsInited = true;
618 : }
619 :
620 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEDiffuseLightingElement);
621 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEDiffuseLightingElement);
622 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
623 : &sPrototypeClass.mBase, protoCache,
624 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
625 : interfaceCache,
626 : sNativeProperties.Upcast(),
627 : nullptr,
628 : "SVGFEDiffuseLightingElement", aDefineOnGlobal,
629 : nullptr,
630 0 : false);
631 : }
632 :
633 : JS::Handle<JSObject*>
634 0 : GetProtoObjectHandle(JSContext* aCx)
635 : {
636 : /* Get the interface prototype object for this class. This will create the
637 : object as needed. */
638 0 : bool aDefineOnGlobal = true;
639 :
640 : /* Make sure our global is sane. Hopefully we can remove this sometime */
641 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
642 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
643 0 : return nullptr;
644 : }
645 :
646 : /* Check to see whether the interface objects are already installed */
647 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
648 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGFEDiffuseLightingElement)) {
649 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
650 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
651 : }
652 :
653 : /*
654 : * The object might _still_ be null, but that's OK.
655 : *
656 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
657 : * traced by TraceProtoAndIfaceCache() and its contents are never
658 : * changed after they have been set.
659 : *
660 : * Calling address() avoids the read read barrier that does gray
661 : * unmarking, but it's not possible for the object to be gray here.
662 : */
663 :
664 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGFEDiffuseLightingElement);
665 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
666 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
667 : }
668 :
669 : JS::Handle<JSObject*>
670 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
671 : {
672 : /* Get the interface object for this class. This will create the object as
673 : needed. */
674 :
675 : /* Make sure our global is sane. Hopefully we can remove this sometime */
676 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
677 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
678 0 : return nullptr;
679 : }
680 :
681 : /* Check to see whether the interface objects are already installed */
682 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
683 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGFEDiffuseLightingElement)) {
684 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
685 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
686 : }
687 :
688 : /*
689 : * The object might _still_ be null, but that's OK.
690 : *
691 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
692 : * traced by TraceProtoAndIfaceCache() and its contents are never
693 : * changed after they have been set.
694 : *
695 : * Calling address() avoids the read read barrier that does gray
696 : * unmarking, but it's not possible for the object to be gray here.
697 : */
698 :
699 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGFEDiffuseLightingElement);
700 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
701 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
702 : }
703 :
704 : JSObject*
705 0 : GetConstructorObject(JSContext* aCx)
706 : {
707 0 : return GetConstructorObjectHandle(aCx);
708 : }
709 :
710 : } // namespace SVGFEDiffuseLightingElementBinding
711 :
712 :
713 :
714 : } // namespace dom
715 : } // namespace mozilla
|