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