Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/KeyframeEffectBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM KeyframeEffect.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_KeyframeEffectBinding_h
4
#define mozilla_dom_KeyframeEffectBinding_h
5
6
#include "AnimationEffectBinding.h"
7
#include "BaseKeyframeTypesBinding.h"
8
#include "GeckoProfiler.h"
9
#include "js/RootingAPI.h"
10
#include "jspubtd.h"
11
#include "mozilla/ErrorResult.h"
12
#include "mozilla/dom/BindingDeclarations.h"
13
#include "mozilla/dom/FakeString.h"
14
#include "mozilla/dom/Nullable.h"
15
#include "mozilla/dom/PrototypeList.h"
16
#include "mozilla/dom/UnionMember.h"
17
#include "mozilla/dom/UnionTypes.h"
18
19
namespace mozilla {
20
namespace dom {
21
22
struct AnimationPropertyDetailsAtoms;
23
struct AnimationPropertyValueDetails;
24
struct AnimationPropertyValueDetailsAtoms;
25
class CSSPseudoElement;
26
class Element;
27
class KeyframeEffect;
28
struct KeyframeEffectAtoms;
29
struct KeyframeEffectOptionsAtoms;
30
struct NativePropertyHooks;
31
class OwningElementOrCSSPseudoElement;
32
class OwningUnrestrictedDoubleOrString;
33
class ProtoAndIfaceCache;
34
class UnrestrictedDoubleOrString;
35
36
} // namespace dom
37
} // namespace mozilla
38
39
namespace mozilla {
40
namespace dom {
41
42
enum class IterationCompositeOperation : uint8_t {
43
  Replace,
44
  Accumulate,
45
  EndGuard_
46
};
47
48
namespace IterationCompositeOperationValues {
49
extern const EnumEntry strings[3];
50
} // namespace IterationCompositeOperationValues
51
52
bool
53
ToJSValue(JSContext* aCx, IterationCompositeOperation aArgument, JS::MutableHandle<JS::Value> aValue);
54
55
56
void
57
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningElementOrCSSPseudoElement& aUnion, const char* aName, uint32_t aFlags = 0);
58
59
60
void
61
ImplCycleCollectionUnlink(OwningElementOrCSSPseudoElement& aUnion);
62
63
64
struct AnimationPropertyValueDetails : public DictionaryBase
65
{
66
  MOZ_INIT_OUTSIDE_CTOR CompositeOperation mComposite;
67
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mEasing;
68
  MOZ_INIT_OUTSIDE_CTOR double mOffset;
69
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mValue;
70
71
  AnimationPropertyValueDetails();
72
73
  explicit inline AnimationPropertyValueDetails(const FastDictionaryInitializer& )
74
0
  {
75
0
    // Do nothing here; this is used by our "Fast" subclass
76
0
  }
77
78
  explicit inline AnimationPropertyValueDetails(const AnimationPropertyValueDetails& aOther)
79
0
  {
80
0
    *this = aOther;
81
0
  }
82
83
  bool
84
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
85
86
  bool
87
  Init(const nsAString& aJSON);
88
89
  bool
90
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
91
92
  bool
93
  ToJSON(nsAString& aJSON) const;
94
95
  void
96
  TraceDictionary(JSTracer* trc);
97
98
  AnimationPropertyValueDetails&
99
  operator=(const AnimationPropertyValueDetails& aOther);
100
101
private:
102
  static bool
103
  InitIds(JSContext* cx, AnimationPropertyValueDetailsAtoms* atomsCache);
104
};
105
106
namespace binding_detail {
107
struct FastAnimationPropertyValueDetails : public AnimationPropertyValueDetails
108
{
109
  inline FastAnimationPropertyValueDetails()
110
    : AnimationPropertyValueDetails(FastDictionaryInitializer())
111
0
  {
112
0
    // Doesn't matter what int we pass to the parent constructor
113
0
  }
114
};
115
} // namespace binding_detail
116
117
118
class ElementOrCSSPseudoElement
119
{
120
  friend class ElementOrCSSPseudoElementArgument;
121
  enum Type
122
  {
123
    eUninitialized,
124
    eElement,
125
    eCSSPseudoElement
126
  };
127
128
  union Value
129
  {
130
    UnionMember<NonNull<mozilla::dom::Element> > mElement;
131
    UnionMember<NonNull<mozilla::dom::CSSPseudoElement> > mCSSPseudoElement;
132
133
  };
134
135
  Type mType;
136
  Value mValue;
137
138
  ElementOrCSSPseudoElement(const ElementOrCSSPseudoElement&) = delete;
139
  ElementOrCSSPseudoElement& operator=(const ElementOrCSSPseudoElement&) = delete;
140
public:
141
  explicit inline ElementOrCSSPseudoElement()
142
    : mType(eUninitialized)
143
0
  {
144
0
  }
145
146
  inline ~ElementOrCSSPseudoElement()
147
0
  {
148
0
    Uninit();
149
0
  }
150
151
  inline NonNull<mozilla::dom::Element>&
152
  RawSetAsElement()
153
0
  {
154
0
    if (mType == eElement) {
155
0
      return mValue.mElement.Value();
156
0
    }
157
0
    MOZ_ASSERT(mType == eUninitialized);
158
0
    mType = eElement;
159
0
    return mValue.mElement.SetValue();
160
0
  }
161
162
  inline NonNull<mozilla::dom::Element>&
163
  SetAsElement()
164
0
  {
165
0
    if (mType == eElement) {
166
0
      return mValue.mElement.Value();
167
0
    }
168
0
    Uninit();
169
0
    mType = eElement;
170
0
    return mValue.mElement.SetValue();
171
0
  }
172
173
  inline bool
174
  IsElement() const
175
0
  {
176
0
    return mType == eElement;
177
0
  }
178
179
  inline NonNull<mozilla::dom::Element>&
180
  GetAsElement()
181
0
  {
182
0
    MOZ_ASSERT(IsElement(), "Wrong type!");
183
0
    return mValue.mElement.Value();
184
0
  }
185
186
  inline mozilla::dom::Element&
187
  GetAsElement() const
188
0
  {
189
0
    MOZ_ASSERT(IsElement(), "Wrong type!");
190
0
    return mValue.mElement.Value();
191
0
  }
192
193
  inline NonNull<mozilla::dom::CSSPseudoElement>&
194
  RawSetAsCSSPseudoElement()
195
0
  {
196
0
    if (mType == eCSSPseudoElement) {
197
0
      return mValue.mCSSPseudoElement.Value();
198
0
    }
199
0
    MOZ_ASSERT(mType == eUninitialized);
200
0
    mType = eCSSPseudoElement;
201
0
    return mValue.mCSSPseudoElement.SetValue();
202
0
  }
203
204
  inline NonNull<mozilla::dom::CSSPseudoElement>&
205
  SetAsCSSPseudoElement()
206
0
  {
207
0
    if (mType == eCSSPseudoElement) {
208
0
      return mValue.mCSSPseudoElement.Value();
209
0
    }
210
0
    Uninit();
211
0
    mType = eCSSPseudoElement;
212
0
    return mValue.mCSSPseudoElement.SetValue();
213
0
  }
214
215
  inline bool
216
  IsCSSPseudoElement() const
217
0
  {
218
0
    return mType == eCSSPseudoElement;
219
0
  }
220
221
  inline NonNull<mozilla::dom::CSSPseudoElement>&
222
  GetAsCSSPseudoElement()
223
0
  {
224
0
    MOZ_ASSERT(IsCSSPseudoElement(), "Wrong type!");
225
0
    return mValue.mCSSPseudoElement.Value();
226
0
  }
227
228
  inline mozilla::dom::CSSPseudoElement&
229
  GetAsCSSPseudoElement() const
230
0
  {
231
0
    MOZ_ASSERT(IsCSSPseudoElement(), "Wrong type!");
232
0
    return mValue.mCSSPseudoElement.Value();
233
0
  }
234
235
  inline void
236
  Uninit()
237
  {
238
    switch (mType) {
239
      case eUninitialized: {
240
        break;
241
      }
242
      case eElement: {
243
        DestroyElement();
244
        break;
245
      }
246
      case eCSSPseudoElement: {
247
        DestroyCSSPseudoElement();
248
        break;
249
      }
250
    }
251
  }
252
253
  bool
254
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
255
256
private:
257
  inline void
258
  DestroyElement()
259
0
  {
260
0
    MOZ_ASSERT(IsElement(), "Wrong type!");
261
0
    mValue.mElement.Destroy();
262
0
    mType = eUninitialized;
263
0
  }
264
265
  inline void
266
  DestroyCSSPseudoElement()
267
0
  {
268
0
    MOZ_ASSERT(IsCSSPseudoElement(), "Wrong type!");
269
0
    mValue.mCSSPseudoElement.Destroy();
270
0
    mType = eUninitialized;
271
0
  }
272
};
273
274
275
class OwningElementOrCSSPseudoElement : public AllOwningUnionBase
276
{
277
  friend void ImplCycleCollectionUnlink(OwningElementOrCSSPseudoElement& aUnion);
278
  enum Type
279
  {
280
    eUninitialized,
281
    eElement,
282
    eCSSPseudoElement
283
  };
284
285
  union Value
286
  {
287
    UnionMember<OwningNonNull<mozilla::dom::Element> > mElement;
288
    UnionMember<OwningNonNull<mozilla::dom::CSSPseudoElement> > mCSSPseudoElement;
289
290
  };
291
292
  Type mType;
293
  Value mValue;
294
295
public:
296
  explicit inline OwningElementOrCSSPseudoElement()
297
    : mType(eUninitialized)
298
0
  {
299
0
  }
300
301
  explicit inline OwningElementOrCSSPseudoElement(const OwningElementOrCSSPseudoElement& aOther)
302
    : mType(eUninitialized)
303
0
  {
304
0
    *this = aOther;
305
0
  }
306
307
  inline ~OwningElementOrCSSPseudoElement()
308
0
  {
309
0
    Uninit();
310
0
  }
311
312
  OwningNonNull<mozilla::dom::Element>&
313
  RawSetAsElement();
314
315
  OwningNonNull<mozilla::dom::Element>&
316
  SetAsElement();
317
318
  bool
319
  TrySetToElement(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
320
321
  inline bool
322
  IsElement() const
323
0
  {
324
0
    return mType == eElement;
325
0
  }
326
327
  inline OwningNonNull<mozilla::dom::Element>&
328
  GetAsElement()
329
0
  {
330
0
    MOZ_ASSERT(IsElement(), "Wrong type!");
331
0
    return mValue.mElement.Value();
332
0
  }
333
334
  inline OwningNonNull<mozilla::dom::Element> const &
335
  GetAsElement() const
336
0
  {
337
0
    MOZ_ASSERT(IsElement(), "Wrong type!");
338
0
    return mValue.mElement.Value();
339
0
  }
340
341
  OwningNonNull<mozilla::dom::CSSPseudoElement>&
342
  RawSetAsCSSPseudoElement();
343
344
  OwningNonNull<mozilla::dom::CSSPseudoElement>&
345
  SetAsCSSPseudoElement();
346
347
  bool
348
  TrySetToCSSPseudoElement(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
349
350
  inline bool
351
  IsCSSPseudoElement() const
352
0
  {
353
0
    return mType == eCSSPseudoElement;
354
0
  }
355
356
  inline OwningNonNull<mozilla::dom::CSSPseudoElement>&
357
  GetAsCSSPseudoElement()
358
0
  {
359
0
    MOZ_ASSERT(IsCSSPseudoElement(), "Wrong type!");
360
0
    return mValue.mCSSPseudoElement.Value();
361
0
  }
362
363
  inline OwningNonNull<mozilla::dom::CSSPseudoElement> const &
364
  GetAsCSSPseudoElement() const
365
0
  {
366
0
    MOZ_ASSERT(IsCSSPseudoElement(), "Wrong type!");
367
0
    return mValue.mCSSPseudoElement.Value();
368
0
  }
369
370
  void
371
  Uninit();
372
373
  bool
374
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
375
376
  void
377
  TraceUnion(JSTracer* trc);
378
379
  OwningElementOrCSSPseudoElement&
380
  operator=(const OwningElementOrCSSPseudoElement& aOther);
381
382
private:
383
  void
384
  DestroyElement();
385
386
  void
387
  DestroyCSSPseudoElement();
388
};
389
390
391
struct KeyframeEffectOptions : public EffectTiming
392
{
393
  MOZ_INIT_OUTSIDE_CTOR CompositeOperation mComposite;
394
  MOZ_INIT_OUTSIDE_CTOR IterationCompositeOperation mIterationComposite;
395
396
  KeyframeEffectOptions();
397
398
  explicit inline KeyframeEffectOptions(const FastDictionaryInitializer& )
399
    : EffectTiming(FastDictionaryInitializer())
400
0
  {
401
0
    // Do nothing here; this is used by our "Fast" subclass
402
0
  }
403
404
  explicit inline KeyframeEffectOptions(const KeyframeEffectOptions& aOther)
405
0
  {
406
0
    *this = aOther;
407
0
  }
408
409
  bool
410
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
411
412
  bool
413
  Init(const nsAString& aJSON);
414
415
  bool
416
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
417
418
  bool
419
  ToJSON(nsAString& aJSON) const;
420
421
  void
422
  TraceDictionary(JSTracer* trc);
423
424
  KeyframeEffectOptions&
425
  operator=(const KeyframeEffectOptions& aOther);
426
427
private:
428
  static bool
429
  InitIds(JSContext* cx, KeyframeEffectOptionsAtoms* atomsCache);
430
};
431
432
namespace binding_detail {
433
struct FastKeyframeEffectOptions : public KeyframeEffectOptions
434
{
435
  inline FastKeyframeEffectOptions()
436
    : KeyframeEffectOptions(FastDictionaryInitializer())
437
0
  {
438
0
    // Doesn't matter what int we pass to the parent constructor
439
0
  }
440
};
441
} // namespace binding_detail
442
443
444
struct AnimationPropertyDetails : public DictionaryBase
445
{
446
  MOZ_INIT_OUTSIDE_CTOR nsString mProperty;
447
  MOZ_INIT_OUTSIDE_CTOR bool mRunningOnCompositor;
448
  MOZ_INIT_OUTSIDE_CTOR Sequence<AnimationPropertyValueDetails> mValues;
449
  MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mWarning;
450
451
  AnimationPropertyDetails();
452
453
  explicit inline AnimationPropertyDetails(const FastDictionaryInitializer& )
454
0
  {
455
0
    // Do nothing here; this is used by our "Fast" subclass
456
0
  }
457
458
  explicit inline AnimationPropertyDetails(const AnimationPropertyDetails& aOther)
459
0
  {
460
0
    *this = aOther;
461
0
  }
462
463
  bool
464
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
465
466
  bool
467
  Init(const nsAString& aJSON);
468
469
  bool
470
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
471
472
  bool
473
  ToJSON(nsAString& aJSON) const;
474
475
  void
476
  TraceDictionary(JSTracer* trc);
477
478
  AnimationPropertyDetails&
479
  operator=(const AnimationPropertyDetails& aOther);
480
481
private:
482
  static bool
483
  InitIds(JSContext* cx, AnimationPropertyDetailsAtoms* atomsCache);
484
};
485
486
namespace binding_detail {
487
struct FastAnimationPropertyDetails : public AnimationPropertyDetails
488
{
489
  inline FastAnimationPropertyDetails()
490
    : AnimationPropertyDetails(FastDictionaryInitializer())
491
0
  {
492
0
    // Doesn't matter what int we pass to the parent constructor
493
0
  }
494
};
495
} // namespace binding_detail
496
497
498
class UnrestrictedDoubleOrKeyframeEffectOptions
499
{
500
  friend class UnrestrictedDoubleOrKeyframeEffectOptionsArgument;
501
  enum Type
502
  {
503
    eUninitialized,
504
    eUnrestrictedDouble,
505
    eKeyframeEffectOptions
506
  };
507
508
  union Value
509
  {
510
    UnionMember<double > mUnrestrictedDouble;
511
    UnionMember<binding_detail::FastKeyframeEffectOptions > mKeyframeEffectOptions;
512
513
  };
514
515
  Type mType;
516
  Value mValue;
517
518
  UnrestrictedDoubleOrKeyframeEffectOptions(const UnrestrictedDoubleOrKeyframeEffectOptions&) = delete;
519
  UnrestrictedDoubleOrKeyframeEffectOptions& operator=(const UnrestrictedDoubleOrKeyframeEffectOptions&) = delete;
520
public:
521
  explicit inline UnrestrictedDoubleOrKeyframeEffectOptions()
522
    : mType(eUninitialized)
523
0
  {
524
0
  }
525
526
  inline ~UnrestrictedDoubleOrKeyframeEffectOptions()
527
0
  {
528
0
    Uninit();
529
0
  }
530
531
  inline double&
532
  RawSetAsUnrestrictedDouble()
533
0
  {
534
0
    if (mType == eUnrestrictedDouble) {
535
0
      return mValue.mUnrestrictedDouble.Value();
536
0
    }
537
0
    MOZ_ASSERT(mType == eUninitialized);
538
0
    mType = eUnrestrictedDouble;
539
0
    return mValue.mUnrestrictedDouble.SetValue();
540
0
  }
541
542
  inline double&
543
  SetAsUnrestrictedDouble()
544
0
  {
545
0
    if (mType == eUnrestrictedDouble) {
546
0
      return mValue.mUnrestrictedDouble.Value();
547
0
    }
548
0
    Uninit();
549
0
    mType = eUnrestrictedDouble;
550
0
    return mValue.mUnrestrictedDouble.SetValue();
551
0
  }
552
553
  inline bool
554
  IsUnrestrictedDouble() const
555
0
  {
556
0
    return mType == eUnrestrictedDouble;
557
0
  }
558
559
  inline double&
560
  GetAsUnrestrictedDouble()
561
0
  {
562
0
    MOZ_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
563
0
    return mValue.mUnrestrictedDouble.Value();
564
0
  }
565
566
  inline double
567
  GetAsUnrestrictedDouble() const
568
0
  {
569
0
    MOZ_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
570
0
    return mValue.mUnrestrictedDouble.Value();
571
0
  }
572
573
  inline binding_detail::FastKeyframeEffectOptions&
574
  RawSetAsKeyframeEffectOptions()
575
0
  {
576
0
    if (mType == eKeyframeEffectOptions) {
577
0
      return mValue.mKeyframeEffectOptions.Value();
578
0
    }
579
0
    MOZ_ASSERT(mType == eUninitialized);
580
0
    mType = eKeyframeEffectOptions;
581
0
    return mValue.mKeyframeEffectOptions.SetValue();
582
0
  }
583
584
  inline binding_detail::FastKeyframeEffectOptions&
585
  SetAsKeyframeEffectOptions()
586
0
  {
587
0
    if (mType == eKeyframeEffectOptions) {
588
0
      return mValue.mKeyframeEffectOptions.Value();
589
0
    }
590
0
    Uninit();
591
0
    mType = eKeyframeEffectOptions;
592
0
    return mValue.mKeyframeEffectOptions.SetValue();
593
0
  }
594
595
  inline bool
596
  IsKeyframeEffectOptions() const
597
0
  {
598
0
    return mType == eKeyframeEffectOptions;
599
0
  }
600
601
  inline binding_detail::FastKeyframeEffectOptions&
602
  GetAsKeyframeEffectOptions()
603
0
  {
604
0
    MOZ_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
605
0
    return mValue.mKeyframeEffectOptions.Value();
606
0
  }
607
608
  inline const KeyframeEffectOptions&
609
  GetAsKeyframeEffectOptions() const
610
0
  {
611
0
    MOZ_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
612
0
    return mValue.mKeyframeEffectOptions.Value();
613
0
  }
614
615
  inline void
616
  Uninit()
617
  {
618
    switch (mType) {
619
      case eUninitialized: {
620
        break;
621
      }
622
      case eUnrestrictedDouble: {
623
        DestroyUnrestrictedDouble();
624
        break;
625
      }
626
      case eKeyframeEffectOptions: {
627
        DestroyKeyframeEffectOptions();
628
        break;
629
      }
630
    }
631
  }
632
633
  bool
634
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
635
636
private:
637
  inline void
638
  DestroyUnrestrictedDouble()
639
0
  {
640
0
    MOZ_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
641
0
    mValue.mUnrestrictedDouble.Destroy();
642
0
    mType = eUninitialized;
643
0
  }
644
645
  inline void
646
  DestroyKeyframeEffectOptions()
647
0
  {
648
0
    MOZ_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
649
0
    mValue.mKeyframeEffectOptions.Destroy();
650
0
    mType = eUninitialized;
651
0
  }
652
};
653
654
655
class OwningUnrestrictedDoubleOrKeyframeEffectOptions : public AllOwningUnionBase
656
{
657
  friend void ImplCycleCollectionUnlink(OwningUnrestrictedDoubleOrKeyframeEffectOptions& aUnion);
658
  enum Type
659
  {
660
    eUninitialized,
661
    eUnrestrictedDouble,
662
    eKeyframeEffectOptions
663
  };
664
665
  union Value
666
  {
667
    UnionMember<double > mUnrestrictedDouble;
668
    UnionMember<KeyframeEffectOptions > mKeyframeEffectOptions;
669
670
  };
671
672
  Type mType;
673
  Value mValue;
674
675
public:
676
  explicit inline OwningUnrestrictedDoubleOrKeyframeEffectOptions()
677
    : mType(eUninitialized)
678
0
  {
679
0
  }
680
681
  explicit inline OwningUnrestrictedDoubleOrKeyframeEffectOptions(const OwningUnrestrictedDoubleOrKeyframeEffectOptions& aOther)
682
    : mType(eUninitialized)
683
0
  {
684
0
    *this = aOther;
685
0
  }
686
687
  inline ~OwningUnrestrictedDoubleOrKeyframeEffectOptions()
688
0
  {
689
0
    Uninit();
690
0
  }
691
692
  double&
693
  RawSetAsUnrestrictedDouble();
694
695
  double&
696
  SetAsUnrestrictedDouble();
697
698
  bool
699
  TrySetToUnrestrictedDouble(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
700
701
  inline bool
702
  IsUnrestrictedDouble() const
703
0
  {
704
0
    return mType == eUnrestrictedDouble;
705
0
  }
706
707
  inline double&
708
  GetAsUnrestrictedDouble()
709
0
  {
710
0
    MOZ_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
711
0
    return mValue.mUnrestrictedDouble.Value();
712
0
  }
713
714
  inline double const &
715
  GetAsUnrestrictedDouble() const
716
0
  {
717
0
    MOZ_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
718
0
    return mValue.mUnrestrictedDouble.Value();
719
0
  }
720
721
  KeyframeEffectOptions&
722
  RawSetAsKeyframeEffectOptions();
723
724
  KeyframeEffectOptions&
725
  SetAsKeyframeEffectOptions();
726
727
  bool
728
  TrySetToKeyframeEffectOptions(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
729
730
  inline bool
731
  IsKeyframeEffectOptions() const
732
0
  {
733
0
    return mType == eKeyframeEffectOptions;
734
0
  }
735
736
  inline KeyframeEffectOptions&
737
  GetAsKeyframeEffectOptions()
738
0
  {
739
0
    MOZ_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
740
0
    return mValue.mKeyframeEffectOptions.Value();
741
0
  }
742
743
  inline KeyframeEffectOptions const &
744
  GetAsKeyframeEffectOptions() const
745
0
  {
746
0
    MOZ_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
747
0
    return mValue.mKeyframeEffectOptions.Value();
748
0
  }
749
750
  void
751
  Uninit();
752
753
  bool
754
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
755
756
  void
757
  TraceUnion(JSTracer* trc);
758
759
  OwningUnrestrictedDoubleOrKeyframeEffectOptions&
760
  operator=(const OwningUnrestrictedDoubleOrKeyframeEffectOptions& aOther);
761
762
private:
763
  void
764
  DestroyUnrestrictedDouble();
765
766
  void
767
  DestroyKeyframeEffectOptions();
768
};
769
770
771
namespace KeyframeEffect_Binding {
772
773
  typedef mozilla::dom::KeyframeEffect NativeType;
774
775
  bool
776
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
777
778
  const JSClass*
779
  GetJSClass();
780
781
  bool
782
  Wrap(JSContext* aCx, mozilla::dom::KeyframeEffect* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
783
784
  template <class T>
785
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
786
0
  {
787
0
    JS::Rooted<JSObject*> reflector(aCx);
788
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
789
0
  }
790
791
  // We declare this as an array so that retrieving a pointer to this
792
  // binding's property hooks only requires compile/link-time resolvable
793
  // address arithmetic.  Declaring it as a pointer instead would require
794
  // doing a run-time load to fetch a pointer to this binding's property
795
  // hooks.  And then structures which embedded a pointer to this structure
796
  // would require a run-time load for proper initialization, which would
797
  // then induce static constructors.  Lots of static constructors.
798
  extern const NativePropertyHooks sNativePropertyHooks[];
799
800
  void
801
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
802
803
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
804
0
  {
805
0
    /* Get the interface prototype object for this class.  This will create the
806
0
       object as needed. */
807
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::KeyframeEffect,
808
0
                                       &CreateInterfaceObjects,
809
0
                                       /* aDefineOnGlobal = */ true);
810
0
811
0
  }
812
813
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
814
0
  {
815
0
    /* Get the interface object for this class.  This will create the object as
816
0
       needed. */
817
0
818
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::KeyframeEffect,
819
0
                                       &CreateInterfaceObjects,
820
0
                                       aDefineOnGlobal);
821
0
  }
822
823
  JSObject*
824
  GetConstructorObject(JSContext* aCx);
825
826
} // namespace KeyframeEffect_Binding
827
828
829
830
} // namespace dom
831
} // namespace mozilla
832
833
#endif // mozilla_dom_KeyframeEffectBinding_h