Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGFESpecularLightingElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGElementBinding.h"
4 : #include "SVGFESpecularLightingElementBinding.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/SVGFESpecularLightingElement.h"
14 : #include "mozilla/dom/XrayExpandoClass.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : namespace SVGFESpecularLightingElementBinding {
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::SVGFESpecularLightingElement* 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::SVGFESpecularLightingElement },
39 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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::SVGFESpecularLightingElement* 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::SVGFESpecularLightingElement },
69 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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_specularConstant(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
86 : {
87 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->SpecularConstant()));
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 specularConstant_getterinfo = {
97 : { (JSJitGetterOp)get_specularConstant },
98 : { prototypes::id::SVGFESpecularLightingElement },
99 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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_specularExponent(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
116 : {
117 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->SpecularExponent()));
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 specularExponent_getterinfo = {
127 : { (JSJitGetterOp)get_specularExponent },
128 : { prototypes::id::SVGFESpecularLightingElement },
129 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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_kernelUnitLengthX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
146 : {
147 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->KernelUnitLengthX()));
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 kernelUnitLengthX_getterinfo = {
157 : { (JSJitGetterOp)get_kernelUnitLengthX },
158 : { prototypes::id::SVGFESpecularLightingElement },
159 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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_kernelUnitLengthY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
176 : {
177 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->KernelUnitLengthY()));
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 kernelUnitLengthY_getterinfo = {
187 : { (JSJitGetterOp)get_kernelUnitLengthY },
188 : { prototypes::id::SVGFESpecularLightingElement },
189 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
206 : {
207 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
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 x_getterinfo = {
217 : { (JSJitGetterOp)get_x },
218 : { prototypes::id::SVGFESpecularLightingElement },
219 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
236 : {
237 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
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 y_getterinfo = {
247 : { (JSJitGetterOp)get_y },
248 : { prototypes::id::SVGFESpecularLightingElement },
249 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
266 : {
267 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
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 width_getterinfo = {
277 : { (JSJitGetterOp)get_width },
278 : { prototypes::id::SVGFESpecularLightingElement },
279 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
296 : {
297 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
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 height_getterinfo = {
307 : { (JSJitGetterOp)get_height },
308 : { prototypes::id::SVGFESpecularLightingElement },
309 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::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 : get_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFESpecularLightingElement* self, JSJitGetterCallArgs args)
326 : {
327 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
328 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
329 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
330 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
331 0 : return false;
332 : }
333 0 : return true;
334 : }
335 :
336 : static const JSJitInfo result_getterinfo = {
337 : { (JSJitGetterOp)get_result },
338 : { prototypes::id::SVGFESpecularLightingElement },
339 : { PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::Depth },
340 : JSJitInfo::Getter,
341 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
342 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
343 : false, /* isInfallible. False in setters. */
344 : true, /* isMovable. Not relevant for setters. */
345 : true, /* isEliminatable. Not relevant for setters. */
346 : false, /* isAlwaysInSlot. Only relevant for getters. */
347 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
348 : false, /* isTypedMethod. Only relevant for methods. */
349 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
350 : };
351 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
352 : static_assert(0 < 1, "There is no slot for us");
353 :
354 : static bool
355 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
356 : {
357 0 : mozilla::dom::SVGFESpecularLightingElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFESpecularLightingElement>(obj);
358 : // We don't want to preserve if we don't have a wrapper, and we
359 : // obviously can't preserve if we're not initialized.
360 0 : if (self && self->GetWrapperPreserveColor()) {
361 0 : PreserveWrapper(self);
362 : }
363 0 : return true;
364 : }
365 :
366 : static void
367 0 : _finalize(js::FreeOp* fop, JSObject* obj)
368 : {
369 0 : mozilla::dom::SVGFESpecularLightingElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFESpecularLightingElement>(obj);
370 0 : if (self) {
371 0 : ClearWrapper(self, self, obj);
372 0 : AddForDeferredFinalization<mozilla::dom::SVGFESpecularLightingElement>(self);
373 : }
374 0 : }
375 :
376 : static void
377 0 : _objectMoved(JSObject* obj, const JSObject* old)
378 : {
379 0 : mozilla::dom::SVGFESpecularLightingElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFESpecularLightingElement>(obj);
380 0 : if (self) {
381 0 : UpdateWrapper(self, self, obj, old);
382 : }
383 0 : }
384 :
385 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
386 : #if defined(__clang__)
387 : #pragma clang diagnostic push
388 : #pragma clang diagnostic ignored "-Wmissing-braces"
389 : #endif
390 : static const JSPropertySpec sAttributes_specs[] = {
391 : { "in1", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &in1_getterinfo, nullptr, nullptr },
392 : { "surfaceScale", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &surfaceScale_getterinfo, nullptr, nullptr },
393 : { "specularConstant", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &specularConstant_getterinfo, nullptr, nullptr },
394 : { "specularExponent", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &specularExponent_getterinfo, nullptr, nullptr },
395 : { "kernelUnitLengthX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &kernelUnitLengthX_getterinfo, nullptr, nullptr },
396 : { "kernelUnitLengthY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &kernelUnitLengthY_getterinfo, nullptr, nullptr },
397 : { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
398 : { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
399 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
400 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
401 : { "result", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &result_getterinfo, nullptr, nullptr },
402 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
403 : };
404 : #if defined(__clang__)
405 : #pragma clang diagnostic pop
406 : #endif
407 :
408 :
409 : // Can't be const because the pref-enabled boolean needs to be writable
410 : static Prefable<const JSPropertySpec> sAttributes[] = {
411 : { nullptr, &sAttributes_specs[0] },
412 : { nullptr, nullptr }
413 : };
414 :
415 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
416 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
417 : static_assert(11 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
418 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
419 :
420 :
421 : static uint16_t sNativeProperties_sortedPropertyIndices[11];
422 : static PropertyInfo sNativeProperties_propertyInfos[11];
423 :
424 : static const NativePropertiesN<1> sNativeProperties = {
425 : false, 0,
426 : false, 0,
427 : false, 0,
428 : true, 0 /* sAttributes */,
429 : false, 0,
430 : false, 0,
431 : false, 0,
432 : -1,
433 : 11,
434 : sNativeProperties_sortedPropertyIndices,
435 : {
436 : { sAttributes, &sNativeProperties_propertyInfos[0] }
437 : }
438 : };
439 : static_assert(11 < 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::SVGFESpecularLightingElement,
454 : PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::Depth,
455 : sNativePropertyHooks,
456 : "function SVGFESpecularLightingElement() {\n [native code]\n}",
457 : SVGElementBinding::GetConstructorObject
458 : };
459 :
460 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
461 : {
462 : "SVGFESpecularLightingElementPrototype",
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::SVGFESpecularLightingElement,
472 : PrototypeTraits<prototypes::id::SVGFESpecularLightingElement>::Depth,
473 : sNativePropertyHooks,
474 : "[object SVGFESpecularLightingElementPrototype]",
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 : { "SVGFESpecularLightingElement",
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::SVGFESpecularLightingElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
514 : IsBaseOf<nsISupports, mozilla::dom::SVGFESpecularLightingElement >::value,
515 : sNativePropertyHooks,
516 : FindAssociatedGlobalForNative<mozilla::dom::SVGFESpecularLightingElement>::Get,
517 : GetProtoObjectHandle,
518 : GetCCParticipant<mozilla::dom::SVGFESpecularLightingElement>::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::SVGFESpecularLightingElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
533 : {
534 : MOZ_ASSERT(static_cast<mozilla::dom::SVGFESpecularLightingElement*>(aObject) ==
535 : reinterpret_cast<mozilla::dom::SVGFESpecularLightingElement*>(aObject),
536 : "Multiple inheritance for mozilla::dom::SVGFESpecularLightingElement 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::SVGFESpecularLightingElement> 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::SVGFESpecularLightingElement,
625 : constructors::id::SVGFESpecularLightingElement,
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::SVGFESpecularLightingElement);
652 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFESpecularLightingElement);
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 : "SVGFESpecularLightingElement", 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::SVGFESpecularLightingElement)) {
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::SVGFESpecularLightingElement);
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::SVGFESpecularLightingElement)) {
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::SVGFESpecularLightingElement);
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 SVGFESpecularLightingElementBinding
742 :
743 :
744 :
745 : } // namespace dom
746 : } // namespace mozilla
|