Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGFEDistantLightElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGElementBinding.h"
4 : #include "SVGFEDistantLightElementBinding.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/SVGAnimatedNumber.h"
11 : #include "mozilla/dom/SVGFEDistantLightElement.h"
12 : #include "mozilla/dom/XrayExpandoClass.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : namespace SVGFEDistantLightElementBinding {
18 :
19 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElementBinding::NativeType>::value,
20 : "Can't inherit from an interface with a different ownership model.");
21 :
22 : static bool
23 0 : get_azimuth(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDistantLightElement* self, JSJitGetterCallArgs args)
24 : {
25 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Azimuth()));
26 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
27 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
28 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
29 0 : return false;
30 : }
31 0 : return true;
32 : }
33 :
34 : static const JSJitInfo azimuth_getterinfo = {
35 : { (JSJitGetterOp)get_azimuth },
36 : { prototypes::id::SVGFEDistantLightElement },
37 : { PrototypeTraits<prototypes::id::SVGFEDistantLightElement>::Depth },
38 : JSJitInfo::Getter,
39 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
40 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
41 : false, /* isInfallible. False in setters. */
42 : true, /* isMovable. Not relevant for setters. */
43 : true, /* isEliminatable. Not relevant for setters. */
44 : false, /* isAlwaysInSlot. Only relevant for getters. */
45 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
46 : false, /* isTypedMethod. Only relevant for methods. */
47 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
48 : };
49 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
50 : static_assert(0 < 1, "There is no slot for us");
51 :
52 : static bool
53 0 : get_elevation(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEDistantLightElement* self, JSJitGetterCallArgs args)
54 : {
55 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Elevation()));
56 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
57 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
58 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
59 0 : return false;
60 : }
61 0 : return true;
62 : }
63 :
64 : static const JSJitInfo elevation_getterinfo = {
65 : { (JSJitGetterOp)get_elevation },
66 : { prototypes::id::SVGFEDistantLightElement },
67 : { PrototypeTraits<prototypes::id::SVGFEDistantLightElement>::Depth },
68 : JSJitInfo::Getter,
69 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
70 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
71 : false, /* isInfallible. False in setters. */
72 : true, /* isMovable. Not relevant for setters. */
73 : true, /* isEliminatable. Not relevant for setters. */
74 : false, /* isAlwaysInSlot. Only relevant for getters. */
75 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
76 : false, /* isTypedMethod. Only relevant for methods. */
77 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
78 : };
79 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
80 : static_assert(0 < 1, "There is no slot for us");
81 :
82 : static bool
83 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
84 : {
85 0 : mozilla::dom::SVGFEDistantLightElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDistantLightElement>(obj);
86 : // We don't want to preserve if we don't have a wrapper, and we
87 : // obviously can't preserve if we're not initialized.
88 0 : if (self && self->GetWrapperPreserveColor()) {
89 0 : PreserveWrapper(self);
90 : }
91 0 : return true;
92 : }
93 :
94 : static void
95 0 : _finalize(js::FreeOp* fop, JSObject* obj)
96 : {
97 0 : mozilla::dom::SVGFEDistantLightElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDistantLightElement>(obj);
98 0 : if (self) {
99 0 : ClearWrapper(self, self, obj);
100 0 : AddForDeferredFinalization<mozilla::dom::SVGFEDistantLightElement>(self);
101 : }
102 0 : }
103 :
104 : static void
105 0 : _objectMoved(JSObject* obj, const JSObject* old)
106 : {
107 0 : mozilla::dom::SVGFEDistantLightElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEDistantLightElement>(obj);
108 0 : if (self) {
109 0 : UpdateWrapper(self, self, obj, old);
110 : }
111 0 : }
112 :
113 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
114 : #if defined(__clang__)
115 : #pragma clang diagnostic push
116 : #pragma clang diagnostic ignored "-Wmissing-braces"
117 : #endif
118 : static const JSPropertySpec sAttributes_specs[] = {
119 : { "azimuth", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &azimuth_getterinfo, nullptr, nullptr },
120 : { "elevation", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &elevation_getterinfo, nullptr, nullptr },
121 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
122 : };
123 : #if defined(__clang__)
124 : #pragma clang diagnostic pop
125 : #endif
126 :
127 :
128 : // Can't be const because the pref-enabled boolean needs to be writable
129 : static Prefable<const JSPropertySpec> sAttributes[] = {
130 : { nullptr, &sAttributes_specs[0] },
131 : { nullptr, nullptr }
132 : };
133 :
134 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
135 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
136 : static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
137 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
138 :
139 :
140 : static uint16_t sNativeProperties_sortedPropertyIndices[2];
141 : static PropertyInfo sNativeProperties_propertyInfos[2];
142 :
143 : static const NativePropertiesN<1> sNativeProperties = {
144 : false, 0,
145 : false, 0,
146 : false, 0,
147 : true, 0 /* sAttributes */,
148 : false, 0,
149 : false, 0,
150 : false, 0,
151 : -1,
152 : 2,
153 : sNativeProperties_sortedPropertyIndices,
154 : {
155 : { sAttributes, &sNativeProperties_propertyInfos[0] }
156 : }
157 : };
158 : static_assert(2 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
159 : "We have a property info count that is oversized");
160 :
161 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
162 : {
163 : "Function",
164 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
165 : &sBoringInterfaceObjectClassClassOps,
166 : JS_NULL_CLASS_SPEC,
167 : JS_NULL_CLASS_EXT,
168 : &sInterfaceObjectClassObjectOps
169 : },
170 : eInterface,
171 : true,
172 : prototypes::id::SVGFEDistantLightElement,
173 : PrototypeTraits<prototypes::id::SVGFEDistantLightElement>::Depth,
174 : sNativePropertyHooks,
175 : "function SVGFEDistantLightElement() {\n [native code]\n}",
176 : SVGElementBinding::GetConstructorObject
177 : };
178 :
179 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
180 : {
181 : "SVGFEDistantLightElementPrototype",
182 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
183 : JS_NULL_CLASS_OPS,
184 : JS_NULL_CLASS_SPEC,
185 : JS_NULL_CLASS_EXT,
186 : JS_NULL_OBJECT_OPS
187 : },
188 : eInterfacePrototype,
189 : false,
190 : prototypes::id::SVGFEDistantLightElement,
191 : PrototypeTraits<prototypes::id::SVGFEDistantLightElement>::Depth,
192 : sNativePropertyHooks,
193 : "[object SVGFEDistantLightElementPrototype]",
194 : SVGElementBinding::GetProtoObject
195 : };
196 :
197 : JSObject*
198 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
199 : {
200 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
201 : }
202 :
203 : static const js::ClassOps sClassOps = {
204 : _addProperty, /* addProperty */
205 : nullptr, /* delProperty */
206 : nullptr, /* getProperty */
207 : nullptr, /* setProperty */
208 : nullptr, /* enumerate */
209 : nullptr, /* newEnumerate */
210 : nullptr, /* resolve */
211 : nullptr, /* mayResolve */
212 : _finalize, /* finalize */
213 : nullptr, /* call */
214 : nullptr, /* hasInstance */
215 : nullptr, /* construct */
216 : nullptr, /* trace */
217 : };
218 :
219 : static const js::ClassExtension sClassExtension = {
220 : nullptr, /* weakmapKeyDelegateOp */
221 : _objectMoved /* objectMovedOp */
222 : };
223 :
224 : static const DOMJSClass sClass = {
225 : { "SVGFEDistantLightElement",
226 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
227 : &sClassOps,
228 : JS_NULL_CLASS_SPEC,
229 : &sClassExtension,
230 : JS_NULL_OBJECT_OPS
231 : },
232 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFEDistantLightElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
233 : IsBaseOf<nsISupports, mozilla::dom::SVGFEDistantLightElement >::value,
234 : sNativePropertyHooks,
235 : FindAssociatedGlobalForNative<mozilla::dom::SVGFEDistantLightElement>::Get,
236 : GetProtoObjectHandle,
237 : GetCCParticipant<mozilla::dom::SVGFEDistantLightElement>::Get()
238 : };
239 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
240 : "Must have the right minimal number of reserved slots.");
241 : static_assert(1 >= 1,
242 : "Must have enough reserved slots.");
243 :
244 : const JSClass*
245 0 : GetJSClass()
246 : {
247 0 : return sClass.ToJSClass();
248 : }
249 :
250 : bool
251 0 : Wrap(JSContext* aCx, mozilla::dom::SVGFEDistantLightElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
252 : {
253 : MOZ_ASSERT(static_cast<mozilla::dom::SVGFEDistantLightElement*>(aObject) ==
254 : reinterpret_cast<mozilla::dom::SVGFEDistantLightElement*>(aObject),
255 : "Multiple inheritance for mozilla::dom::SVGFEDistantLightElement is broken.");
256 : MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
257 : reinterpret_cast<nsSVGElement*>(aObject),
258 : "Multiple inheritance for nsSVGElement is broken.");
259 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
260 : reinterpret_cast<mozilla::dom::Element*>(aObject),
261 : "Multiple inheritance for mozilla::dom::Element is broken.");
262 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
263 : reinterpret_cast<nsINode*>(aObject),
264 : "Multiple inheritance for nsINode is broken.");
265 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
266 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
267 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
268 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
269 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
270 0 : MOZ_ASSERT(!aCache->GetWrapper(),
271 : "You should probably not be using Wrap() directly; use "
272 : "GetOrCreateDOMReflector instead");
273 :
274 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
275 : "nsISupports must be on our primary inheritance chain");
276 :
277 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
278 0 : if (!global) {
279 0 : return false;
280 : }
281 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
282 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
283 :
284 : // That might have ended up wrapping us already, due to the wonders
285 : // of XBL. Check for that, and bail out as needed.
286 0 : aReflector.set(aCache->GetWrapper());
287 0 : if (aReflector) {
288 : #ifdef DEBUG
289 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
290 : #endif // DEBUG
291 0 : return true;
292 : }
293 :
294 0 : JSAutoCompartment ac(aCx, global);
295 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
296 0 : if (!canonicalProto) {
297 0 : return false;
298 : }
299 0 : JS::Rooted<JSObject*> proto(aCx);
300 0 : if (aGivenProto) {
301 0 : proto = aGivenProto;
302 : // Unfortunately, while aGivenProto was in the compartment of aCx
303 : // coming in, we changed compartments to that of "parent" so may need
304 : // to wrap the proto here.
305 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
306 0 : if (!JS_WrapObject(aCx, &proto)) {
307 0 : return false;
308 : }
309 : }
310 : } else {
311 0 : proto = canonicalProto;
312 : }
313 :
314 0 : BindingJSObjectCreator<mozilla::dom::SVGFEDistantLightElement> creator(aCx);
315 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
316 0 : if (!aReflector) {
317 0 : return false;
318 : }
319 :
320 0 : aCache->SetWrapper(aReflector);
321 0 : creator.InitializationSucceeded();
322 :
323 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
324 : aCache->GetWrapperPreserveColor() == aReflector);
325 : // If proto != canonicalProto, we have to preserve our wrapper;
326 : // otherwise we won't be able to properly recreate it later, since
327 : // we won't know what proto to use. Note that we don't check
328 : // aGivenProto here, since it's entirely possible (and even
329 : // somewhat common) to have a non-null aGivenProto which is the
330 : // same as canonicalProto.
331 0 : if (proto != canonicalProto) {
332 0 : PreserveWrapper(aObject);
333 : }
334 :
335 0 : return true;
336 : }
337 :
338 : const NativePropertyHooks sNativePropertyHooks[] = { {
339 : nullptr,
340 : nullptr,
341 : nullptr,
342 : { sNativeProperties.Upcast(), nullptr },
343 : prototypes::id::SVGFEDistantLightElement,
344 : constructors::id::SVGFEDistantLightElement,
345 : SVGElementBinding::sNativePropertyHooks,
346 : &DefaultXrayExpandoObjectClass
347 : } };
348 :
349 : void
350 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
351 : {
352 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
353 0 : if (!parentProto) {
354 0 : return;
355 : }
356 :
357 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
358 0 : if (!constructorProto) {
359 0 : return;
360 : }
361 :
362 : static bool sIdsInited = false;
363 0 : if (!sIdsInited && NS_IsMainThread()) {
364 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
365 0 : return;
366 : }
367 0 : sIdsInited = true;
368 : }
369 :
370 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEDistantLightElement);
371 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEDistantLightElement);
372 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
373 : &sPrototypeClass.mBase, protoCache,
374 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
375 : interfaceCache,
376 : sNativeProperties.Upcast(),
377 : nullptr,
378 : "SVGFEDistantLightElement", aDefineOnGlobal,
379 : nullptr,
380 0 : false);
381 : }
382 :
383 : JS::Handle<JSObject*>
384 0 : GetProtoObjectHandle(JSContext* aCx)
385 : {
386 : /* Get the interface prototype object for this class. This will create the
387 : object as needed. */
388 0 : bool aDefineOnGlobal = true;
389 :
390 : /* Make sure our global is sane. Hopefully we can remove this sometime */
391 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
392 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
393 0 : return nullptr;
394 : }
395 :
396 : /* Check to see whether the interface objects are already installed */
397 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
398 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGFEDistantLightElement)) {
399 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
400 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
401 : }
402 :
403 : /*
404 : * The object might _still_ be null, but that's OK.
405 : *
406 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
407 : * traced by TraceProtoAndIfaceCache() and its contents are never
408 : * changed after they have been set.
409 : *
410 : * Calling address() avoids the read read barrier that does gray
411 : * unmarking, but it's not possible for the object to be gray here.
412 : */
413 :
414 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGFEDistantLightElement);
415 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
416 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
417 : }
418 :
419 : JS::Handle<JSObject*>
420 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
421 : {
422 : /* Get the interface object for this class. This will create the object as
423 : needed. */
424 :
425 : /* Make sure our global is sane. Hopefully we can remove this sometime */
426 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
427 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
428 0 : return nullptr;
429 : }
430 :
431 : /* Check to see whether the interface objects are already installed */
432 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
433 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGFEDistantLightElement)) {
434 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
435 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
436 : }
437 :
438 : /*
439 : * The object might _still_ be null, but that's OK.
440 : *
441 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
442 : * traced by TraceProtoAndIfaceCache() and its contents are never
443 : * changed after they have been set.
444 : *
445 : * Calling address() avoids the read read barrier that does gray
446 : * unmarking, but it's not possible for the object to be gray here.
447 : */
448 :
449 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGFEDistantLightElement);
450 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
451 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
452 : }
453 :
454 : JSObject*
455 0 : GetConstructorObject(JSContext* aCx)
456 : {
457 0 : return GetConstructorObjectHandle(aCx);
458 : }
459 :
460 : } // namespace SVGFEDistantLightElementBinding
461 :
462 :
463 :
464 : } // namespace dom
465 : } // namespace mozilla
|