Copy as Markdown
Other Tools
/* THIS FILE IS AUTOGENERATED FROM KeyframeEffect.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_KEYFRAMEEFFECTBINDING_H_
#define DOM_KEYFRAMEEFFECTBINDING_H_
#include "AnimationEffectBinding.h"
#include "BaseKeyframeTypesBinding.h"
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/Span.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/FakeString.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/UnionMember.h"
namespace mozilla {
namespace dom {
struct AnimationPropertyDetailsAtoms;
struct AnimationPropertyValueDetails;
struct AnimationPropertyValueDetailsAtoms;
class KeyframeEffect;
struct KeyframeEffectOptionsAtoms;
struct NativePropertyHooks;
class ProtoAndIfaceCache;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class IterationCompositeOperation : uint8_t {
Replace,
Accumulate,
};
namespace binding_detail {
template <> struct EnumStrings<IterationCompositeOperation> {
static constexpr nsLiteralCString Values[2] {
"replace"_ns,
"accumulate"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, IterationCompositeOperation aArgument, JS::MutableHandle<JS::Value> aValue);
struct AnimationPropertyValueDetails : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR CompositeOperation mComposite;
MOZ_INIT_OUTSIDE_CTOR Optional<nsCString> mEasing;
MOZ_INIT_OUTSIDE_CTOR double mOffset;
MOZ_INIT_OUTSIDE_CTOR Optional<nsCString> mValue;
AnimationPropertyValueDetails();
explicit inline AnimationPropertyValueDetails(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
AnimationPropertyValueDetails(AnimationPropertyValueDetails&& aOther) = default;
explicit inline AnimationPropertyValueDetails(const AnimationPropertyValueDetails& aOther)
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
AnimationPropertyValueDetails&
operator=(const AnimationPropertyValueDetails& aOther);
private:
static bool
InitIds(JSContext* cx, AnimationPropertyValueDetailsAtoms* atomsCache);
};
namespace binding_detail {
struct FastAnimationPropertyValueDetails : public AnimationPropertyValueDetails
{
inline FastAnimationPropertyValueDetails()
: AnimationPropertyValueDetails(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct KeyframeEffectOptions : public EffectTiming
{
MOZ_INIT_OUTSIDE_CTOR CompositeOperation mComposite;
MOZ_INIT_OUTSIDE_CTOR IterationCompositeOperation mIterationComposite;
MOZ_INIT_OUTSIDE_CTOR nsString mPseudoElement;
KeyframeEffectOptions();
explicit inline KeyframeEffectOptions(const FastDictionaryInitializer& )
: EffectTiming(FastDictionaryInitializer())
{
// Do nothing here; this is used by our "Fast" subclass
}
KeyframeEffectOptions(KeyframeEffectOptions&& aOther) = default;
explicit inline KeyframeEffectOptions(const KeyframeEffectOptions& aOther)
: EffectTiming(FastDictionaryInitializer())
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
KeyframeEffectOptions&
operator=(const KeyframeEffectOptions& aOther);
private:
static bool
InitIds(JSContext* cx, KeyframeEffectOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastKeyframeEffectOptions : public KeyframeEffectOptions
{
inline FastKeyframeEffectOptions()
: KeyframeEffectOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct AnimationPropertyDetails : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mProperty;
MOZ_INIT_OUTSIDE_CTOR bool mRunningOnCompositor;
MOZ_INIT_OUTSIDE_CTOR Sequence<AnimationPropertyValueDetails> mValues;
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mWarning;
AnimationPropertyDetails();
explicit inline AnimationPropertyDetails(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
AnimationPropertyDetails(AnimationPropertyDetails&& aOther) = default;
explicit inline AnimationPropertyDetails(const AnimationPropertyDetails& aOther)
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
AnimationPropertyDetails&
operator=(const AnimationPropertyDetails& aOther);
private:
static bool
InitIds(JSContext* cx, AnimationPropertyDetailsAtoms* atomsCache);
};
namespace binding_detail {
struct FastAnimationPropertyDetails : public AnimationPropertyDetails
{
inline FastAnimationPropertyDetails()
: AnimationPropertyDetails(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
class UnrestrictedDoubleOrKeyframeEffectOptions : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUnrestrictedDouble,
eKeyframeEffectOptions
};
public:
enum class Type
{
eUnrestrictedDouble = TypeOrUninit::eUnrestrictedDouble,
eKeyframeEffectOptions = TypeOrUninit::eKeyframeEffectOptions
};
private:
union Value
{
UnionMember<double > mUnrestrictedDouble;
UnionMember<binding_detail::FastKeyframeEffectOptions > mKeyframeEffectOptions;
};
TypeOrUninit mType;
Value mValue;
UnrestrictedDoubleOrKeyframeEffectOptions(const UnrestrictedDoubleOrKeyframeEffectOptions&) = delete;
UnrestrictedDoubleOrKeyframeEffectOptions& operator=(const UnrestrictedDoubleOrKeyframeEffectOptions&) = delete;
public:
explicit inline UnrestrictedDoubleOrKeyframeEffectOptions()
: mType(eUninitialized)
{
}
inline ~UnrestrictedDoubleOrKeyframeEffectOptions()
{
Uninit();
}
[[nodiscard]] inline double&
RawSetAsUnrestrictedDouble()
{
if (mType == eUnrestrictedDouble) {
return mValue.mUnrestrictedDouble.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eUnrestrictedDouble;
return mValue.mUnrestrictedDouble.SetValue();
}
[[nodiscard]] inline double&
SetAsUnrestrictedDouble()
{
if (mType == eUnrestrictedDouble) {
return mValue.mUnrestrictedDouble.Value();
}
Uninit();
mType = eUnrestrictedDouble;
return mValue.mUnrestrictedDouble.SetValue();
}
inline bool
IsUnrestrictedDouble() const
{
return mType == eUnrestrictedDouble;
}
inline double&
GetAsUnrestrictedDouble()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
return mValue.mUnrestrictedDouble.Value();
}
inline double
GetAsUnrestrictedDouble() const
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
return mValue.mUnrestrictedDouble.Value();
}
[[nodiscard]] inline binding_detail::FastKeyframeEffectOptions&
RawSetAsKeyframeEffectOptions()
{
if (mType == eKeyframeEffectOptions) {
return mValue.mKeyframeEffectOptions.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eKeyframeEffectOptions;
return mValue.mKeyframeEffectOptions.SetValue();
}
[[nodiscard]] inline binding_detail::FastKeyframeEffectOptions&
SetAsKeyframeEffectOptions()
{
if (mType == eKeyframeEffectOptions) {
return mValue.mKeyframeEffectOptions.Value();
}
Uninit();
mType = eKeyframeEffectOptions;
return mValue.mKeyframeEffectOptions.SetValue();
}
inline bool
IsKeyframeEffectOptions() const
{
return mType == eKeyframeEffectOptions;
}
inline binding_detail::FastKeyframeEffectOptions&
GetAsKeyframeEffectOptions()
{
MOZ_RELEASE_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
return mValue.mKeyframeEffectOptions.Value();
}
inline const KeyframeEffectOptions&
GetAsKeyframeEffectOptions() const
{
MOZ_RELEASE_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
return mValue.mKeyframeEffectOptions.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
inline void
Uninit()
{
switch (mType) {
case eUninitialized: {
break;
}
case eUnrestrictedDouble: {
DestroyUnrestrictedDouble();
break;
}
case eKeyframeEffectOptions: {
DestroyKeyframeEffectOptions();
break;
}
}
}
private:
bool
TrySetToUnrestrictedDouble(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyUnrestrictedDouble()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
mValue.mUnrestrictedDouble.Destroy();
mType = eUninitialized;
}
bool
TrySetToKeyframeEffectOptions(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToKeyframeEffectOptions(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyKeyframeEffectOptions()
{
MOZ_RELEASE_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
mValue.mKeyframeEffectOptions.Destroy();
mType = eUninitialized;
}
};
class OwningUnrestrictedDoubleOrKeyframeEffectOptions : public AllOwningUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUnrestrictedDouble,
eKeyframeEffectOptions
};
public:
enum class Type
{
eUnrestrictedDouble = TypeOrUninit::eUnrestrictedDouble,
eKeyframeEffectOptions = TypeOrUninit::eKeyframeEffectOptions
};
private:
union Value
{
UnionMember<double > mUnrestrictedDouble;
UnionMember<KeyframeEffectOptions > mKeyframeEffectOptions;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningUnrestrictedDoubleOrKeyframeEffectOptions()
: mType(eUninitialized)
{
}
OwningUnrestrictedDoubleOrKeyframeEffectOptions(OwningUnrestrictedDoubleOrKeyframeEffectOptions&& aOther);
explicit inline OwningUnrestrictedDoubleOrKeyframeEffectOptions(const OwningUnrestrictedDoubleOrKeyframeEffectOptions& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningUnrestrictedDoubleOrKeyframeEffectOptions()
{
Uninit();
}
[[nodiscard]] double&
RawSetAsUnrestrictedDouble();
[[nodiscard]] double&
SetAsUnrestrictedDouble();
inline bool
IsUnrestrictedDouble() const
{
return mType == eUnrestrictedDouble;
}
inline double&
GetAsUnrestrictedDouble()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
return mValue.mUnrestrictedDouble.Value();
}
inline double const &
GetAsUnrestrictedDouble() const
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
return mValue.mUnrestrictedDouble.Value();
}
[[nodiscard]] KeyframeEffectOptions&
RawSetAsKeyframeEffectOptions();
[[nodiscard]] KeyframeEffectOptions&
SetAsKeyframeEffectOptions();
inline bool
IsKeyframeEffectOptions() const
{
return mType == eKeyframeEffectOptions;
}
inline KeyframeEffectOptions&
GetAsKeyframeEffectOptions()
{
MOZ_RELEASE_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
return mValue.mKeyframeEffectOptions.Value();
}
inline KeyframeEffectOptions const &
GetAsKeyframeEffectOptions() const
{
MOZ_RELEASE_ASSERT(IsKeyframeEffectOptions(), "Wrong type!");
return mValue.mKeyframeEffectOptions.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
Uninit();
OwningUnrestrictedDoubleOrKeyframeEffectOptions&
operator=(OwningUnrestrictedDoubleOrKeyframeEffectOptions&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningUnrestrictedDoubleOrKeyframeEffectOptions&
operator=(const OwningUnrestrictedDoubleOrKeyframeEffectOptions& aOther);
private:
bool
TrySetToUnrestrictedDouble(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyUnrestrictedDouble();
bool
TrySetToKeyframeEffectOptions(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToKeyframeEffectOptions(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyKeyframeEffectOptions();
};
namespace KeyframeEffect_Binding {
typedef mozilla::dom::KeyframeEffect NativeType;
bool
Wrap(JSContext* aCx, mozilla::dom::KeyframeEffect* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
template <class T>
inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
{
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal);
JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx);
inline bool CreateAndDefineOnGlobal(JSContext* aCx)
{
// Get the interface or namespace object for this class. This will
// create the object as needed and always define the properties for
// it on the global. The caller should make sure the interface or
// namespace is exposed on the global before calling this.
return GetPerInterfaceObjectHandle(aCx, constructors::id::KeyframeEffect,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace KeyframeEffect_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::IterationCompositeOperation>
{
static constexpr dom::IterationCompositeOperation value = dom::IterationCompositeOperation::Accumulate;
static_assert(static_cast<uint8_t>(dom::IterationCompositeOperation::Replace) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::IterationCompositeOperation>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_KEYFRAMEEFFECTBINDING_H_