Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM VTTCue.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_VTTCueBinding_h
4 : #define mozilla_dom_VTTCueBinding_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 : struct NativePropertyHooks;
18 : class ProtoAndIfaceCache;
19 : class TextTrackCue;
20 : struct TextTrackCueAtoms;
21 :
22 : } // namespace dom
23 : } // namespace mozilla
24 :
25 : namespace mozilla {
26 : namespace dom {
27 :
28 : enum class AutoKeyword : uint8_t {
29 : Auto,
30 : EndGuard_
31 : };
32 :
33 : namespace AutoKeywordValues {
34 : extern const EnumEntry strings[2];
35 : } // namespace AutoKeywordValues
36 :
37 : bool
38 : ToJSValue(JSContext* aCx, AutoKeyword aArgument, JS::MutableHandle<JS::Value> aValue);
39 :
40 :
41 : enum class LineAlignSetting : uint8_t {
42 : Start,
43 : Center,
44 : End,
45 : EndGuard_
46 : };
47 :
48 : namespace LineAlignSettingValues {
49 : extern const EnumEntry strings[4];
50 : } // namespace LineAlignSettingValues
51 :
52 : bool
53 : ToJSValue(JSContext* aCx, LineAlignSetting aArgument, JS::MutableHandle<JS::Value> aValue);
54 :
55 :
56 : enum class PositionAlignSetting : uint8_t {
57 : Line_left,
58 : Center,
59 : Line_right,
60 : Auto,
61 : EndGuard_
62 : };
63 :
64 : namespace PositionAlignSettingValues {
65 : extern const EnumEntry strings[5];
66 : } // namespace PositionAlignSettingValues
67 :
68 : bool
69 : ToJSValue(JSContext* aCx, PositionAlignSetting aArgument, JS::MutableHandle<JS::Value> aValue);
70 :
71 :
72 : enum class AlignSetting : uint8_t {
73 : Start,
74 : Center,
75 : End,
76 : Left,
77 : Right,
78 : EndGuard_
79 : };
80 :
81 : namespace AlignSettingValues {
82 : extern const EnumEntry strings[6];
83 : } // namespace AlignSettingValues
84 :
85 : bool
86 : ToJSValue(JSContext* aCx, AlignSetting aArgument, JS::MutableHandle<JS::Value> aValue);
87 :
88 :
89 : enum class DirectionSetting : uint8_t {
90 : _empty,
91 : Rl,
92 : Lr,
93 : EndGuard_
94 : };
95 :
96 : namespace DirectionSettingValues {
97 : extern const EnumEntry strings[4];
98 : } // namespace DirectionSettingValues
99 :
100 : bool
101 : ToJSValue(JSContext* aCx, DirectionSetting aArgument, JS::MutableHandle<JS::Value> aValue);
102 :
103 :
104 : class DoubleOrAutoKeyword
105 : {
106 : friend class DoubleOrAutoKeywordArgument;
107 : enum Type
108 : {
109 : eUninitialized,
110 : eDouble,
111 : eAutoKeyword
112 : };
113 :
114 0 : union Value
115 : {
116 : UnionMember<double > mDouble;
117 : UnionMember<AutoKeyword > mAutoKeyword;
118 :
119 : };
120 :
121 : Type mType;
122 : Value mValue;
123 :
124 : DoubleOrAutoKeyword(const DoubleOrAutoKeyword&) = delete;
125 : DoubleOrAutoKeyword& operator=(const DoubleOrAutoKeyword&) = delete;
126 : public:
127 0 : explicit inline DoubleOrAutoKeyword()
128 0 : : mType(eUninitialized)
129 : {
130 0 : }
131 :
132 0 : inline ~DoubleOrAutoKeyword()
133 0 : {
134 0 : Uninit();
135 0 : }
136 :
137 : inline double&
138 : RawSetAsDouble()
139 : {
140 : if (mType == eDouble) {
141 : return mValue.mDouble.Value();
142 : }
143 : MOZ_ASSERT(mType == eUninitialized);
144 : mType = eDouble;
145 : return mValue.mDouble.SetValue();
146 : }
147 :
148 : inline double&
149 : SetAsDouble()
150 : {
151 : if (mType == eDouble) {
152 : return mValue.mDouble.Value();
153 : }
154 : Uninit();
155 : mType = eDouble;
156 : return mValue.mDouble.SetValue();
157 : }
158 :
159 : inline bool
160 0 : IsDouble() const
161 : {
162 0 : return mType == eDouble;
163 : }
164 :
165 : inline double&
166 : GetAsDouble()
167 : {
168 : MOZ_ASSERT(IsDouble(), "Wrong type!");
169 : return mValue.mDouble.Value();
170 : }
171 :
172 : inline double
173 0 : GetAsDouble() const
174 : {
175 0 : MOZ_ASSERT(IsDouble(), "Wrong type!");
176 0 : return mValue.mDouble.Value();
177 : }
178 :
179 : inline AutoKeyword&
180 : RawSetAsAutoKeyword()
181 : {
182 : if (mType == eAutoKeyword) {
183 : return mValue.mAutoKeyword.Value();
184 : }
185 : MOZ_ASSERT(mType == eUninitialized);
186 : mType = eAutoKeyword;
187 : return mValue.mAutoKeyword.SetValue();
188 : }
189 :
190 : inline AutoKeyword&
191 : SetAsAutoKeyword()
192 : {
193 : if (mType == eAutoKeyword) {
194 : return mValue.mAutoKeyword.Value();
195 : }
196 : Uninit();
197 : mType = eAutoKeyword;
198 : return mValue.mAutoKeyword.SetValue();
199 : }
200 :
201 : inline bool
202 0 : IsAutoKeyword() const
203 : {
204 0 : return mType == eAutoKeyword;
205 : }
206 :
207 : inline AutoKeyword&
208 : GetAsAutoKeyword()
209 : {
210 : MOZ_ASSERT(IsAutoKeyword(), "Wrong type!");
211 : return mValue.mAutoKeyword.Value();
212 : }
213 :
214 : inline AutoKeyword
215 : GetAsAutoKeyword() const
216 : {
217 : MOZ_ASSERT(IsAutoKeyword(), "Wrong type!");
218 : return mValue.mAutoKeyword.Value();
219 : }
220 :
221 : inline void
222 0 : Uninit()
223 : {
224 0 : switch (mType) {
225 : case eUninitialized: {
226 0 : break;
227 : }
228 : case eDouble: {
229 0 : DestroyDouble();
230 0 : break;
231 : }
232 : case eAutoKeyword: {
233 0 : DestroyAutoKeyword();
234 0 : break;
235 : }
236 : }
237 0 : }
238 :
239 : bool
240 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
241 :
242 : private:
243 : inline void
244 0 : DestroyDouble()
245 : {
246 0 : MOZ_ASSERT(IsDouble(), "Wrong type!");
247 0 : mValue.mDouble.Destroy();
248 0 : mType = eUninitialized;
249 0 : }
250 :
251 : inline void
252 0 : DestroyAutoKeyword()
253 : {
254 0 : MOZ_ASSERT(IsAutoKeyword(), "Wrong type!");
255 0 : mValue.mAutoKeyword.Destroy();
256 0 : mType = eUninitialized;
257 0 : }
258 : };
259 :
260 :
261 : class OwningDoubleOrAutoKeyword : public AllOwningUnionBase
262 : {
263 : friend void ImplCycleCollectionUnlink(OwningDoubleOrAutoKeyword& aUnion);
264 : enum Type
265 : {
266 : eUninitialized,
267 : eDouble,
268 : eAutoKeyword
269 : };
270 :
271 0 : union Value
272 : {
273 : UnionMember<double > mDouble;
274 : UnionMember<AutoKeyword > mAutoKeyword;
275 :
276 : };
277 :
278 : Type mType;
279 : Value mValue;
280 :
281 : public:
282 0 : explicit inline OwningDoubleOrAutoKeyword()
283 0 : : mType(eUninitialized)
284 : {
285 0 : }
286 :
287 : explicit inline OwningDoubleOrAutoKeyword(const OwningDoubleOrAutoKeyword& aOther)
288 : : mType(eUninitialized)
289 : {
290 : *this = aOther;
291 : }
292 :
293 0 : inline ~OwningDoubleOrAutoKeyword()
294 0 : {
295 0 : Uninit();
296 0 : }
297 :
298 : double&
299 : RawSetAsDouble();
300 :
301 : double&
302 : SetAsDouble();
303 :
304 : bool
305 : TrySetToDouble(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
306 :
307 : inline bool
308 0 : IsDouble() const
309 : {
310 0 : return mType == eDouble;
311 : }
312 :
313 : inline double&
314 : GetAsDouble()
315 : {
316 : MOZ_ASSERT(IsDouble(), "Wrong type!");
317 : return mValue.mDouble.Value();
318 : }
319 :
320 : inline double const &
321 0 : GetAsDouble() const
322 : {
323 0 : MOZ_ASSERT(IsDouble(), "Wrong type!");
324 0 : return mValue.mDouble.Value();
325 : }
326 :
327 : AutoKeyword&
328 : RawSetAsAutoKeyword();
329 :
330 : AutoKeyword&
331 : SetAsAutoKeyword();
332 :
333 : bool
334 : TrySetToAutoKeyword(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
335 :
336 : inline bool
337 0 : IsAutoKeyword() const
338 : {
339 0 : return mType == eAutoKeyword;
340 : }
341 :
342 : inline AutoKeyword&
343 : GetAsAutoKeyword()
344 : {
345 : MOZ_ASSERT(IsAutoKeyword(), "Wrong type!");
346 : return mValue.mAutoKeyword.Value();
347 : }
348 :
349 : inline AutoKeyword const &
350 0 : GetAsAutoKeyword() const
351 : {
352 0 : MOZ_ASSERT(IsAutoKeyword(), "Wrong type!");
353 0 : return mValue.mAutoKeyword.Value();
354 : }
355 :
356 : void
357 : Uninit();
358 :
359 : bool
360 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
361 :
362 : void
363 : TraceUnion(JSTracer* trc);
364 :
365 : OwningDoubleOrAutoKeyword&
366 : operator=(const OwningDoubleOrAutoKeyword& aOther);
367 :
368 : private:
369 : void
370 : DestroyDouble();
371 :
372 : void
373 : DestroyAutoKeyword();
374 : };
375 :
376 :
377 : namespace VTTCueBinding {
378 :
379 : typedef mozilla::dom::TextTrackCue NativeType;
380 :
381 : JSObject*
382 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
383 :
384 : const JSClass*
385 : GetJSClass();
386 :
387 : bool
388 : Wrap(JSContext* aCx, mozilla::dom::TextTrackCue* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
389 :
390 : template <class T>
391 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
392 : {
393 0 : JS::Rooted<JSObject*> reflector(aCx);
394 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
395 : }
396 :
397 : // We declare this as an array so that retrieving a pointer to this
398 : // binding's property hooks only requires compile/link-time resolvable
399 : // address arithmetic. Declaring it as a pointer instead would require
400 : // doing a run-time load to fetch a pointer to this binding's property
401 : // hooks. And then structures which embedded a pointer to this structure
402 : // would require a run-time load for proper initialization, which would
403 : // then induce static constructors. Lots of static constructors.
404 : extern const NativePropertyHooks sNativePropertyHooks[];
405 :
406 : void
407 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
408 :
409 : JS::Handle<JSObject*>
410 : GetProtoObjectHandle(JSContext* aCx);
411 :
412 : JS::Handle<JSObject*>
413 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
414 :
415 : JSObject*
416 : GetConstructorObject(JSContext* aCx);
417 :
418 : } // namespace VTTCueBinding
419 :
420 :
421 :
422 : } // namespace dom
423 : } // namespace mozilla
424 :
425 : #endif // mozilla_dom_VTTCueBinding_h
|