Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGGradientElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGElementBinding.h"
4 : #include "SVGGradientElementBinding.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/SVGAnimatedString.h"
12 : #include "mozilla/dom/SVGAnimatedTransformList.h"
13 : #include "mozilla/dom/SVGGradientElement.h"
14 : #include "mozilla/dom/XrayExpandoClass.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : namespace SVGGradientElementBinding {
20 :
21 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElementBinding::NativeType>::value,
22 : "Can't inherit from an interface with a different ownership model.");
23 :
24 : static bool
25 0 : get_gradientUnits(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGGradientElement* self, JSJitGetterCallArgs args)
26 : {
27 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->GradientUnits()));
28 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
29 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
30 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
31 0 : return false;
32 : }
33 0 : return true;
34 : }
35 :
36 : static const JSJitInfo gradientUnits_getterinfo = {
37 : { (JSJitGetterOp)get_gradientUnits },
38 : { prototypes::id::SVGGradientElement },
39 : { PrototypeTraits<prototypes::id::SVGGradientElement>::Depth },
40 : JSJitInfo::Getter,
41 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
42 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
43 : false, /* isInfallible. False in setters. */
44 : true, /* isMovable. Not relevant for setters. */
45 : true, /* isEliminatable. Not relevant for setters. */
46 : false, /* isAlwaysInSlot. Only relevant for getters. */
47 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
48 : false, /* isTypedMethod. Only relevant for methods. */
49 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
50 : };
51 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
52 : static_assert(0 < 1, "There is no slot for us");
53 :
54 : static bool
55 0 : get_gradientTransform(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGGradientElement* self, JSJitGetterCallArgs args)
56 : {
57 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedTransformList>(self->GradientTransform()));
58 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
59 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
60 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
61 0 : return false;
62 : }
63 0 : return true;
64 : }
65 :
66 : static const JSJitInfo gradientTransform_getterinfo = {
67 : { (JSJitGetterOp)get_gradientTransform },
68 : { prototypes::id::SVGGradientElement },
69 : { PrototypeTraits<prototypes::id::SVGGradientElement>::Depth },
70 : JSJitInfo::Getter,
71 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
72 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
73 : false, /* isInfallible. False in setters. */
74 : true, /* isMovable. Not relevant for setters. */
75 : true, /* isEliminatable. Not relevant for setters. */
76 : false, /* isAlwaysInSlot. Only relevant for getters. */
77 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
78 : false, /* isTypedMethod. Only relevant for methods. */
79 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
80 : };
81 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
82 : static_assert(0 < 1, "There is no slot for us");
83 :
84 : static bool
85 0 : get_spreadMethod(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGGradientElement* self, JSJitGetterCallArgs args)
86 : {
87 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->SpreadMethod()));
88 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
89 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
90 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
91 0 : return false;
92 : }
93 0 : return true;
94 : }
95 :
96 : static const JSJitInfo spreadMethod_getterinfo = {
97 : { (JSJitGetterOp)get_spreadMethod },
98 : { prototypes::id::SVGGradientElement },
99 : { PrototypeTraits<prototypes::id::SVGGradientElement>::Depth },
100 : JSJitInfo::Getter,
101 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
102 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
103 : false, /* isInfallible. False in setters. */
104 : true, /* isMovable. Not relevant for setters. */
105 : true, /* isEliminatable. Not relevant for setters. */
106 : false, /* isAlwaysInSlot. Only relevant for getters. */
107 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
108 : false, /* isTypedMethod. Only relevant for methods. */
109 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
110 : };
111 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
112 : static_assert(0 < 1, "There is no slot for us");
113 :
114 : static bool
115 0 : get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGGradientElement* self, JSJitGetterCallArgs args)
116 : {
117 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Href()));
118 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
119 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
120 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
121 0 : return false;
122 : }
123 0 : return true;
124 : }
125 :
126 : static const JSJitInfo href_getterinfo = {
127 : { (JSJitGetterOp)get_href },
128 : { prototypes::id::SVGGradientElement },
129 : { PrototypeTraits<prototypes::id::SVGGradientElement>::Depth },
130 : JSJitInfo::Getter,
131 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
132 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
133 : false, /* isInfallible. False in setters. */
134 : true, /* isMovable. Not relevant for setters. */
135 : true, /* isEliminatable. Not relevant for setters. */
136 : false, /* isAlwaysInSlot. Only relevant for getters. */
137 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
138 : false, /* isTypedMethod. Only relevant for methods. */
139 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
140 : };
141 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
142 : static_assert(0 < 1, "There is no slot for us");
143 :
144 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
145 : #if defined(__clang__)
146 : #pragma clang diagnostic push
147 : #pragma clang diagnostic ignored "-Wmissing-braces"
148 : #endif
149 : static const JSPropertySpec sAttributes_specs[] = {
150 : { "gradientUnits", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &gradientUnits_getterinfo, nullptr, nullptr },
151 : { "gradientTransform", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &gradientTransform_getterinfo, nullptr, nullptr },
152 : { "spreadMethod", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &spreadMethod_getterinfo, nullptr, nullptr },
153 : { "href", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &href_getterinfo, nullptr, nullptr },
154 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
155 : };
156 : #if defined(__clang__)
157 : #pragma clang diagnostic pop
158 : #endif
159 :
160 :
161 : // Can't be const because the pref-enabled boolean needs to be writable
162 : static Prefable<const JSPropertySpec> sAttributes[] = {
163 : { nullptr, &sAttributes_specs[0] },
164 : { nullptr, nullptr }
165 : };
166 :
167 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
168 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
169 : static_assert(4 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
170 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
171 :
172 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
173 : #if defined(__clang__)
174 : #pragma clang diagnostic push
175 : #pragma clang diagnostic ignored "-Wmissing-braces"
176 : #endif
177 : static const ConstantSpec sConstants_specs[] = {
178 : { "SVG_SPREADMETHOD_UNKNOWN", JS::Int32Value(0) },
179 : { "SVG_SPREADMETHOD_PAD", JS::Int32Value(1) },
180 : { "SVG_SPREADMETHOD_REFLECT", JS::Int32Value(2) },
181 : { "SVG_SPREADMETHOD_REPEAT", JS::Int32Value(3) },
182 : { "SVG_UNIT_TYPE_UNKNOWN", JS::Int32Value(0) },
183 : { "SVG_UNIT_TYPE_USERSPACEONUSE", JS::Int32Value(1) },
184 : { "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX", JS::Int32Value(2) },
185 : { 0, JS::UndefinedValue() }
186 : };
187 : #if defined(__clang__)
188 : #pragma clang diagnostic pop
189 : #endif
190 :
191 :
192 : // Can't be const because the pref-enabled boolean needs to be writable
193 : static Prefable<const ConstantSpec> sConstants[] = {
194 : { nullptr, &sConstants_specs[0] },
195 : { nullptr, nullptr }
196 : };
197 :
198 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
199 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
200 : static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
201 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
202 :
203 :
204 : static uint16_t sNativeProperties_sortedPropertyIndices[11];
205 : static PropertyInfo sNativeProperties_propertyInfos[11];
206 :
207 : static const NativePropertiesN<2> sNativeProperties = {
208 : false, 0,
209 : false, 0,
210 : false, 0,
211 : true, 0 /* sAttributes */,
212 : false, 0,
213 : false, 0,
214 : true, 1 /* sConstants */,
215 : -1,
216 : 11,
217 : sNativeProperties_sortedPropertyIndices,
218 : {
219 : { sAttributes, &sNativeProperties_propertyInfos[0] },
220 : { sConstants, &sNativeProperties_propertyInfos[4] }
221 : }
222 : };
223 : static_assert(11 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
224 : "We have a property info count that is oversized");
225 :
226 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
227 : {
228 : "Function",
229 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
230 : &sBoringInterfaceObjectClassClassOps,
231 : JS_NULL_CLASS_SPEC,
232 : JS_NULL_CLASS_EXT,
233 : &sInterfaceObjectClassObjectOps
234 : },
235 : eInterface,
236 : true,
237 : prototypes::id::SVGGradientElement,
238 : PrototypeTraits<prototypes::id::SVGGradientElement>::Depth,
239 : sNativePropertyHooks,
240 : "function SVGGradientElement() {\n [native code]\n}",
241 : SVGElementBinding::GetConstructorObject
242 : };
243 :
244 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
245 : {
246 : "SVGGradientElementPrototype",
247 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
248 : JS_NULL_CLASS_OPS,
249 : JS_NULL_CLASS_SPEC,
250 : JS_NULL_CLASS_EXT,
251 : JS_NULL_OBJECT_OPS
252 : },
253 : eInterfacePrototype,
254 : false,
255 : prototypes::id::SVGGradientElement,
256 : PrototypeTraits<prototypes::id::SVGGradientElement>::Depth,
257 : sNativePropertyHooks,
258 : "[object SVGGradientElementPrototype]",
259 : SVGElementBinding::GetProtoObject
260 : };
261 :
262 : JSObject*
263 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
264 : {
265 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
266 : }
267 :
268 : const NativePropertyHooks sNativePropertyHooks[] = { {
269 : nullptr,
270 : nullptr,
271 : nullptr,
272 : { sNativeProperties.Upcast(), nullptr },
273 : prototypes::id::SVGGradientElement,
274 : constructors::id::SVGGradientElement,
275 : SVGElementBinding::sNativePropertyHooks,
276 : &DefaultXrayExpandoObjectClass
277 : } };
278 :
279 : void
280 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
281 : {
282 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
283 0 : if (!parentProto) {
284 0 : return;
285 : }
286 :
287 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
288 0 : if (!constructorProto) {
289 0 : return;
290 : }
291 :
292 : static bool sIdsInited = false;
293 0 : if (!sIdsInited && NS_IsMainThread()) {
294 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
295 0 : return;
296 : }
297 0 : sIdsInited = true;
298 : }
299 :
300 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGGradientElement);
301 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGGradientElement);
302 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
303 : &sPrototypeClass.mBase, protoCache,
304 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
305 : interfaceCache,
306 : sNativeProperties.Upcast(),
307 : nullptr,
308 : "SVGGradientElement", aDefineOnGlobal,
309 : nullptr,
310 0 : false);
311 : }
312 :
313 : JS::Handle<JSObject*>
314 0 : GetProtoObjectHandle(JSContext* aCx)
315 : {
316 : /* Get the interface prototype object for this class. This will create the
317 : object as needed. */
318 0 : bool aDefineOnGlobal = true;
319 :
320 : /* Make sure our global is sane. Hopefully we can remove this sometime */
321 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
322 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
323 0 : return nullptr;
324 : }
325 :
326 : /* Check to see whether the interface objects are already installed */
327 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
328 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGGradientElement)) {
329 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
330 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
331 : }
332 :
333 : /*
334 : * The object might _still_ be null, but that's OK.
335 : *
336 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
337 : * traced by TraceProtoAndIfaceCache() and its contents are never
338 : * changed after they have been set.
339 : *
340 : * Calling address() avoids the read read barrier that does gray
341 : * unmarking, but it's not possible for the object to be gray here.
342 : */
343 :
344 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGGradientElement);
345 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
346 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
347 : }
348 :
349 : JSObject*
350 0 : GetProtoObject(JSContext* aCx)
351 : {
352 0 : return GetProtoObjectHandle(aCx);
353 : }
354 :
355 : JS::Handle<JSObject*>
356 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
357 : {
358 : /* Get the interface object for this class. This will create the object as
359 : needed. */
360 :
361 : /* Make sure our global is sane. Hopefully we can remove this sometime */
362 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
363 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
364 0 : return nullptr;
365 : }
366 :
367 : /* Check to see whether the interface objects are already installed */
368 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
369 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGGradientElement)) {
370 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
371 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
372 : }
373 :
374 : /*
375 : * The object might _still_ be null, but that's OK.
376 : *
377 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
378 : * traced by TraceProtoAndIfaceCache() and its contents are never
379 : * changed after they have been set.
380 : *
381 : * Calling address() avoids the read read barrier that does gray
382 : * unmarking, but it's not possible for the object to be gray here.
383 : */
384 :
385 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGGradientElement);
386 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
387 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
388 : }
389 :
390 : JSObject*
391 0 : GetConstructorObject(JSContext* aCx)
392 : {
393 0 : return GetConstructorObjectHandle(aCx);
394 : }
395 :
396 : } // namespace SVGGradientElementBinding
397 :
398 :
399 :
400 : } // namespace dom
401 : } // namespace mozilla
|