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