Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGZoomAndPan.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "SVGZoomAndPanBinding.h"
4 : #include "WrapperFactory.h"
5 : #include "mozilla/OwningNonNull.h"
6 : #include "mozilla/dom/BindingUtils.h"
7 : #include "mozilla/dom/DOMJSClass.h"
8 : #include "mozilla/dom/NonRefcountedDOMObject.h"
9 : #include "mozilla/dom/PrimitiveConversions.h"
10 : #include "mozilla/dom/XrayExpandoClass.h"
11 :
12 : namespace mozilla {
13 : namespace dom {
14 :
15 : namespace SVGZoomAndPanBinding {
16 :
17 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
18 : #if defined(__clang__)
19 : #pragma clang diagnostic push
20 : #pragma clang diagnostic ignored "-Wmissing-braces"
21 : #endif
22 : static const ConstantSpec sConstants_specs[] = {
23 : { "SVG_ZOOMANDPAN_UNKNOWN", JS::Int32Value(0) },
24 : { "SVG_ZOOMANDPAN_DISABLE", JS::Int32Value(1) },
25 : { "SVG_ZOOMANDPAN_MAGNIFY", JS::Int32Value(2) },
26 : { 0, JS::UndefinedValue() }
27 : };
28 : #if defined(__clang__)
29 : #pragma clang diagnostic pop
30 : #endif
31 :
32 :
33 : // Can't be const because the pref-enabled boolean needs to be writable
34 : static Prefable<const ConstantSpec> sConstants[] = {
35 : { nullptr, &sConstants_specs[0] },
36 : { nullptr, nullptr }
37 : };
38 :
39 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
40 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
41 : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
42 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
43 :
44 :
45 : static uint16_t sNativeProperties_sortedPropertyIndices[3];
46 : static PropertyInfo sNativeProperties_propertyInfos[3];
47 :
48 : static const NativePropertiesN<1> sNativeProperties = {
49 : false, 0,
50 : false, 0,
51 : false, 0,
52 : false, 0,
53 : false, 0,
54 : false, 0,
55 : true, 0 /* sConstants */,
56 : -1,
57 : 3,
58 : sNativeProperties_sortedPropertyIndices,
59 : {
60 : { sConstants, &sNativeProperties_propertyInfos[0] }
61 : }
62 : };
63 : static_assert(3 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
64 : "We have a property info count that is oversized");
65 :
66 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
67 : {
68 : "Function",
69 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
70 : &sBoringInterfaceObjectClassClassOps,
71 : JS_NULL_CLASS_SPEC,
72 : JS_NULL_CLASS_EXT,
73 : &sInterfaceObjectClassObjectOps
74 : },
75 : eInterface,
76 : false,
77 : prototypes::id::_ID_Count,
78 : 0,
79 : sNativePropertyHooks,
80 : "function SVGZoomAndPan() {\n [native code]\n}",
81 : JS::GetRealmFunctionPrototype
82 : };
83 :
84 : JSObject*
85 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
86 : {
87 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
88 : }
89 :
90 : const NativePropertyHooks sNativePropertyHooks[] = { {
91 : nullptr,
92 : nullptr,
93 : nullptr,
94 : { sNativeProperties.Upcast(), nullptr },
95 : prototypes::id::_ID_Count,
96 : constructors::id::SVGZoomAndPan,
97 : nullptr,
98 : &DefaultXrayExpandoObjectClass
99 : } };
100 :
101 : void
102 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
103 : {
104 0 : JS::Rooted<JSObject*> constructorProto(aCx, JS::GetRealmFunctionPrototype(aCx));
105 0 : if (!constructorProto) {
106 0 : return;
107 : }
108 :
109 : static bool sIdsInited = false;
110 0 : if (!sIdsInited && NS_IsMainThread()) {
111 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
112 0 : return;
113 : }
114 0 : sIdsInited = true;
115 : }
116 :
117 0 : JS::Heap<JSObject*>* protoCache = nullptr;
118 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGZoomAndPan);
119 0 : dom::CreateInterfaceObjects(aCx, aGlobal, nullptr,
120 : nullptr, protoCache,
121 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
122 : interfaceCache,
123 : sNativeProperties.Upcast(),
124 : nullptr,
125 : "SVGZoomAndPan", aDefineOnGlobal,
126 : nullptr,
127 0 : false);
128 : }
129 :
130 : JS::Handle<JSObject*>
131 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
132 : {
133 : /* Get the interface object for this class. This will create the object as
134 : needed. */
135 :
136 : /* Make sure our global is sane. Hopefully we can remove this sometime */
137 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
138 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
139 0 : return nullptr;
140 : }
141 :
142 : /* Check to see whether the interface objects are already installed */
143 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
144 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGZoomAndPan)) {
145 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
146 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
147 : }
148 :
149 : /*
150 : * The object might _still_ be null, but that's OK.
151 : *
152 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
153 : * traced by TraceProtoAndIfaceCache() and its contents are never
154 : * changed after they have been set.
155 : *
156 : * Calling address() avoids the read read barrier that does gray
157 : * unmarking, but it's not possible for the object to be gray here.
158 : */
159 :
160 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGZoomAndPan);
161 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
162 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
163 : }
164 :
165 : JSObject*
166 0 : GetConstructorObject(JSContext* aCx)
167 : {
168 0 : return GetConstructorObjectHandle(aCx);
169 : }
170 :
171 : } // namespace SVGZoomAndPanBinding
172 :
173 :
174 :
175 : } // namespace dom
176 : } // namespace mozilla
|