Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM GeometryUtils.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_GeometryUtilsBinding_h
4 : #define mozilla_dom_GeometryUtilsBinding_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 : class nsIDocument;
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : struct BoxQuadOptionsAtoms;
20 : struct ConvertCoordinateOptionsAtoms;
21 : class Element;
22 : struct NativePropertyHooks;
23 : class OwningTextOrElementOrDocument;
24 : class ProtoAndIfaceCache;
25 : class Text;
26 : class TextOrElementOrDocument;
27 :
28 : } // namespace dom
29 : } // namespace mozilla
30 :
31 : namespace mozilla {
32 : namespace dom {
33 :
34 : enum class CSSBoxType : uint8_t {
35 : Margin,
36 : Border,
37 : Padding,
38 : Content,
39 : EndGuard_
40 : };
41 :
42 : namespace CSSBoxTypeValues {
43 : extern const EnumEntry strings[5];
44 : } // namespace CSSBoxTypeValues
45 :
46 : bool
47 : ToJSValue(JSContext* aCx, CSSBoxType aArgument, JS::MutableHandle<JS::Value> aValue);
48 :
49 :
50 : void
51 : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningTextOrElementOrDocument& aUnion, const char* aName, uint32_t aFlags = 0);
52 :
53 :
54 : void
55 : ImplCycleCollectionUnlink(OwningTextOrElementOrDocument& aUnion);
56 :
57 :
58 : struct ConvertCoordinateOptions : public DictionaryBase
59 : {
60 : MOZ_INIT_OUTSIDE_CTOR CSSBoxType mFromBox;
61 : MOZ_INIT_OUTSIDE_CTOR CSSBoxType mToBox;
62 :
63 : ConvertCoordinateOptions();
64 :
65 0 : explicit inline ConvertCoordinateOptions(const FastDictionaryInitializer& )
66 0 : {
67 : // Do nothing here; this is used by our "Fast" subclass
68 0 : }
69 :
70 : explicit inline ConvertCoordinateOptions(const ConvertCoordinateOptions& aOther)
71 : {
72 : *this = aOther;
73 : }
74 :
75 : bool
76 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
77 :
78 : bool
79 : Init(const nsAString& aJSON);
80 :
81 : bool
82 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
83 :
84 : bool
85 : ToJSON(nsAString& aJSON) const;
86 :
87 : void
88 : TraceDictionary(JSTracer* trc);
89 :
90 : ConvertCoordinateOptions&
91 : operator=(const ConvertCoordinateOptions& aOther);
92 :
93 : private:
94 : static bool
95 : InitIds(JSContext* cx, ConvertCoordinateOptionsAtoms* atomsCache);
96 : };
97 :
98 : namespace binding_detail {
99 : struct FastConvertCoordinateOptions : public ConvertCoordinateOptions
100 : {
101 0 : inline FastConvertCoordinateOptions()
102 0 : : ConvertCoordinateOptions(FastDictionaryInitializer())
103 : {
104 : // Doesn't matter what int we pass to the parent constructor
105 0 : }
106 : };
107 : } // namespace binding_detail
108 :
109 :
110 : class TextOrElementOrDocument
111 : {
112 : friend class TextOrElementOrDocumentArgument;
113 : enum Type
114 : {
115 : eUninitialized,
116 : eText,
117 : eElement,
118 : eDocument
119 : };
120 :
121 0 : union Value
122 : {
123 : UnionMember<NonNull<mozilla::dom::Text> > mText;
124 : UnionMember<NonNull<mozilla::dom::Element> > mElement;
125 : UnionMember<NonNull<nsIDocument> > mDocument;
126 :
127 : };
128 :
129 : Type mType;
130 : Value mValue;
131 :
132 : TextOrElementOrDocument(const TextOrElementOrDocument&) = delete;
133 : TextOrElementOrDocument& operator=(const TextOrElementOrDocument&) = delete;
134 : public:
135 0 : explicit inline TextOrElementOrDocument()
136 0 : : mType(eUninitialized)
137 : {
138 0 : }
139 :
140 0 : inline ~TextOrElementOrDocument()
141 0 : {
142 0 : Uninit();
143 0 : }
144 :
145 : inline NonNull<mozilla::dom::Text>&
146 : RawSetAsText()
147 : {
148 : if (mType == eText) {
149 : return mValue.mText.Value();
150 : }
151 : MOZ_ASSERT(mType == eUninitialized);
152 : mType = eText;
153 : return mValue.mText.SetValue();
154 : }
155 :
156 : inline NonNull<mozilla::dom::Text>&
157 : SetAsText()
158 : {
159 : if (mType == eText) {
160 : return mValue.mText.Value();
161 : }
162 : Uninit();
163 : mType = eText;
164 : return mValue.mText.SetValue();
165 : }
166 :
167 : inline bool
168 0 : IsText() const
169 : {
170 0 : return mType == eText;
171 : }
172 :
173 : inline NonNull<mozilla::dom::Text>&
174 : GetAsText()
175 : {
176 : MOZ_ASSERT(IsText(), "Wrong type!");
177 : return mValue.mText.Value();
178 : }
179 :
180 : inline mozilla::dom::Text&
181 0 : GetAsText() const
182 : {
183 0 : MOZ_ASSERT(IsText(), "Wrong type!");
184 0 : return mValue.mText.Value();
185 : }
186 :
187 : inline NonNull<mozilla::dom::Element>&
188 : RawSetAsElement()
189 : {
190 : if (mType == eElement) {
191 : return mValue.mElement.Value();
192 : }
193 : MOZ_ASSERT(mType == eUninitialized);
194 : mType = eElement;
195 : return mValue.mElement.SetValue();
196 : }
197 :
198 : inline NonNull<mozilla::dom::Element>&
199 : SetAsElement()
200 : {
201 : if (mType == eElement) {
202 : return mValue.mElement.Value();
203 : }
204 : Uninit();
205 : mType = eElement;
206 : return mValue.mElement.SetValue();
207 : }
208 :
209 : inline bool
210 0 : IsElement() const
211 : {
212 0 : return mType == eElement;
213 : }
214 :
215 : inline NonNull<mozilla::dom::Element>&
216 : GetAsElement()
217 : {
218 : MOZ_ASSERT(IsElement(), "Wrong type!");
219 : return mValue.mElement.Value();
220 : }
221 :
222 : inline mozilla::dom::Element&
223 0 : GetAsElement() const
224 : {
225 0 : MOZ_ASSERT(IsElement(), "Wrong type!");
226 0 : return mValue.mElement.Value();
227 : }
228 :
229 : inline NonNull<nsIDocument>&
230 : RawSetAsDocument()
231 : {
232 : if (mType == eDocument) {
233 : return mValue.mDocument.Value();
234 : }
235 : MOZ_ASSERT(mType == eUninitialized);
236 : mType = eDocument;
237 : return mValue.mDocument.SetValue();
238 : }
239 :
240 : inline NonNull<nsIDocument>&
241 : SetAsDocument()
242 : {
243 : if (mType == eDocument) {
244 : return mValue.mDocument.Value();
245 : }
246 : Uninit();
247 : mType = eDocument;
248 : return mValue.mDocument.SetValue();
249 : }
250 :
251 : inline bool
252 0 : IsDocument() const
253 : {
254 0 : return mType == eDocument;
255 : }
256 :
257 : inline NonNull<nsIDocument>&
258 : GetAsDocument()
259 : {
260 : MOZ_ASSERT(IsDocument(), "Wrong type!");
261 : return mValue.mDocument.Value();
262 : }
263 :
264 : inline nsIDocument&
265 0 : GetAsDocument() const
266 : {
267 0 : MOZ_ASSERT(IsDocument(), "Wrong type!");
268 0 : return mValue.mDocument.Value();
269 : }
270 :
271 : inline void
272 0 : Uninit()
273 : {
274 0 : switch (mType) {
275 : case eUninitialized: {
276 0 : break;
277 : }
278 : case eText: {
279 0 : DestroyText();
280 0 : break;
281 : }
282 : case eElement: {
283 0 : DestroyElement();
284 0 : break;
285 : }
286 : case eDocument: {
287 0 : DestroyDocument();
288 0 : break;
289 : }
290 : }
291 0 : }
292 :
293 : bool
294 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
295 :
296 : private:
297 : inline void
298 0 : DestroyText()
299 : {
300 0 : MOZ_ASSERT(IsText(), "Wrong type!");
301 0 : mValue.mText.Destroy();
302 0 : mType = eUninitialized;
303 0 : }
304 :
305 : inline void
306 0 : DestroyElement()
307 : {
308 0 : MOZ_ASSERT(IsElement(), "Wrong type!");
309 0 : mValue.mElement.Destroy();
310 0 : mType = eUninitialized;
311 0 : }
312 :
313 : inline void
314 0 : DestroyDocument()
315 : {
316 0 : MOZ_ASSERT(IsDocument(), "Wrong type!");
317 0 : mValue.mDocument.Destroy();
318 0 : mType = eUninitialized;
319 0 : }
320 : };
321 :
322 :
323 : class OwningTextOrElementOrDocument : public AllOwningUnionBase
324 : {
325 : friend void ImplCycleCollectionUnlink(OwningTextOrElementOrDocument& aUnion);
326 : enum Type
327 : {
328 : eUninitialized,
329 : eText,
330 : eElement,
331 : eDocument
332 : };
333 :
334 0 : union Value
335 : {
336 : UnionMember<OwningNonNull<mozilla::dom::Text> > mText;
337 : UnionMember<OwningNonNull<mozilla::dom::Element> > mElement;
338 : UnionMember<OwningNonNull<nsIDocument> > mDocument;
339 :
340 : };
341 :
342 : Type mType;
343 : Value mValue;
344 :
345 : public:
346 0 : explicit inline OwningTextOrElementOrDocument()
347 0 : : mType(eUninitialized)
348 : {
349 0 : }
350 :
351 0 : explicit inline OwningTextOrElementOrDocument(const OwningTextOrElementOrDocument& aOther)
352 0 : : mType(eUninitialized)
353 : {
354 0 : *this = aOther;
355 0 : }
356 :
357 0 : inline ~OwningTextOrElementOrDocument()
358 0 : {
359 0 : Uninit();
360 0 : }
361 :
362 : OwningNonNull<mozilla::dom::Text>&
363 : RawSetAsText();
364 :
365 : OwningNonNull<mozilla::dom::Text>&
366 : SetAsText();
367 :
368 : bool
369 : TrySetToText(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
370 :
371 : inline bool
372 0 : IsText() const
373 : {
374 0 : return mType == eText;
375 : }
376 :
377 : inline OwningNonNull<mozilla::dom::Text>&
378 0 : GetAsText()
379 : {
380 0 : MOZ_ASSERT(IsText(), "Wrong type!");
381 0 : return mValue.mText.Value();
382 : }
383 :
384 : inline OwningNonNull<mozilla::dom::Text> const &
385 0 : GetAsText() const
386 : {
387 0 : MOZ_ASSERT(IsText(), "Wrong type!");
388 0 : return mValue.mText.Value();
389 : }
390 :
391 : OwningNonNull<mozilla::dom::Element>&
392 : RawSetAsElement();
393 :
394 : OwningNonNull<mozilla::dom::Element>&
395 : SetAsElement();
396 :
397 : bool
398 : TrySetToElement(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
399 :
400 : inline bool
401 0 : IsElement() const
402 : {
403 0 : return mType == eElement;
404 : }
405 :
406 : inline OwningNonNull<mozilla::dom::Element>&
407 0 : GetAsElement()
408 : {
409 0 : MOZ_ASSERT(IsElement(), "Wrong type!");
410 0 : return mValue.mElement.Value();
411 : }
412 :
413 : inline OwningNonNull<mozilla::dom::Element> const &
414 0 : GetAsElement() const
415 : {
416 0 : MOZ_ASSERT(IsElement(), "Wrong type!");
417 0 : return mValue.mElement.Value();
418 : }
419 :
420 : OwningNonNull<nsIDocument>&
421 : RawSetAsDocument();
422 :
423 : OwningNonNull<nsIDocument>&
424 : SetAsDocument();
425 :
426 : bool
427 : TrySetToDocument(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
428 :
429 : inline bool
430 0 : IsDocument() const
431 : {
432 0 : return mType == eDocument;
433 : }
434 :
435 : inline OwningNonNull<nsIDocument>&
436 0 : GetAsDocument()
437 : {
438 0 : MOZ_ASSERT(IsDocument(), "Wrong type!");
439 0 : return mValue.mDocument.Value();
440 : }
441 :
442 : inline OwningNonNull<nsIDocument> const &
443 0 : GetAsDocument() const
444 : {
445 0 : MOZ_ASSERT(IsDocument(), "Wrong type!");
446 0 : return mValue.mDocument.Value();
447 : }
448 :
449 : void
450 : Uninit();
451 :
452 : bool
453 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
454 :
455 : void
456 : TraceUnion(JSTracer* trc);
457 :
458 : OwningTextOrElementOrDocument&
459 : operator=(const OwningTextOrElementOrDocument& aOther);
460 :
461 : private:
462 : void
463 : DestroyText();
464 :
465 : void
466 : DestroyElement();
467 :
468 : void
469 : DestroyDocument();
470 : };
471 :
472 :
473 0 : struct BoxQuadOptions : public DictionaryBase
474 : {
475 : MOZ_INIT_OUTSIDE_CTOR CSSBoxType mBox;
476 : MOZ_INIT_OUTSIDE_CTOR Optional<OwningTextOrElementOrDocument> mRelativeTo;
477 :
478 : BoxQuadOptions();
479 :
480 0 : explicit inline BoxQuadOptions(const FastDictionaryInitializer& )
481 0 : {
482 : // Do nothing here; this is used by our "Fast" subclass
483 0 : }
484 :
485 : explicit inline BoxQuadOptions(const BoxQuadOptions& aOther)
486 : {
487 : *this = aOther;
488 : }
489 :
490 : bool
491 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
492 :
493 : bool
494 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
495 :
496 : void
497 : TraceDictionary(JSTracer* trc);
498 :
499 : BoxQuadOptions&
500 : operator=(const BoxQuadOptions& aOther);
501 :
502 : private:
503 : static bool
504 : InitIds(JSContext* cx, BoxQuadOptionsAtoms* atomsCache);
505 : };
506 :
507 : namespace binding_detail {
508 0 : struct FastBoxQuadOptions : public BoxQuadOptions
509 : {
510 0 : inline FastBoxQuadOptions()
511 0 : : BoxQuadOptions(FastDictionaryInitializer())
512 : {
513 : // Doesn't matter what int we pass to the parent constructor
514 0 : }
515 : };
516 : } // namespace binding_detail
517 :
518 :
519 : } // namespace dom
520 : } // namespace mozilla
521 :
522 : #endif // mozilla_dom_GeometryUtilsBinding_h
|