Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGFEGaussianBlurElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGElementBinding.h"
4 : #include "SVGFEGaussianBlurElementBinding.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/SVGFEGaussianBlurElement.h"
16 : #include "mozilla/dom/XrayExpandoClass.h"
17 :
18 : namespace mozilla {
19 : namespace dom {
20 :
21 : namespace SVGFEGaussianBlurElementBinding {
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::SVGFEGaussianBlurElement* 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::SVGFEGaussianBlurElement },
41 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::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_stdDeviationX(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEGaussianBlurElement* self, JSJitGetterCallArgs args)
58 : {
59 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->StdDeviationX()));
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 stdDeviationX_getterinfo = {
69 : { (JSJitGetterOp)get_stdDeviationX },
70 : { prototypes::id::SVGFEGaussianBlurElement },
71 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::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_stdDeviationY(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEGaussianBlurElement* self, JSJitGetterCallArgs args)
88 : {
89 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->StdDeviationY()));
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 stdDeviationY_getterinfo = {
99 : { (JSJitGetterOp)get_stdDeviationY },
100 : { prototypes::id::SVGFEGaussianBlurElement },
101 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::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 : setStdDeviation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEGaussianBlurElement* self, const JSJitMethodCallArgs& args)
118 : {
119 0 : if (MOZ_UNLIKELY(args.length() < 2)) {
120 0 : return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "SVGFEGaussianBlurElement.setStdDeviation");
121 : }
122 : float arg0;
123 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[0], &arg0)) {
124 0 : return false;
125 0 : } else if (!mozilla::IsFinite(arg0)) {
126 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 1 of SVGFEGaussianBlurElement.setStdDeviation");
127 0 : return false;
128 : }
129 : float arg1;
130 0 : if (!ValueToPrimitive<float, eDefault>(cx, args[1], &arg1)) {
131 0 : return false;
132 0 : } else if (!mozilla::IsFinite(arg1)) {
133 0 : ThrowErrorMessage(cx, MSG_NOT_FINITE, "Argument 2 of SVGFEGaussianBlurElement.setStdDeviation");
134 0 : return false;
135 : }
136 0 : self->SetStdDeviation(arg0, arg1);
137 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
138 0 : args.rval().setUndefined();
139 0 : return true;
140 : }
141 :
142 : static const JSJitInfo setStdDeviation_methodinfo = {
143 : { (JSJitGetterOp)setStdDeviation },
144 : { prototypes::id::SVGFEGaussianBlurElement },
145 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::Depth },
146 : JSJitInfo::Method,
147 : JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
148 : JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
149 : false, /* isInfallible. False in setters. */
150 : false, /* isMovable. Not relevant for setters. */
151 : false, /* isEliminatable. Not relevant for setters. */
152 : false, /* isAlwaysInSlot. Only relevant for getters. */
153 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
154 : false, /* isTypedMethod. Only relevant for methods. */
155 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
156 : };
157 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
158 : static_assert(0 < 1, "There is no slot for us");
159 :
160 : static bool
161 0 : get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEGaussianBlurElement* self, JSJitGetterCallArgs args)
162 : {
163 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
164 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
165 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
166 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
167 0 : return false;
168 : }
169 0 : return true;
170 : }
171 :
172 : static const JSJitInfo x_getterinfo = {
173 : { (JSJitGetterOp)get_x },
174 : { prototypes::id::SVGFEGaussianBlurElement },
175 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::Depth },
176 : JSJitInfo::Getter,
177 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
178 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
179 : false, /* isInfallible. False in setters. */
180 : true, /* isMovable. Not relevant for setters. */
181 : true, /* isEliminatable. Not relevant for setters. */
182 : false, /* isAlwaysInSlot. Only relevant for getters. */
183 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
184 : false, /* isTypedMethod. Only relevant for methods. */
185 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
186 : };
187 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
188 : static_assert(0 < 1, "There is no slot for us");
189 :
190 : static bool
191 0 : get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEGaussianBlurElement* self, JSJitGetterCallArgs args)
192 : {
193 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
194 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
195 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
196 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
197 0 : return false;
198 : }
199 0 : return true;
200 : }
201 :
202 : static const JSJitInfo y_getterinfo = {
203 : { (JSJitGetterOp)get_y },
204 : { prototypes::id::SVGFEGaussianBlurElement },
205 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::Depth },
206 : JSJitInfo::Getter,
207 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
208 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
209 : false, /* isInfallible. False in setters. */
210 : true, /* isMovable. Not relevant for setters. */
211 : true, /* 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_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEGaussianBlurElement* self, JSJitGetterCallArgs args)
222 : {
223 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
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 width_getterinfo = {
233 : { (JSJitGetterOp)get_width },
234 : { prototypes::id::SVGFEGaussianBlurElement },
235 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::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_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEGaussianBlurElement* self, JSJitGetterCallArgs args)
252 : {
253 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
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 height_getterinfo = {
263 : { (JSJitGetterOp)get_height },
264 : { prototypes::id::SVGFEGaussianBlurElement },
265 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::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_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEGaussianBlurElement* self, JSJitGetterCallArgs args)
282 : {
283 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
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 result_getterinfo = {
293 : { (JSJitGetterOp)get_result },
294 : { prototypes::id::SVGFEGaussianBlurElement },
295 : { PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::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 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
312 : {
313 0 : mozilla::dom::SVGFEGaussianBlurElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEGaussianBlurElement>(obj);
314 : // We don't want to preserve if we don't have a wrapper, and we
315 : // obviously can't preserve if we're not initialized.
316 0 : if (self && self->GetWrapperPreserveColor()) {
317 0 : PreserveWrapper(self);
318 : }
319 0 : return true;
320 : }
321 :
322 : static void
323 0 : _finalize(js::FreeOp* fop, JSObject* obj)
324 : {
325 0 : mozilla::dom::SVGFEGaussianBlurElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEGaussianBlurElement>(obj);
326 0 : if (self) {
327 0 : ClearWrapper(self, self, obj);
328 0 : AddForDeferredFinalization<mozilla::dom::SVGFEGaussianBlurElement>(self);
329 : }
330 0 : }
331 :
332 : static void
333 0 : _objectMoved(JSObject* obj, const JSObject* old)
334 : {
335 0 : mozilla::dom::SVGFEGaussianBlurElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEGaussianBlurElement>(obj);
336 0 : if (self) {
337 0 : UpdateWrapper(self, self, obj, old);
338 : }
339 0 : }
340 :
341 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
342 : #if defined(__clang__)
343 : #pragma clang diagnostic push
344 : #pragma clang diagnostic ignored "-Wmissing-braces"
345 : #endif
346 : static const JSFunctionSpec sMethods_specs[] = {
347 : JS_FNSPEC("setStdDeviation", GenericBindingMethod, reinterpret_cast<const JSJitInfo*>(&setStdDeviation_methodinfo), 2, JSPROP_ENUMERATE, nullptr),
348 : JS_FS_END
349 : };
350 : #if defined(__clang__)
351 : #pragma clang diagnostic pop
352 : #endif
353 :
354 :
355 : // Can't be const because the pref-enabled boolean needs to be writable
356 : static Prefable<const JSFunctionSpec> sMethods[] = {
357 : { nullptr, &sMethods_specs[0] },
358 : { nullptr, nullptr }
359 : };
360 :
361 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
362 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
363 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
364 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
365 :
366 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
367 : #if defined(__clang__)
368 : #pragma clang diagnostic push
369 : #pragma clang diagnostic ignored "-Wmissing-braces"
370 : #endif
371 : static const JSPropertySpec sAttributes_specs[] = {
372 : { "in1", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &in1_getterinfo, nullptr, nullptr },
373 : { "stdDeviationX", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &stdDeviationX_getterinfo, nullptr, nullptr },
374 : { "stdDeviationY", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &stdDeviationY_getterinfo, nullptr, nullptr },
375 : { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
376 : { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
377 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
378 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
379 : { "result", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &result_getterinfo, nullptr, nullptr },
380 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
381 : };
382 : #if defined(__clang__)
383 : #pragma clang diagnostic pop
384 : #endif
385 :
386 :
387 : // Can't be const because the pref-enabled boolean needs to be writable
388 : static Prefable<const JSPropertySpec> sAttributes[] = {
389 : { nullptr, &sAttributes_specs[0] },
390 : { nullptr, nullptr }
391 : };
392 :
393 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
394 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
395 : static_assert(8 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
396 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
397 :
398 :
399 : static uint16_t sNativeProperties_sortedPropertyIndices[9];
400 : static PropertyInfo sNativeProperties_propertyInfos[9];
401 :
402 : static const NativePropertiesN<2> sNativeProperties = {
403 : false, 0,
404 : false, 0,
405 : true, 0 /* sMethods */,
406 : true, 1 /* sAttributes */,
407 : false, 0,
408 : false, 0,
409 : false, 0,
410 : -1,
411 : 9,
412 : sNativeProperties_sortedPropertyIndices,
413 : {
414 : { sMethods, &sNativeProperties_propertyInfos[0] },
415 : { sAttributes, &sNativeProperties_propertyInfos[1] }
416 : }
417 : };
418 : static_assert(9 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
419 : "We have a property info count that is oversized");
420 :
421 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
422 : {
423 : "Function",
424 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
425 : &sBoringInterfaceObjectClassClassOps,
426 : JS_NULL_CLASS_SPEC,
427 : JS_NULL_CLASS_EXT,
428 : &sInterfaceObjectClassObjectOps
429 : },
430 : eInterface,
431 : true,
432 : prototypes::id::SVGFEGaussianBlurElement,
433 : PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::Depth,
434 : sNativePropertyHooks,
435 : "function SVGFEGaussianBlurElement() {\n [native code]\n}",
436 : SVGElementBinding::GetConstructorObject
437 : };
438 :
439 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
440 : {
441 : "SVGFEGaussianBlurElementPrototype",
442 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
443 : JS_NULL_CLASS_OPS,
444 : JS_NULL_CLASS_SPEC,
445 : JS_NULL_CLASS_EXT,
446 : JS_NULL_OBJECT_OPS
447 : },
448 : eInterfacePrototype,
449 : false,
450 : prototypes::id::SVGFEGaussianBlurElement,
451 : PrototypeTraits<prototypes::id::SVGFEGaussianBlurElement>::Depth,
452 : sNativePropertyHooks,
453 : "[object SVGFEGaussianBlurElementPrototype]",
454 : SVGElementBinding::GetProtoObject
455 : };
456 :
457 : JSObject*
458 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
459 : {
460 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
461 : }
462 :
463 : static const js::ClassOps sClassOps = {
464 : _addProperty, /* addProperty */
465 : nullptr, /* delProperty */
466 : nullptr, /* getProperty */
467 : nullptr, /* setProperty */
468 : nullptr, /* enumerate */
469 : nullptr, /* newEnumerate */
470 : nullptr, /* resolve */
471 : nullptr, /* mayResolve */
472 : _finalize, /* finalize */
473 : nullptr, /* call */
474 : nullptr, /* hasInstance */
475 : nullptr, /* construct */
476 : nullptr, /* trace */
477 : };
478 :
479 : static const js::ClassExtension sClassExtension = {
480 : nullptr, /* weakmapKeyDelegateOp */
481 : _objectMoved /* objectMovedOp */
482 : };
483 :
484 : static const DOMJSClass sClass = {
485 : { "SVGFEGaussianBlurElement",
486 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
487 : &sClassOps,
488 : JS_NULL_CLASS_SPEC,
489 : &sClassExtension,
490 : JS_NULL_OBJECT_OPS
491 : },
492 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFEGaussianBlurElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
493 : IsBaseOf<nsISupports, mozilla::dom::SVGFEGaussianBlurElement >::value,
494 : sNativePropertyHooks,
495 : FindAssociatedGlobalForNative<mozilla::dom::SVGFEGaussianBlurElement>::Get,
496 : GetProtoObjectHandle,
497 : GetCCParticipant<mozilla::dom::SVGFEGaussianBlurElement>::Get()
498 : };
499 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
500 : "Must have the right minimal number of reserved slots.");
501 : static_assert(1 >= 1,
502 : "Must have enough reserved slots.");
503 :
504 : const JSClass*
505 0 : GetJSClass()
506 : {
507 0 : return sClass.ToJSClass();
508 : }
509 :
510 : bool
511 0 : Wrap(JSContext* aCx, mozilla::dom::SVGFEGaussianBlurElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
512 : {
513 : MOZ_ASSERT(static_cast<mozilla::dom::SVGFEGaussianBlurElement*>(aObject) ==
514 : reinterpret_cast<mozilla::dom::SVGFEGaussianBlurElement*>(aObject),
515 : "Multiple inheritance for mozilla::dom::SVGFEGaussianBlurElement is broken.");
516 : MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
517 : reinterpret_cast<nsSVGElement*>(aObject),
518 : "Multiple inheritance for nsSVGElement is broken.");
519 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
520 : reinterpret_cast<mozilla::dom::Element*>(aObject),
521 : "Multiple inheritance for mozilla::dom::Element is broken.");
522 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
523 : reinterpret_cast<nsINode*>(aObject),
524 : "Multiple inheritance for nsINode is broken.");
525 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
526 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
527 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
528 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
529 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
530 0 : MOZ_ASSERT(!aCache->GetWrapper(),
531 : "You should probably not be using Wrap() directly; use "
532 : "GetOrCreateDOMReflector instead");
533 :
534 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
535 : "nsISupports must be on our primary inheritance chain");
536 :
537 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
538 0 : if (!global) {
539 0 : return false;
540 : }
541 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
542 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
543 :
544 : // That might have ended up wrapping us already, due to the wonders
545 : // of XBL. Check for that, and bail out as needed.
546 0 : aReflector.set(aCache->GetWrapper());
547 0 : if (aReflector) {
548 : #ifdef DEBUG
549 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
550 : #endif // DEBUG
551 0 : return true;
552 : }
553 :
554 0 : JSAutoCompartment ac(aCx, global);
555 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
556 0 : if (!canonicalProto) {
557 0 : return false;
558 : }
559 0 : JS::Rooted<JSObject*> proto(aCx);
560 0 : if (aGivenProto) {
561 0 : proto = aGivenProto;
562 : // Unfortunately, while aGivenProto was in the compartment of aCx
563 : // coming in, we changed compartments to that of "parent" so may need
564 : // to wrap the proto here.
565 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
566 0 : if (!JS_WrapObject(aCx, &proto)) {
567 0 : return false;
568 : }
569 : }
570 : } else {
571 0 : proto = canonicalProto;
572 : }
573 :
574 0 : BindingJSObjectCreator<mozilla::dom::SVGFEGaussianBlurElement> creator(aCx);
575 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
576 0 : if (!aReflector) {
577 0 : return false;
578 : }
579 :
580 0 : aCache->SetWrapper(aReflector);
581 0 : creator.InitializationSucceeded();
582 :
583 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
584 : aCache->GetWrapperPreserveColor() == aReflector);
585 : // If proto != canonicalProto, we have to preserve our wrapper;
586 : // otherwise we won't be able to properly recreate it later, since
587 : // we won't know what proto to use. Note that we don't check
588 : // aGivenProto here, since it's entirely possible (and even
589 : // somewhat common) to have a non-null aGivenProto which is the
590 : // same as canonicalProto.
591 0 : if (proto != canonicalProto) {
592 0 : PreserveWrapper(aObject);
593 : }
594 :
595 0 : return true;
596 : }
597 :
598 : const NativePropertyHooks sNativePropertyHooks[] = { {
599 : nullptr,
600 : nullptr,
601 : nullptr,
602 : { sNativeProperties.Upcast(), nullptr },
603 : prototypes::id::SVGFEGaussianBlurElement,
604 : constructors::id::SVGFEGaussianBlurElement,
605 : SVGElementBinding::sNativePropertyHooks,
606 : &DefaultXrayExpandoObjectClass
607 : } };
608 :
609 : void
610 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
611 : {
612 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
613 0 : if (!parentProto) {
614 0 : return;
615 : }
616 :
617 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
618 0 : if (!constructorProto) {
619 0 : return;
620 : }
621 :
622 : static bool sIdsInited = false;
623 0 : if (!sIdsInited && NS_IsMainThread()) {
624 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
625 0 : return;
626 : }
627 0 : sIdsInited = true;
628 : }
629 :
630 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEGaussianBlurElement);
631 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEGaussianBlurElement);
632 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
633 : &sPrototypeClass.mBase, protoCache,
634 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
635 : interfaceCache,
636 : sNativeProperties.Upcast(),
637 : nullptr,
638 : "SVGFEGaussianBlurElement", aDefineOnGlobal,
639 : nullptr,
640 0 : false);
641 : }
642 :
643 : JS::Handle<JSObject*>
644 0 : GetProtoObjectHandle(JSContext* aCx)
645 : {
646 : /* Get the interface prototype object for this class. This will create the
647 : object as needed. */
648 0 : bool aDefineOnGlobal = true;
649 :
650 : /* Make sure our global is sane. Hopefully we can remove this sometime */
651 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
652 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
653 0 : return nullptr;
654 : }
655 :
656 : /* Check to see whether the interface objects are already installed */
657 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
658 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGFEGaussianBlurElement)) {
659 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
660 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
661 : }
662 :
663 : /*
664 : * The object might _still_ be null, but that's OK.
665 : *
666 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
667 : * traced by TraceProtoAndIfaceCache() and its contents are never
668 : * changed after they have been set.
669 : *
670 : * Calling address() avoids the read read barrier that does gray
671 : * unmarking, but it's not possible for the object to be gray here.
672 : */
673 :
674 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGFEGaussianBlurElement);
675 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
676 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
677 : }
678 :
679 : JS::Handle<JSObject*>
680 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
681 : {
682 : /* Get the interface object for this class. This will create the object as
683 : needed. */
684 :
685 : /* Make sure our global is sane. Hopefully we can remove this sometime */
686 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
687 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
688 0 : return nullptr;
689 : }
690 :
691 : /* Check to see whether the interface objects are already installed */
692 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
693 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGFEGaussianBlurElement)) {
694 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
695 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
696 : }
697 :
698 : /*
699 : * The object might _still_ be null, but that's OK.
700 : *
701 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
702 : * traced by TraceProtoAndIfaceCache() and its contents are never
703 : * changed after they have been set.
704 : *
705 : * Calling address() avoids the read read barrier that does gray
706 : * unmarking, but it's not possible for the object to be gray here.
707 : */
708 :
709 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGFEGaussianBlurElement);
710 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
711 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
712 : }
713 :
714 : JSObject*
715 0 : GetConstructorObject(JSContext* aCx)
716 : {
717 0 : return GetConstructorObjectHandle(aCx);
718 : }
719 :
720 : } // namespace SVGFEGaussianBlurElementBinding
721 :
722 :
723 :
724 : } // namespace dom
725 : } // namespace mozilla
|