Copy as Markdown
Other Tools
/* THIS FILE IS AUTOGENERATED FROM KeyframeAnimationOptions.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_KEYFRAMEANIMATIONOPTIONSBINDING_H_
#define DOM_KEYFRAMEANIMATIONOPTIONSBINDING_H_
#include "AnimatableBinding.h"
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/FakeString.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/UnionMember.h"
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class ProtoAndIfaceCache;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
class UnrestrictedDoubleOrKeyframeAnimationOptions : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUnrestrictedDouble,
eKeyframeAnimationOptions
};
public:
enum class Type
{
eUnrestrictedDouble = TypeOrUninit::eUnrestrictedDouble,
eKeyframeAnimationOptions = TypeOrUninit::eKeyframeAnimationOptions
};
private:
union Value
{
UnionMember<double > mUnrestrictedDouble;
UnionMember<binding_detail::FastKeyframeAnimationOptions > mKeyframeAnimationOptions;
};
TypeOrUninit mType;
Value mValue;
UnrestrictedDoubleOrKeyframeAnimationOptions(const UnrestrictedDoubleOrKeyframeAnimationOptions&) = delete;
UnrestrictedDoubleOrKeyframeAnimationOptions& operator=(const UnrestrictedDoubleOrKeyframeAnimationOptions&) = delete;
public:
explicit inline UnrestrictedDoubleOrKeyframeAnimationOptions()
: mType(eUninitialized)
{
}
inline ~UnrestrictedDoubleOrKeyframeAnimationOptions()
{
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::FastKeyframeAnimationOptions&
RawSetAsKeyframeAnimationOptions()
{
if (mType == eKeyframeAnimationOptions) {
return mValue.mKeyframeAnimationOptions.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eKeyframeAnimationOptions;
return mValue.mKeyframeAnimationOptions.SetValue();
}
[[nodiscard]] inline binding_detail::FastKeyframeAnimationOptions&
SetAsKeyframeAnimationOptions()
{
if (mType == eKeyframeAnimationOptions) {
return mValue.mKeyframeAnimationOptions.Value();
}
Uninit();
mType = eKeyframeAnimationOptions;
return mValue.mKeyframeAnimationOptions.SetValue();
}
inline bool
IsKeyframeAnimationOptions() const
{
return mType == eKeyframeAnimationOptions;
}
inline binding_detail::FastKeyframeAnimationOptions&
GetAsKeyframeAnimationOptions()
{
MOZ_RELEASE_ASSERT(IsKeyframeAnimationOptions(), "Wrong type!");
return mValue.mKeyframeAnimationOptions.Value();
}
inline const KeyframeAnimationOptions&
GetAsKeyframeAnimationOptions() const
{
MOZ_RELEASE_ASSERT(IsKeyframeAnimationOptions(), "Wrong type!");
return mValue.mKeyframeAnimationOptions.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 eKeyframeAnimationOptions: {
DestroyKeyframeAnimationOptions();
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
TrySetToKeyframeAnimationOptions(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToKeyframeAnimationOptions(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyKeyframeAnimationOptions()
{
MOZ_RELEASE_ASSERT(IsKeyframeAnimationOptions(), "Wrong type!");
mValue.mKeyframeAnimationOptions.Destroy();
mType = eUninitialized;
}
};
class OwningUnrestrictedDoubleOrKeyframeAnimationOptions : public AllOwningUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUnrestrictedDouble,
eKeyframeAnimationOptions
};
public:
enum class Type
{
eUnrestrictedDouble = TypeOrUninit::eUnrestrictedDouble,
eKeyframeAnimationOptions = TypeOrUninit::eKeyframeAnimationOptions
};
private:
union Value
{
UnionMember<double > mUnrestrictedDouble;
UnionMember<KeyframeAnimationOptions > mKeyframeAnimationOptions;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningUnrestrictedDoubleOrKeyframeAnimationOptions()
: mType(eUninitialized)
{
}
OwningUnrestrictedDoubleOrKeyframeAnimationOptions(OwningUnrestrictedDoubleOrKeyframeAnimationOptions&& aOther);
explicit inline OwningUnrestrictedDoubleOrKeyframeAnimationOptions(const OwningUnrestrictedDoubleOrKeyframeAnimationOptions& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningUnrestrictedDoubleOrKeyframeAnimationOptions()
{
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]] KeyframeAnimationOptions&
RawSetAsKeyframeAnimationOptions();
[[nodiscard]] KeyframeAnimationOptions&
SetAsKeyframeAnimationOptions();
inline bool
IsKeyframeAnimationOptions() const
{
return mType == eKeyframeAnimationOptions;
}
inline KeyframeAnimationOptions&
GetAsKeyframeAnimationOptions()
{
MOZ_RELEASE_ASSERT(IsKeyframeAnimationOptions(), "Wrong type!");
return mValue.mKeyframeAnimationOptions.Value();
}
inline KeyframeAnimationOptions const &
GetAsKeyframeAnimationOptions() const
{
MOZ_RELEASE_ASSERT(IsKeyframeAnimationOptions(), "Wrong type!");
return mValue.mKeyframeAnimationOptions.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();
OwningUnrestrictedDoubleOrKeyframeAnimationOptions&
operator=(OwningUnrestrictedDoubleOrKeyframeAnimationOptions&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningUnrestrictedDoubleOrKeyframeAnimationOptions&
operator=(const OwningUnrestrictedDoubleOrKeyframeAnimationOptions& aOther);
private:
bool
TrySetToUnrestrictedDouble(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyUnrestrictedDouble();
bool
TrySetToKeyframeAnimationOptions(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToKeyframeAnimationOptions(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyKeyframeAnimationOptions();
};
} // namespace mozilla::dom
#endif // DOM_KEYFRAMEANIMATIONOPTIONSBINDING_H_