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