Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM StylePropertyMapReadOnly.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_STYLEPROPERTYMAPREADONLYBINDING_H_
#define DOM_STYLEPROPERTYMAPREADONLYBINDING_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/PrototypeList.h"
#include "mozilla/dom/UnionMember.h"
namespace mozilla {
namespace dom {
class CSSStyleValue;
struct NativePropertyHooks;
class OwningUndefinedOrCSSStyleValue;
class ProtoAndIfaceCache;
class StylePropertyMapReadOnly;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningUndefinedOrCSSStyleValue& aUnion, const char* aName, uint32_t aFlags = 0);
void
ImplCycleCollectionUnlink(OwningUndefinedOrCSSStyleValue& aUnion);
class UndefinedOrCSSStyleValue : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUndefined,
eCSSStyleValue
};
public:
enum class Type
{
eUndefined = TypeOrUninit::eUndefined,
eCSSStyleValue = TypeOrUninit::eCSSStyleValue
};
private:
union Value
{
UnionMember<NonNull<mozilla::dom::CSSStyleValue> > mCSSStyleValue;
};
TypeOrUninit mType;
Value mValue;
UndefinedOrCSSStyleValue(const UndefinedOrCSSStyleValue&) = delete;
UndefinedOrCSSStyleValue& operator=(const UndefinedOrCSSStyleValue&) = delete;
public:
explicit inline UndefinedOrCSSStyleValue()
: mType(eUninitialized)
{
}
inline ~UndefinedOrCSSStyleValue()
{
Uninit();
}
inline bool
IsUndefined() const
{
return mType == eUndefined;
}
inline void
SetUndefined()
{
Uninit();
mType = eUndefined;
}
[[nodiscard]] inline NonNull<mozilla::dom::CSSStyleValue>&
RawSetAsCSSStyleValue()
{
if (mType == eCSSStyleValue) {
return mValue.mCSSStyleValue.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eCSSStyleValue;
return mValue.mCSSStyleValue.SetValue();
}
[[nodiscard]] inline NonNull<mozilla::dom::CSSStyleValue>&
SetAsCSSStyleValue()
{
if (mType == eCSSStyleValue) {
return mValue.mCSSStyleValue.Value();
}
Uninit();
mType = eCSSStyleValue;
return mValue.mCSSStyleValue.SetValue();
}
inline bool
IsCSSStyleValue() const
{
return mType == eCSSStyleValue;
}
inline NonNull<mozilla::dom::CSSStyleValue>&
GetAsCSSStyleValue()
{
MOZ_RELEASE_ASSERT(IsCSSStyleValue(), "Wrong type!");
return mValue.mCSSStyleValue.Value();
}
inline mozilla::dom::CSSStyleValue&
GetAsCSSStyleValue() const
{
MOZ_RELEASE_ASSERT(IsCSSStyleValue(), "Wrong type!");
return mValue.mCSSStyleValue.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 eUndefined: {
break;
}
case eCSSStyleValue: {
DestroyCSSStyleValue();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToCSSStyleValue(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToCSSStyleValue(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyCSSStyleValue()
{
MOZ_RELEASE_ASSERT(IsCSSStyleValue(), "Wrong type!");
mValue.mCSSStyleValue.Destroy();
mType = eUninitialized;
}
};
class OwningUndefinedOrCSSStyleValue : public AllOwningUnionBase
{
friend void ImplCycleCollectionUnlink(OwningUndefinedOrCSSStyleValue& aUnion);
enum TypeOrUninit
{
eUninitialized,
eUndefined,
eCSSStyleValue
};
public:
enum class Type
{
eUndefined = TypeOrUninit::eUndefined,
eCSSStyleValue = TypeOrUninit::eCSSStyleValue
};
private:
union Value
{
UnionMember<OwningNonNull<mozilla::dom::CSSStyleValue> > mCSSStyleValue;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningUndefinedOrCSSStyleValue()
: mType(eUninitialized)
{
}
OwningUndefinedOrCSSStyleValue(OwningUndefinedOrCSSStyleValue&& aOther);
explicit inline OwningUndefinedOrCSSStyleValue(const OwningUndefinedOrCSSStyleValue& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningUndefinedOrCSSStyleValue()
{
Uninit();
}
inline bool
IsUndefined() const
{
return mType == eUndefined;
}
inline void
SetUndefined()
{
Uninit();
mType = eUndefined;
}
[[nodiscard]] OwningNonNull<mozilla::dom::CSSStyleValue>&
RawSetAsCSSStyleValue();
[[nodiscard]] OwningNonNull<mozilla::dom::CSSStyleValue>&
SetAsCSSStyleValue();
inline bool
IsCSSStyleValue() const
{
return mType == eCSSStyleValue;
}
inline OwningNonNull<mozilla::dom::CSSStyleValue>&
GetAsCSSStyleValue()
{
MOZ_RELEASE_ASSERT(IsCSSStyleValue(), "Wrong type!");
return mValue.mCSSStyleValue.Value();
}
inline OwningNonNull<mozilla::dom::CSSStyleValue> const &
GetAsCSSStyleValue() const
{
MOZ_RELEASE_ASSERT(IsCSSStyleValue(), "Wrong type!");
return mValue.mCSSStyleValue.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();
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
OwningUndefinedOrCSSStyleValue&
operator=(OwningUndefinedOrCSSStyleValue&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningUndefinedOrCSSStyleValue&
operator=(const OwningUndefinedOrCSSStyleValue& aOther);
private:
bool
TrySetToCSSStyleValue(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToCSSStyleValue(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyCSSStyleValue();
};
namespace StylePropertyMapReadOnly_Binding {
typedef mozilla::dom::StylePropertyMapReadOnly NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::StylePropertyMapReadOnly* 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*>
GetProtoObjectHandle(JSContext* aCx);
JSObject*
GetProtoObject(JSContext* aCx);
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::StylePropertyMapReadOnly,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace StylePropertyMapReadOnly_Binding
} // namespace mozilla::dom
#endif // DOM_STYLEPROPERTYMAPREADONLYBINDING_H_