Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGFEColorMatrixElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "DOMSVGAnimatedNumberList.h"
4 : #include "SVGElementBinding.h"
5 : #include "SVGFEColorMatrixElementBinding.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/SVGAnimatedEnumeration.h"
12 : #include "mozilla/dom/SVGAnimatedLength.h"
13 : #include "mozilla/dom/SVGAnimatedString.h"
14 : #include "mozilla/dom/SVGFEColorMatrixElement.h"
15 : #include "mozilla/dom/XrayExpandoClass.h"
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : namespace SVGFEColorMatrixElementBinding {
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::SVGFEColorMatrixElement* 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::SVGFEColorMatrixElement },
40 : { PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::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_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEColorMatrixElement* self, JSJitGetterCallArgs args)
57 : {
58 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->Type()));
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 type_getterinfo = {
68 : { (JSJitGetterOp)get_type },
69 : { prototypes::id::SVGFEColorMatrixElement },
70 : { PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::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_values(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEColorMatrixElement* self, JSJitGetterCallArgs args)
87 : {
88 0 : auto result(StrongOrRawPtr<mozilla::DOMSVGAnimatedNumberList>(self->Values()));
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 values_getterinfo = {
98 : { (JSJitGetterOp)get_values },
99 : { prototypes::id::SVGFEColorMatrixElement },
100 : { PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::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_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEColorMatrixElement* self, JSJitGetterCallArgs args)
117 : {
118 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
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 x_getterinfo = {
128 : { (JSJitGetterOp)get_x },
129 : { prototypes::id::SVGFEColorMatrixElement },
130 : { PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::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_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEColorMatrixElement* self, JSJitGetterCallArgs args)
147 : {
148 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
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 y_getterinfo = {
158 : { (JSJitGetterOp)get_y },
159 : { prototypes::id::SVGFEColorMatrixElement },
160 : { PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::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_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEColorMatrixElement* self, JSJitGetterCallArgs args)
177 : {
178 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
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 width_getterinfo = {
188 : { (JSJitGetterOp)get_width },
189 : { prototypes::id::SVGFEColorMatrixElement },
190 : { PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::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_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEColorMatrixElement* self, JSJitGetterCallArgs args)
207 : {
208 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
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 height_getterinfo = {
218 : { (JSJitGetterOp)get_height },
219 : { prototypes::id::SVGFEColorMatrixElement },
220 : { PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::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_result(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGFEColorMatrixElement* self, JSJitGetterCallArgs args)
237 : {
238 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Result()));
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 result_getterinfo = {
248 : { (JSJitGetterOp)get_result },
249 : { prototypes::id::SVGFEColorMatrixElement },
250 : { PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::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 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
267 : {
268 0 : mozilla::dom::SVGFEColorMatrixElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEColorMatrixElement>(obj);
269 : // We don't want to preserve if we don't have a wrapper, and we
270 : // obviously can't preserve if we're not initialized.
271 0 : if (self && self->GetWrapperPreserveColor()) {
272 0 : PreserveWrapper(self);
273 : }
274 0 : return true;
275 : }
276 :
277 : static void
278 0 : _finalize(js::FreeOp* fop, JSObject* obj)
279 : {
280 0 : mozilla::dom::SVGFEColorMatrixElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEColorMatrixElement>(obj);
281 0 : if (self) {
282 0 : ClearWrapper(self, self, obj);
283 0 : AddForDeferredFinalization<mozilla::dom::SVGFEColorMatrixElement>(self);
284 : }
285 0 : }
286 :
287 : static void
288 0 : _objectMoved(JSObject* obj, const JSObject* old)
289 : {
290 0 : mozilla::dom::SVGFEColorMatrixElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGFEColorMatrixElement>(obj);
291 0 : if (self) {
292 0 : UpdateWrapper(self, self, obj, old);
293 : }
294 0 : }
295 :
296 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
297 : #if defined(__clang__)
298 : #pragma clang diagnostic push
299 : #pragma clang diagnostic ignored "-Wmissing-braces"
300 : #endif
301 : static const JSPropertySpec sAttributes_specs[] = {
302 : { "in1", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &in1_getterinfo, nullptr, nullptr },
303 : { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, nullptr, nullptr },
304 : { "values", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &values_getterinfo, nullptr, nullptr },
305 : { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
306 : { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
307 : { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
308 : { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
309 : { "result", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &result_getterinfo, nullptr, nullptr },
310 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
311 : };
312 : #if defined(__clang__)
313 : #pragma clang diagnostic pop
314 : #endif
315 :
316 :
317 : // Can't be const because the pref-enabled boolean needs to be writable
318 : static Prefable<const JSPropertySpec> sAttributes[] = {
319 : { nullptr, &sAttributes_specs[0] },
320 : { nullptr, nullptr }
321 : };
322 :
323 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
324 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
325 : static_assert(8 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
326 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
327 :
328 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
329 : #if defined(__clang__)
330 : #pragma clang diagnostic push
331 : #pragma clang diagnostic ignored "-Wmissing-braces"
332 : #endif
333 : static const ConstantSpec sConstants_specs[] = {
334 : { "SVG_FECOLORMATRIX_TYPE_UNKNOWN", JS::Int32Value(0) },
335 : { "SVG_FECOLORMATRIX_TYPE_MATRIX", JS::Int32Value(1) },
336 : { "SVG_FECOLORMATRIX_TYPE_SATURATE", JS::Int32Value(2) },
337 : { "SVG_FECOLORMATRIX_TYPE_HUEROTATE", JS::Int32Value(3) },
338 : { "SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA", JS::Int32Value(4) },
339 : { 0, JS::UndefinedValue() }
340 : };
341 : #if defined(__clang__)
342 : #pragma clang diagnostic pop
343 : #endif
344 :
345 :
346 : // Can't be const because the pref-enabled boolean needs to be writable
347 : static Prefable<const ConstantSpec> sConstants[] = {
348 : { nullptr, &sConstants_specs[0] },
349 : { nullptr, nullptr }
350 : };
351 :
352 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
353 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
354 : static_assert(5 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
355 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
356 :
357 :
358 : static uint16_t sNativeProperties_sortedPropertyIndices[13];
359 : static PropertyInfo sNativeProperties_propertyInfos[13];
360 :
361 : static const NativePropertiesN<2> sNativeProperties = {
362 : false, 0,
363 : false, 0,
364 : false, 0,
365 : true, 0 /* sAttributes */,
366 : false, 0,
367 : false, 0,
368 : true, 1 /* sConstants */,
369 : -1,
370 : 13,
371 : sNativeProperties_sortedPropertyIndices,
372 : {
373 : { sAttributes, &sNativeProperties_propertyInfos[0] },
374 : { sConstants, &sNativeProperties_propertyInfos[8] }
375 : }
376 : };
377 : static_assert(13 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
378 : "We have a property info count that is oversized");
379 :
380 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
381 : {
382 : "Function",
383 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
384 : &sBoringInterfaceObjectClassClassOps,
385 : JS_NULL_CLASS_SPEC,
386 : JS_NULL_CLASS_EXT,
387 : &sInterfaceObjectClassObjectOps
388 : },
389 : eInterface,
390 : true,
391 : prototypes::id::SVGFEColorMatrixElement,
392 : PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::Depth,
393 : sNativePropertyHooks,
394 : "function SVGFEColorMatrixElement() {\n [native code]\n}",
395 : SVGElementBinding::GetConstructorObject
396 : };
397 :
398 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
399 : {
400 : "SVGFEColorMatrixElementPrototype",
401 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
402 : JS_NULL_CLASS_OPS,
403 : JS_NULL_CLASS_SPEC,
404 : JS_NULL_CLASS_EXT,
405 : JS_NULL_OBJECT_OPS
406 : },
407 : eInterfacePrototype,
408 : false,
409 : prototypes::id::SVGFEColorMatrixElement,
410 : PrototypeTraits<prototypes::id::SVGFEColorMatrixElement>::Depth,
411 : sNativePropertyHooks,
412 : "[object SVGFEColorMatrixElementPrototype]",
413 : SVGElementBinding::GetProtoObject
414 : };
415 :
416 : JSObject*
417 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
418 : {
419 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
420 : }
421 :
422 : static const js::ClassOps sClassOps = {
423 : _addProperty, /* addProperty */
424 : nullptr, /* delProperty */
425 : nullptr, /* getProperty */
426 : nullptr, /* setProperty */
427 : nullptr, /* enumerate */
428 : nullptr, /* newEnumerate */
429 : nullptr, /* resolve */
430 : nullptr, /* mayResolve */
431 : _finalize, /* finalize */
432 : nullptr, /* call */
433 : nullptr, /* hasInstance */
434 : nullptr, /* construct */
435 : nullptr, /* trace */
436 : };
437 :
438 : static const js::ClassExtension sClassExtension = {
439 : nullptr, /* weakmapKeyDelegateOp */
440 : _objectMoved /* objectMovedOp */
441 : };
442 :
443 : static const DOMJSClass sClass = {
444 : { "SVGFEColorMatrixElement",
445 : JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
446 : &sClassOps,
447 : JS_NULL_CLASS_SPEC,
448 : &sClassExtension,
449 : JS_NULL_OBJECT_OPS
450 : },
451 : { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGFEColorMatrixElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
452 : IsBaseOf<nsISupports, mozilla::dom::SVGFEColorMatrixElement >::value,
453 : sNativePropertyHooks,
454 : FindAssociatedGlobalForNative<mozilla::dom::SVGFEColorMatrixElement>::Get,
455 : GetProtoObjectHandle,
456 : GetCCParticipant<mozilla::dom::SVGFEColorMatrixElement>::Get()
457 : };
458 : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
459 : "Must have the right minimal number of reserved slots.");
460 : static_assert(1 >= 1,
461 : "Must have enough reserved slots.");
462 :
463 : const JSClass*
464 0 : GetJSClass()
465 : {
466 0 : return sClass.ToJSClass();
467 : }
468 :
469 : bool
470 0 : Wrap(JSContext* aCx, mozilla::dom::SVGFEColorMatrixElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
471 : {
472 : MOZ_ASSERT(static_cast<mozilla::dom::SVGFEColorMatrixElement*>(aObject) ==
473 : reinterpret_cast<mozilla::dom::SVGFEColorMatrixElement*>(aObject),
474 : "Multiple inheritance for mozilla::dom::SVGFEColorMatrixElement is broken.");
475 : MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
476 : reinterpret_cast<nsSVGElement*>(aObject),
477 : "Multiple inheritance for nsSVGElement is broken.");
478 : MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
479 : reinterpret_cast<mozilla::dom::Element*>(aObject),
480 : "Multiple inheritance for mozilla::dom::Element is broken.");
481 : MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
482 : reinterpret_cast<nsINode*>(aObject),
483 : "Multiple inheritance for nsINode is broken.");
484 : MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
485 : reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
486 : "Multiple inheritance for mozilla::dom::EventTarget is broken.");
487 0 : MOZ_ASSERT(ToSupportsIsCorrect(aObject));
488 0 : MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
489 0 : MOZ_ASSERT(!aCache->GetWrapper(),
490 : "You should probably not be using Wrap() directly; use "
491 : "GetOrCreateDOMReflector instead");
492 :
493 0 : MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
494 : "nsISupports must be on our primary inheritance chain");
495 :
496 0 : JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
497 0 : if (!global) {
498 0 : return false;
499 : }
500 0 : MOZ_ASSERT(JS_IsGlobalObject(global));
501 0 : MOZ_ASSERT(JS::ObjectIsNotGray(global));
502 :
503 : // That might have ended up wrapping us already, due to the wonders
504 : // of XBL. Check for that, and bail out as needed.
505 0 : aReflector.set(aCache->GetWrapper());
506 0 : if (aReflector) {
507 : #ifdef DEBUG
508 0 : binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
509 : #endif // DEBUG
510 0 : return true;
511 : }
512 :
513 0 : JSAutoCompartment ac(aCx, global);
514 0 : JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
515 0 : if (!canonicalProto) {
516 0 : return false;
517 : }
518 0 : JS::Rooted<JSObject*> proto(aCx);
519 0 : if (aGivenProto) {
520 0 : proto = aGivenProto;
521 : // Unfortunately, while aGivenProto was in the compartment of aCx
522 : // coming in, we changed compartments to that of "parent" so may need
523 : // to wrap the proto here.
524 0 : if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
525 0 : if (!JS_WrapObject(aCx, &proto)) {
526 0 : return false;
527 : }
528 : }
529 : } else {
530 0 : proto = canonicalProto;
531 : }
532 :
533 0 : BindingJSObjectCreator<mozilla::dom::SVGFEColorMatrixElement> creator(aCx);
534 0 : creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
535 0 : if (!aReflector) {
536 0 : return false;
537 : }
538 :
539 0 : aCache->SetWrapper(aReflector);
540 0 : creator.InitializationSucceeded();
541 :
542 0 : MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
543 : aCache->GetWrapperPreserveColor() == aReflector);
544 : // If proto != canonicalProto, we have to preserve our wrapper;
545 : // otherwise we won't be able to properly recreate it later, since
546 : // we won't know what proto to use. Note that we don't check
547 : // aGivenProto here, since it's entirely possible (and even
548 : // somewhat common) to have a non-null aGivenProto which is the
549 : // same as canonicalProto.
550 0 : if (proto != canonicalProto) {
551 0 : PreserveWrapper(aObject);
552 : }
553 :
554 0 : return true;
555 : }
556 :
557 : const NativePropertyHooks sNativePropertyHooks[] = { {
558 : nullptr,
559 : nullptr,
560 : nullptr,
561 : { sNativeProperties.Upcast(), nullptr },
562 : prototypes::id::SVGFEColorMatrixElement,
563 : constructors::id::SVGFEColorMatrixElement,
564 : SVGElementBinding::sNativePropertyHooks,
565 : &DefaultXrayExpandoObjectClass
566 : } };
567 :
568 : void
569 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
570 : {
571 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
572 0 : if (!parentProto) {
573 0 : return;
574 : }
575 :
576 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
577 0 : if (!constructorProto) {
578 0 : return;
579 : }
580 :
581 : static bool sIdsInited = false;
582 0 : if (!sIdsInited && NS_IsMainThread()) {
583 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
584 0 : return;
585 : }
586 0 : sIdsInited = true;
587 : }
588 :
589 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGFEColorMatrixElement);
590 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGFEColorMatrixElement);
591 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
592 : &sPrototypeClass.mBase, protoCache,
593 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
594 : interfaceCache,
595 : sNativeProperties.Upcast(),
596 : nullptr,
597 : "SVGFEColorMatrixElement", aDefineOnGlobal,
598 : nullptr,
599 0 : false);
600 : }
601 :
602 : JS::Handle<JSObject*>
603 0 : GetProtoObjectHandle(JSContext* aCx)
604 : {
605 : /* Get the interface prototype object for this class. This will create the
606 : object as needed. */
607 0 : bool aDefineOnGlobal = true;
608 :
609 : /* Make sure our global is sane. Hopefully we can remove this sometime */
610 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
611 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
612 0 : return nullptr;
613 : }
614 :
615 : /* Check to see whether the interface objects are already installed */
616 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
617 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGFEColorMatrixElement)) {
618 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
619 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
620 : }
621 :
622 : /*
623 : * The object might _still_ be null, but that's OK.
624 : *
625 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
626 : * traced by TraceProtoAndIfaceCache() and its contents are never
627 : * changed after they have been set.
628 : *
629 : * Calling address() avoids the read read barrier that does gray
630 : * unmarking, but it's not possible for the object to be gray here.
631 : */
632 :
633 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGFEColorMatrixElement);
634 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
635 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
636 : }
637 :
638 : JS::Handle<JSObject*>
639 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
640 : {
641 : /* Get the interface object for this class. This will create the object as
642 : needed. */
643 :
644 : /* Make sure our global is sane. Hopefully we can remove this sometime */
645 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
646 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
647 0 : return nullptr;
648 : }
649 :
650 : /* Check to see whether the interface objects are already installed */
651 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
652 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGFEColorMatrixElement)) {
653 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
654 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
655 : }
656 :
657 : /*
658 : * The object might _still_ be null, but that's OK.
659 : *
660 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
661 : * traced by TraceProtoAndIfaceCache() and its contents are never
662 : * changed after they have been set.
663 : *
664 : * Calling address() avoids the read read barrier that does gray
665 : * unmarking, but it's not possible for the object to be gray here.
666 : */
667 :
668 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGFEColorMatrixElement);
669 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
670 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
671 : }
672 :
673 : JSObject*
674 0 : GetConstructorObject(JSContext* aCx)
675 : {
676 0 : return GetConstructorObjectHandle(aCx);
677 : }
678 :
679 : } // namespace SVGFEColorMatrixElementBinding
680 :
681 :
682 :
683 : } // namespace dom
684 : } // namespace mozilla
|