Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM HTMLFormControlsCollection.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_HTMLFormControlsCollectionBinding_h
4 : #define mozilla_dom_HTMLFormControlsCollectionBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/FakeString.h"
11 : #include "mozilla/dom/Nullable.h"
12 : #include "mozilla/dom/UnionMember.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class Element;
18 : class HTMLFormControlsCollection;
19 : struct HTMLFormControlsCollectionAtoms;
20 : struct NativePropertyHooks;
21 : class OwningRadioNodeListOrElement;
22 : class ProtoAndIfaceCache;
23 : class RadioNodeList;
24 :
25 : } // namespace dom
26 : } // namespace mozilla
27 :
28 : namespace mozilla {
29 : namespace dom {
30 :
31 : void
32 : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningRadioNodeListOrElement& aUnion, const char* aName, uint32_t aFlags = 0);
33 :
34 :
35 : void
36 : ImplCycleCollectionUnlink(OwningRadioNodeListOrElement& aUnion);
37 :
38 :
39 : class RadioNodeListOrElement
40 : {
41 : friend class RadioNodeListOrElementArgument;
42 : enum Type
43 : {
44 : eUninitialized,
45 : eRadioNodeList,
46 : eElement
47 : };
48 :
49 : union Value
50 : {
51 : UnionMember<NonNull<mozilla::dom::RadioNodeList> > mRadioNodeList;
52 : UnionMember<NonNull<mozilla::dom::Element> > mElement;
53 :
54 : };
55 :
56 : Type mType;
57 : Value mValue;
58 :
59 : RadioNodeListOrElement(const RadioNodeListOrElement&) = delete;
60 : RadioNodeListOrElement& operator=(const RadioNodeListOrElement&) = delete;
61 : public:
62 : explicit inline RadioNodeListOrElement()
63 : : mType(eUninitialized)
64 : {
65 : }
66 :
67 : inline ~RadioNodeListOrElement()
68 : {
69 : Uninit();
70 : }
71 :
72 : inline NonNull<mozilla::dom::RadioNodeList>&
73 : RawSetAsRadioNodeList()
74 : {
75 : if (mType == eRadioNodeList) {
76 : return mValue.mRadioNodeList.Value();
77 : }
78 : MOZ_ASSERT(mType == eUninitialized);
79 : mType = eRadioNodeList;
80 : return mValue.mRadioNodeList.SetValue();
81 : }
82 :
83 : inline NonNull<mozilla::dom::RadioNodeList>&
84 : SetAsRadioNodeList()
85 : {
86 : if (mType == eRadioNodeList) {
87 : return mValue.mRadioNodeList.Value();
88 : }
89 : Uninit();
90 : mType = eRadioNodeList;
91 : return mValue.mRadioNodeList.SetValue();
92 : }
93 :
94 : inline bool
95 : IsRadioNodeList() const
96 : {
97 : return mType == eRadioNodeList;
98 : }
99 :
100 : inline NonNull<mozilla::dom::RadioNodeList>&
101 : GetAsRadioNodeList()
102 : {
103 : MOZ_ASSERT(IsRadioNodeList(), "Wrong type!");
104 : return mValue.mRadioNodeList.Value();
105 : }
106 :
107 : inline mozilla::dom::RadioNodeList&
108 : GetAsRadioNodeList() const
109 : {
110 : MOZ_ASSERT(IsRadioNodeList(), "Wrong type!");
111 : return mValue.mRadioNodeList.Value();
112 : }
113 :
114 : inline NonNull<mozilla::dom::Element>&
115 : RawSetAsElement()
116 : {
117 : if (mType == eElement) {
118 : return mValue.mElement.Value();
119 : }
120 : MOZ_ASSERT(mType == eUninitialized);
121 : mType = eElement;
122 : return mValue.mElement.SetValue();
123 : }
124 :
125 : inline NonNull<mozilla::dom::Element>&
126 : SetAsElement()
127 : {
128 : if (mType == eElement) {
129 : return mValue.mElement.Value();
130 : }
131 : Uninit();
132 : mType = eElement;
133 : return mValue.mElement.SetValue();
134 : }
135 :
136 : inline bool
137 : IsElement() const
138 : {
139 : return mType == eElement;
140 : }
141 :
142 : inline NonNull<mozilla::dom::Element>&
143 : GetAsElement()
144 : {
145 : MOZ_ASSERT(IsElement(), "Wrong type!");
146 : return mValue.mElement.Value();
147 : }
148 :
149 : inline mozilla::dom::Element&
150 : GetAsElement() const
151 : {
152 : MOZ_ASSERT(IsElement(), "Wrong type!");
153 : return mValue.mElement.Value();
154 : }
155 :
156 : inline void
157 : Uninit()
158 : {
159 : switch (mType) {
160 : case eUninitialized: {
161 : break;
162 : }
163 : case eRadioNodeList: {
164 : DestroyRadioNodeList();
165 : break;
166 : }
167 : case eElement: {
168 : DestroyElement();
169 : break;
170 : }
171 : }
172 : }
173 :
174 : bool
175 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
176 :
177 : private:
178 : inline void
179 : DestroyRadioNodeList()
180 : {
181 : MOZ_ASSERT(IsRadioNodeList(), "Wrong type!");
182 : mValue.mRadioNodeList.Destroy();
183 : mType = eUninitialized;
184 : }
185 :
186 : inline void
187 : DestroyElement()
188 : {
189 : MOZ_ASSERT(IsElement(), "Wrong type!");
190 : mValue.mElement.Destroy();
191 : mType = eUninitialized;
192 : }
193 : };
194 :
195 :
196 : class OwningRadioNodeListOrElement : public AllOwningUnionBase
197 : {
198 : friend void ImplCycleCollectionUnlink(OwningRadioNodeListOrElement& aUnion);
199 : enum Type
200 : {
201 : eUninitialized,
202 : eRadioNodeList,
203 : eElement
204 : };
205 :
206 0 : union Value
207 : {
208 : UnionMember<OwningNonNull<mozilla::dom::RadioNodeList> > mRadioNodeList;
209 : UnionMember<OwningNonNull<mozilla::dom::Element> > mElement;
210 :
211 : };
212 :
213 : Type mType;
214 : Value mValue;
215 :
216 : public:
217 0 : explicit inline OwningRadioNodeListOrElement()
218 0 : : mType(eUninitialized)
219 : {
220 0 : }
221 :
222 : explicit inline OwningRadioNodeListOrElement(const OwningRadioNodeListOrElement& aOther)
223 : : mType(eUninitialized)
224 : {
225 : *this = aOther;
226 : }
227 :
228 0 : inline ~OwningRadioNodeListOrElement()
229 0 : {
230 0 : Uninit();
231 0 : }
232 :
233 : OwningNonNull<mozilla::dom::RadioNodeList>&
234 : RawSetAsRadioNodeList();
235 :
236 : OwningNonNull<mozilla::dom::RadioNodeList>&
237 : SetAsRadioNodeList();
238 :
239 : bool
240 : TrySetToRadioNodeList(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
241 :
242 : inline bool
243 0 : IsRadioNodeList() const
244 : {
245 0 : return mType == eRadioNodeList;
246 : }
247 :
248 : inline OwningNonNull<mozilla::dom::RadioNodeList>&
249 0 : GetAsRadioNodeList()
250 : {
251 0 : MOZ_ASSERT(IsRadioNodeList(), "Wrong type!");
252 0 : return mValue.mRadioNodeList.Value();
253 : }
254 :
255 : inline OwningNonNull<mozilla::dom::RadioNodeList> const &
256 0 : GetAsRadioNodeList() const
257 : {
258 0 : MOZ_ASSERT(IsRadioNodeList(), "Wrong type!");
259 0 : return mValue.mRadioNodeList.Value();
260 : }
261 :
262 : OwningNonNull<mozilla::dom::Element>&
263 : RawSetAsElement();
264 :
265 : OwningNonNull<mozilla::dom::Element>&
266 : SetAsElement();
267 :
268 : bool
269 : TrySetToElement(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
270 :
271 : inline bool
272 0 : IsElement() const
273 : {
274 0 : return mType == eElement;
275 : }
276 :
277 : inline OwningNonNull<mozilla::dom::Element>&
278 0 : GetAsElement()
279 : {
280 0 : MOZ_ASSERT(IsElement(), "Wrong type!");
281 0 : return mValue.mElement.Value();
282 : }
283 :
284 : inline OwningNonNull<mozilla::dom::Element> const &
285 0 : GetAsElement() const
286 : {
287 0 : MOZ_ASSERT(IsElement(), "Wrong type!");
288 0 : return mValue.mElement.Value();
289 : }
290 :
291 : void
292 : Uninit();
293 :
294 : bool
295 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
296 :
297 : void
298 : TraceUnion(JSTracer* trc);
299 :
300 : OwningRadioNodeListOrElement&
301 : operator=(const OwningRadioNodeListOrElement& aOther);
302 :
303 : private:
304 : void
305 : DestroyRadioNodeList();
306 :
307 : void
308 : DestroyElement();
309 : };
310 :
311 :
312 : namespace HTMLFormControlsCollectionBinding {
313 :
314 : typedef mozilla::dom::HTMLFormControlsCollection NativeType;
315 :
316 : JSObject*
317 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
318 :
319 : bool
320 : Wrap(JSContext* aCx, mozilla::dom::HTMLFormControlsCollection* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
321 :
322 : template <class T>
323 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
324 : {
325 0 : JS::Rooted<JSObject*> reflector(aCx);
326 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
327 : }
328 :
329 : // We declare this as an array so that retrieving a pointer to this
330 : // binding's property hooks only requires compile/link-time resolvable
331 : // address arithmetic. Declaring it as a pointer instead would require
332 : // doing a run-time load to fetch a pointer to this binding's property
333 : // hooks. And then structures which embedded a pointer to this structure
334 : // would require a run-time load for proper initialization, which would
335 : // then induce static constructors. Lots of static constructors.
336 : extern const NativePropertyHooks sNativePropertyHooks[];
337 :
338 : void
339 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
340 :
341 : JS::Handle<JSObject*>
342 : GetProtoObjectHandle(JSContext* aCx);
343 :
344 : JS::Handle<JSObject*>
345 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
346 :
347 : JSObject*
348 : GetConstructorObject(JSContext* aCx);
349 :
350 : } // namespace HTMLFormControlsCollectionBinding
351 :
352 :
353 :
354 : } // namespace dom
355 : } // namespace mozilla
356 :
357 : #endif // mozilla_dom_HTMLFormControlsCollectionBinding_h
|