Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGFECompositeElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGElementBinding.h"
4 : #include "SVGFECompositeElementBinding.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/SVGFECompositeElement.h"
15 : #include "mozilla/dom/XrayExpandoClass.h"
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : namespace SVGFECompositeElementBinding {
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::SVGFECompositeElement* 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::SVGFECompositeElement },
40 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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_in2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
57 : {
58 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->In2()));
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 in2_getterinfo = {
68 : { (JSJitGetterOp)get_in2 },
69 : { prototypes::id::SVGFECompositeElement },
70 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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_operator(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
87 : {
88 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->Operator()));
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 operator_getterinfo = {
98 : { (JSJitGetterOp)get_operator },
99 : { prototypes::id::SVGFECompositeElement },
100 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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_k1(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
117 : {
118 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->K1()));
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 k1_getterinfo = {
128 : { (JSJitGetterOp)get_k1 },
129 : { prototypes::id::SVGFECompositeElement },
130 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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_k2(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
147 : {
148 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->K2()));
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 k2_getterinfo = {
158 : { (JSJitGetterOp)get_k2 },
159 : { prototypes::id::SVGFECompositeElement },
160 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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_k3(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
177 : {
178 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->K3()));
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 k3_getterinfo = {
188 : { (JSJitGetterOp)get_k3 },
189 : { prototypes::id::SVGFECompositeElement },
190 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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_k4(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
207 : {
208 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->K4()));
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 k4_getterinfo = {
218 : { (JSJitGetterOp)get_k4 },
219 : { prototypes::id::SVGFECompositeElement },
220 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
237 : {
238 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
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 x_getterinfo = {
248 : { (JSJitGetterOp)get_x },
249 : { prototypes::id::SVGFECompositeElement },
250 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
267 : {
268 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
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 y_getterinfo = {
278 : { (JSJitGetterOp)get_y },
279 : { prototypes::id::SVGFECompositeElement },
280 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::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 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
297 : {
298 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
299 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
300 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
301 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
302 0 : return false;
303 : }
304 0 : return true;
305 : }
306 :
307 : static const JSJitInfo width_getterinfo = {
308 : { (JSJitGetterOp)get_width },
309 : { prototypes::id::SVGFECompositeElement },
310 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::Depth },
311 : JSJitInfo::Getter,
312 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
313 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
314 : false, /* isInfallible. False in setters. */
315 : true, /* isMovable. Not relevant for setters. */
316 : true, /* isEliminatable. Not relevant for setters. */
317 : false, /* isAlwaysInSlot. Only relevant for getters. */
318 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
319 : false, /* isTypedMethod. Only relevant for methods. */
320 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
321 : };
322 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
323 : static_assert(0 < 1, "There is no slot for us");
324 :
325 : static bool
326 0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
327 : {
328 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
329 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
330 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
331 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
332 0 : return false;
333 : }
334 0 : return true;
335 : }
336 :
337 : static const JSJitInfo height_getterinfo = {
338 : { (JSJitGetterOp)get_height },
339 : { prototypes::id::SVGFECompositeElement },
340 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::Depth },
341 : JSJitInfo::Getter,
342 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
343 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
344 : false, /* isInfallible. False in setters. */
345 : true, /* isMovable. Not relevant for setters. */
346 : true, /* isEliminatable. Not relevant for setters. */
347 : false, /* isAlwaysInSlot. Only relevant for getters. */
348 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
349 : false, /* isTypedMethod. Only relevant for methods. */
350 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
351 : };
352 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
353 : static_assert(0 < 1, "There is no slot for us");
354 :
355 : static bool
356 0 : get_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFECompositeElement* self, JSJitGetterCallArgs args)
357 : {
358 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
359 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
360 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
361 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
362 0 : return false;
363 : }
364 0 : return true;
365 : }
366 :
367 : static const JSJitInfo result_getterinfo = {
368 : { (JSJitGetterOp)get_result },
369 : { prototypes::id::SVGFECompositeElement },
370 : { PrototypeTraits<prototypes::id::SVGFECompositeElement>::Depth },
371 : JSJitInfo::Getter,
372 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
373 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
374 : false, /* isInfallible. False in setters. */
375 : true, /* isMovable. Not relevant for setters. */
376 : true, /* isEliminatable. Not relevant for setters. */
377 : false, /* isAlwaysInSlot. Only relevant for getters. */
378 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
379 : false, /* isTypedMethod. Only relevant for methods. */
380 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
381 : };
382 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
383 : static_assert(0 < 1, "There is no slot for us");
384 :
385 : static bool
386 0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
387 : {
388 0 : mozilla::dom::SVGFECompositeElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFECompositeElement>(obj);
389 : // We don't want to preserve if we don't have a wrapper, and we
390 : // obviously can't preserve if we're not initialized.
391 0 : if (self && self->GetWrapperPreserveColor()) {
392 0 : PreserveWrapper(self);
393 : }
394 0 : return true;
395 : }
396 :
397 : static void
398 0 : _finalize(js::FreeOp* fop, JSObject* obj)
399 : {
400 0 : mozilla::dom::SVGFECompositeElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFECompositeElement>(obj);
401 0 : if (self) {
402 0 : ClearWrapper(self, self, obj);
403 0 : AddForDeferredFinalization<mozilla::dom::SVGFECompositeElement>(self);
404 : }
405 0 : }
406 :
407 : static void
408 0 : _objectMoved(JSObject* obj, const JSObject* old)
409 : {
410 0 : mozilla::dom::SVGFECompositeElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFECompositeElement>(obj);
411 0 : if (self) {
412 0 : UpdateWrapper(self, self, obj, old);
413 : }
414 0 : }
415 :
416 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
417 : #if defined(__clang__)
418 : #pragma clang diagnostic push
419 : #pragma clang diagnostic ignored "-Wmissing-braces"
420 : #endif
421 : static const JSPropertySpec sAttributes_specs[] = {
422 : { "in1", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &in1_getterinfo, nullptr, nullptr },
423 : { "in2", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &in2_getterinfo, nullptr, nullptr },
424 : { "operator", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &operator_getterinfo, nullptr, nullptr },
425 : { "k1", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &k1_getterinfo, nullptr, nullptr },
426 : { "k2", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &k2_getterinfo, nullptr, nullptr },
427 : { "k3", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &k3_getterinfo, nullptr, nullptr },
428 : { "k4", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &k4_getterinfo, nullptr, nullptr },
429 : { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
430 : { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
431 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
432 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
433 : { "result", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &result_getterinfo, nullptr, nullptr },
434 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
435 : };
436 : #if defined(__clang__)
437 : #pragma clang diagnostic pop
438 : #endif
439 :
440 :
441 : // Can't be const because the pref-enabled boolean needs to be writable
442 : static Prefable<const JSPropertySpec> sAttributes[] = {
443 : { nullptr, &sAttributes_specs[0] },
444 : { nullptr, nullptr }
445 : };
446 :
447 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
448 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
449 : static_assert(12 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
450 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
451 :
452 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
453 : #if defined(__clang__)
454 : #pragma clang diagnostic push
455 : #pragma clang diagnostic ignored "-Wmissing-braces"
456 : #endif
457 : static const ConstantSpec sConstants_specs[] = {
458 : { "SVG_FECOMPOSITE_OPERATOR_UNKNOWN", JS::Int32Value(0) },
459 : { "SVG_FECOMPOSITE_OPERATOR_OVER", JS::Int32Value(1) },
460 : { "SVG_FECOMPOSITE_OPERATOR_IN", JS::Int32Value(2) },
461 : { "SVG_FECOMPOSITE_OPERATOR_OUT", JS::Int32Value(3) },
462 : { "SVG_FECOMPOSITE_OPERATOR_ATOP", JS::Int32Value(4) },
463 : { "SVG_FECOMPOSITE_OPERATOR_XOR", JS::Int32Value(5) },
464 : { "SVG_FECOMPOSITE_OPERATOR_ARITHMETIC", JS::Int32Value(6) },
465 : { 0, JS::UndefinedValue() }
466 : };
467 : #if defined(__clang__)
468 : #pragma clang diagnostic pop
469 : #endif
470 :
471 :
472 : // Can't be const because the pref-enabled boolean needs to be writable
473 : static Prefable<const ConstantSpec> sConstants[] = {
474 : { nullptr, &sConstants_specs[0] },
475 : { nullptr, nullptr }
476 : };
477 :
478 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
479 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
480 : static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
481 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
482 :
483 :
484 : static uint16_t sNativeProperties_sortedPropertyIndices[19];
485 : static PropertyInfo sNativeProperties_propertyInfos[19];
486 :
487 : static const NativePropertiesN<2> sNativeProperties = {
488 : false, 0,
489 : false, 0,
490 : false, 0,
491 : true, 0 /* sAttributes */,
492 : false, 0,
493 : false, 0,
494 : true, 1 /* sConstants */,
495 : -1,
496 : 19,
497 : sNativeProperties_sortedPropertyIndices,
498 : {
499 : { sAttributes, &sNativeProperties_propertyInfos[0] },
500 : { sConstants, &sNativeProperties_propertyInfos[12] }
501 : }
502 : };
503 : static_assert(19 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
504 : "We have a property info count that is oversized");
505 :
506 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
507 : {
508 : "Function",
509 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
510 : &sBoringInterfaceObjectClassClassOps,
511 : JS_NULL_CLASS_SPEC,
512 : JS_NULL_CLASS_EXT,
513 : &sInterfaceObjectClassObjectOps
514 : },
515 : eInterface,
516 : true,
517 : prototypes::id::SVGFECompositeElement,
518 : PrototypeTraits<prototypes::id::SVGFECompositeElement>::Depth,
519 : sNativePropertyHooks,
520 : "function SVGFECompositeElement() {\n [native code]\n}",
521 : SVGElementBinding::GetConstructorObject
522 : };
523 :
524 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
525 : {
526 : "SVGFECompositeElementPrototype",
527 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
528 : JS_NULL_CLASS_OPS,
529 : JS_NULL_CLASS_SPEC,
530 : JS_NULL_CLASS_EXT,
531 : JS_NULL_OBJECT_OPS
532 : },
533 : eInterfacePrototype,
534 : false,
535 : prototypes::id::SVGFECompositeElement,
536 : PrototypeTraits<prototypes::id::SVGFECompositeElement>::Depth,
537 : sNativePropertyHooks,
538 : "[object SVGFECompositeElementPrototype]",
539 : SVGElementBinding::GetProtoObject
540 : };
541 :
542 : JSObject*
543 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
544 : {
545 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
546 : }
547 :
548 : static const js::ClassOps sClassOps = {
549 : _addProperty, /* addProperty */
550 : nullptr, /* delProperty */
551 : nullptr, /* getProperty */
552 : nullptr, /* setProperty */
553 : nullptr, /* enumerate */
554 : nullptr, /* newEnumerate */
555 : nullptr, /* resolve */
556 : nullptr, /* mayResolve */
557 : _finalize, /* finalize */
558 : nullptr, /* call */
559 : nullptr, /* hasInstance */
560 : nullptr, /* construct */
561 : nullptr, /* trace */
562 : };
563 :
564 : static const js::ClassExtension sClassExtension = {
565 : nullptr, /* weakmapKeyDelegateOp */
566 : _objectMoved /* objectMovedOp */
567 : };
568 :
569 : static const DOMJSClass sClass = {
570 : { "SVGFECompositeElement",
571 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
572 : &sClassOps,
573 : JS_NULL_CLASS_SPEC,
574 : &sClassExtension,
575 : JS_NULL_OBJECT_OPS
576 : },
577 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFECompositeElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
578 : IsBaseOf<nsISupports, mozilla::dom::SVGFECompositeElement >::value,
579 : sNativePropertyHooks,
580 : FindAssociatedGlobalForNative<mozilla::dom::SVGFECompositeElement>::Get,
581 : GetProtoObjectHandle,
582 : GetCCParticipant<mozilla::dom::SVGFECompositeElement>::Get()
583 : };
584 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
585 : "Must have the right minimal number of reserved slots.");
586 : static_assert(1 >= 1,
587 : "Must have enough reserved slots.");
588 :
589 : const JSClass*
590 0 : GetJSClass()
591 : {
592 0 : return sClass.ToJSClass();
593 : }
594 :
595 : bool
596 0 : Wrap(JSContext* aCx, mozilla::dom::SVGFECompositeElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
597 : {
598 : MOZ_ASSERT(static_cast<mozilla::dom::SVGFECompositeElement*>(aObject) ==
599 : reinterpret_cast<mozilla::dom::SVGFECompositeElement*>(aObject),
600 : "Multiple inheritance for mozilla::dom::SVGFECompositeElement is broken.");
601 : MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
602 : reinterpret_cast<nsSVGElement*>(aObject),
603 : "Multiple inheritance for nsSVGElement is broken.");
604 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
605 : reinterpret_cast<mozilla::dom::Element*>(aObject),
606 : "Multiple inheritance for mozilla::dom::Element is broken.");
607 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
608 : reinterpret_cast<nsINode*>(aObject),
609 : "Multiple inheritance for nsINode is broken.");
610 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
611 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
612 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
613 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
614 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
615 0 : MOZ_ASSERT(!aCache->GetWrapper(),
616 : "You should probably not be using Wrap() directly; use "
617 : "GetOrCreateDOMReflector instead");
618 :
619 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
620 : "nsISupports must be on our primary inheritance chain");
621 :
622 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
623 0 : if (!global) {
624 0 : return false;
625 : }
626 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
627 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
628 :
629 : // That might have ended up wrapping us already, due to the wonders
630 : // of XBL. Check for that, and bail out as needed.
631 0 : aReflector.set(aCache->GetWrapper());
632 0 : if (aReflector) {
633 : #ifdef DEBUG
634 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
635 : #endif // DEBUG
636 0 : return true;
637 : }
638 :
639 0 : JSAutoCompartment ac(aCx, global);
640 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
641 0 : if (!canonicalProto) {
642 0 : return false;
643 : }
644 0 : JS::Rooted<JSObject*> proto(aCx);
645 0 : if (aGivenProto) {
646 0 : proto = aGivenProto;
647 : // Unfortunately, while aGivenProto was in the compartment of aCx
648 : // coming in, we changed compartments to that of "parent" so may need
649 : // to wrap the proto here.
650 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
651 0 : if (!JS_WrapObject(aCx, &proto)) {
652 0 : return false;
653 : }
654 : }
655 : } else {
656 0 : proto = canonicalProto;
657 : }
658 :
659 0 : BindingJSObjectCreator<mozilla::dom::SVGFECompositeElement> creator(aCx);
660 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
661 0 : if (!aReflector) {
662 0 : return false;
663 : }
664 :
665 0 : aCache->SetWrapper(aReflector);
666 0 : creator.InitializationSucceeded();
667 :
668 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
669 : aCache->GetWrapperPreserveColor() == aReflector);
670 : // If proto != canonicalProto, we have to preserve our wrapper;
671 : // otherwise we won't be able to properly recreate it later, since
672 : // we won't know what proto to use. Note that we don't check
673 : // aGivenProto here, since it's entirely possible (and even
674 : // somewhat common) to have a non-null aGivenProto which is the
675 : // same as canonicalProto.
676 0 : if (proto != canonicalProto) {
677 0 : PreserveWrapper(aObject);
678 : }
679 :
680 0 : return true;
681 : }
682 :
683 : const NativePropertyHooks sNativePropertyHooks[] = { {
684 : nullptr,
685 : nullptr,
686 : nullptr,
687 : { sNativeProperties.Upcast(), nullptr },
688 : prototypes::id::SVGFECompositeElement,
689 : constructors::id::SVGFECompositeElement,
690 : SVGElementBinding::sNativePropertyHooks,
691 : &DefaultXrayExpandoObjectClass
692 : } };
693 :
694 : void
695 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
696 : {
697 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
698 0 : if (!parentProto) {
699 0 : return;
700 : }
701 :
702 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
703 0 : if (!constructorProto) {
704 0 : return;
705 : }
706 :
707 : static bool sIdsInited = false;
708 0 : if (!sIdsInited && NS_IsMainThread()) {
709 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
710 0 : return;
711 : }
712 0 : sIdsInited = true;
713 : }
714 :
715 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFECompositeElement);
716 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFECompositeElement);
717 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
718 : &sPrototypeClass.mBase, protoCache,
719 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
720 : interfaceCache,
721 : sNativeProperties.Upcast(),
722 : nullptr,
723 : "SVGFECompositeElement", aDefineOnGlobal,
724 : nullptr,
725 0 : false);
726 : }
727 :
728 : JS::Handle<JSObject*>
729 0 : GetProtoObjectHandle(JSContext* aCx)
730 : {
731 : /* Get the interface prototype object for this class. This will create the
732 : object as needed. */
733 0 : bool aDefineOnGlobal = true;
734 :
735 : /* Make sure our global is sane. Hopefully we can remove this sometime */
736 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
737 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
738 0 : return nullptr;
739 : }
740 :
741 : /* Check to see whether the interface objects are already installed */
742 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
743 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGFECompositeElement)) {
744 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
745 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
746 : }
747 :
748 : /*
749 : * The object might _still_ be null, but that's OK.
750 : *
751 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
752 : * traced by TraceProtoAndIfaceCache() and its contents are never
753 : * changed after they have been set.
754 : *
755 : * Calling address() avoids the read read barrier that does gray
756 : * unmarking, but it's not possible for the object to be gray here.
757 : */
758 :
759 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGFECompositeElement);
760 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
761 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
762 : }
763 :
764 : JS::Handle<JSObject*>
765 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
766 : {
767 : /* Get the interface object for this class. This will create the object as
768 : needed. */
769 :
770 : /* Make sure our global is sane. Hopefully we can remove this sometime */
771 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
772 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
773 0 : return nullptr;
774 : }
775 :
776 : /* Check to see whether the interface objects are already installed */
777 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
778 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGFECompositeElement)) {
779 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
780 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
781 : }
782 :
783 : /*
784 : * The object might _still_ be null, but that's OK.
785 : *
786 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
787 : * traced by TraceProtoAndIfaceCache() and its contents are never
788 : * changed after they have been set.
789 : *
790 : * Calling address() avoids the read read barrier that does gray
791 : * unmarking, but it's not possible for the object to be gray here.
792 : */
793 :
794 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGFECompositeElement);
795 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
796 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
797 : }
798 :
799 : JSObject*
800 0 : GetConstructorObject(JSContext* aCx)
801 : {
802 0 : return GetConstructorObjectHandle(aCx);
803 : }
804 :
805 : } // namespace SVGFECompositeElementBinding
806 :
807 :
808 :
809 : } // namespace dom
810 : } // namespace mozilla
|