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