Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM DOMMatrix.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_DOMMATRIXBINDING_H_
#define DOM_DOMMATRIXBINDING_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"
class nsIGlobalObject;
namespace mozilla {
namespace dom {
class DOMMatrix;
struct DOMMatrix2DInitAtoms;
struct DOMMatrixInitAtoms;
class DOMMatrixReadOnly;
struct NativePropertyHooks;
class OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly;
class ProtoAndIfaceCache;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& aUnion, const char* aName, uint32_t aFlags = 0);
void
ImplCycleCollectionUnlink(OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& aUnion);
struct DOMMatrix2DInit : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<double> mA;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mB;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mC;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mD;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mE;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mF;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mM11;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mM12;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mM21;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mM22;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mM41;
MOZ_INIT_OUTSIDE_CTOR Optional<double> mM42;
DOMMatrix2DInit();
explicit inline DOMMatrix2DInit(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
DOMMatrix2DInit(DOMMatrix2DInit&& aOther) = default;
explicit inline DOMMatrix2DInit(const DOMMatrix2DInit& aOther)
{
*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);
DOMMatrix2DInit&
operator=(const DOMMatrix2DInit& aOther);
private:
static bool
InitIds(JSContext* cx, DOMMatrix2DInitAtoms* atomsCache);
};
namespace binding_detail {
struct FastDOMMatrix2DInit : public DOMMatrix2DInit
{
inline FastDOMMatrix2DInit()
: DOMMatrix2DInit(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
class UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUTF8String,
eUnrestrictedDoubleSequence,
eDOMMatrixReadOnly
};
public:
enum class Type
{
eUTF8String = TypeOrUninit::eUTF8String,
eUnrestrictedDoubleSequence = TypeOrUninit::eUnrestrictedDoubleSequence,
eDOMMatrixReadOnly = TypeOrUninit::eDOMMatrixReadOnly
};
private:
union Value
{
UnionMember<binding_detail::FakeString<char> > mUTF8String;
UnionMember<binding_detail::AutoSequence<double> > mUnrestrictedDoubleSequence;
UnionMember<NonNull<mozilla::dom::DOMMatrixReadOnly> > mDOMMatrixReadOnly;
};
TypeOrUninit mType;
Value mValue;
UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly(const UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly&) = delete;
UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& operator=(const UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly&) = delete;
public:
explicit inline UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly()
: mType(eUninitialized)
{
}
inline ~UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly()
{
Uninit();
}
[[nodiscard]] inline binding_detail::FakeString<char>&
RawSetAsUTF8String()
{
if (mType == eUTF8String) {
return mValue.mUTF8String.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eUTF8String;
return mValue.mUTF8String.SetValue();
}
[[nodiscard]] inline binding_detail::FakeString<char>&
SetAsUTF8String()
{
if (mType == eUTF8String) {
return mValue.mUTF8String.Value();
}
Uninit();
mType = eUTF8String;
return mValue.mUTF8String.SetValue();
}
template <int N>
inline void
SetStringLiteral(const nsCString::char_type (&aData)[N])
{
RawSetAsUTF8String().AssignLiteral(aData);
}
inline bool
IsUTF8String() const
{
return mType == eUTF8String;
}
inline binding_detail::FakeString<char>&
GetAsUTF8String()
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
return mValue.mUTF8String.Value();
}
inline const nsACString&
GetAsUTF8String() const
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
return mValue.mUTF8String.Value();
}
[[nodiscard]] inline binding_detail::AutoSequence<double>&
RawSetAsUnrestrictedDoubleSequence()
{
if (mType == eUnrestrictedDoubleSequence) {
return mValue.mUnrestrictedDoubleSequence.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eUnrestrictedDoubleSequence;
return mValue.mUnrestrictedDoubleSequence.SetValue();
}
[[nodiscard]] inline binding_detail::AutoSequence<double>&
SetAsUnrestrictedDoubleSequence()
{
if (mType == eUnrestrictedDoubleSequence) {
return mValue.mUnrestrictedDoubleSequence.Value();
}
Uninit();
mType = eUnrestrictedDoubleSequence;
return mValue.mUnrestrictedDoubleSequence.SetValue();
}
inline bool
IsUnrestrictedDoubleSequence() const
{
return mType == eUnrestrictedDoubleSequence;
}
inline binding_detail::AutoSequence<double>&
GetAsUnrestrictedDoubleSequence()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDoubleSequence(), "Wrong type!");
return mValue.mUnrestrictedDoubleSequence.Value();
}
inline const Sequence<double>&
GetAsUnrestrictedDoubleSequence() const
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDoubleSequence(), "Wrong type!");
return mValue.mUnrestrictedDoubleSequence.Value();
}
[[nodiscard]] inline NonNull<mozilla::dom::DOMMatrixReadOnly>&
RawSetAsDOMMatrixReadOnly()
{
if (mType == eDOMMatrixReadOnly) {
return mValue.mDOMMatrixReadOnly.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eDOMMatrixReadOnly;
return mValue.mDOMMatrixReadOnly.SetValue();
}
[[nodiscard]] inline NonNull<mozilla::dom::DOMMatrixReadOnly>&
SetAsDOMMatrixReadOnly()
{
if (mType == eDOMMatrixReadOnly) {
return mValue.mDOMMatrixReadOnly.Value();
}
Uninit();
mType = eDOMMatrixReadOnly;
return mValue.mDOMMatrixReadOnly.SetValue();
}
inline bool
IsDOMMatrixReadOnly() const
{
return mType == eDOMMatrixReadOnly;
}
inline NonNull<mozilla::dom::DOMMatrixReadOnly>&
GetAsDOMMatrixReadOnly()
{
MOZ_RELEASE_ASSERT(IsDOMMatrixReadOnly(), "Wrong type!");
return mValue.mDOMMatrixReadOnly.Value();
}
inline mozilla::dom::DOMMatrixReadOnly&
GetAsDOMMatrixReadOnly() const
{
MOZ_RELEASE_ASSERT(IsDOMMatrixReadOnly(), "Wrong type!");
return mValue.mDOMMatrixReadOnly.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 eUTF8String: {
DestroyUTF8String();
break;
}
case eUnrestrictedDoubleSequence: {
DestroyUnrestrictedDoubleSequence();
break;
}
case eDOMMatrixReadOnly: {
DestroyDOMMatrixReadOnly();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToUTF8String(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyUTF8String()
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
mValue.mUTF8String.Destroy();
mType = eUninitialized;
}
bool
TrySetToUnrestrictedDoubleSequence(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToUnrestrictedDoubleSequence(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyUnrestrictedDoubleSequence()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDoubleSequence(), "Wrong type!");
mValue.mUnrestrictedDoubleSequence.Destroy();
mType = eUninitialized;
}
bool
TrySetToDOMMatrixReadOnly(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToDOMMatrixReadOnly(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyDOMMatrixReadOnly()
{
MOZ_RELEASE_ASSERT(IsDOMMatrixReadOnly(), "Wrong type!");
mValue.mDOMMatrixReadOnly.Destroy();
mType = eUninitialized;
}
};
class OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly : public AllOwningUnionBase
{
friend void ImplCycleCollectionUnlink(OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& aUnion);
enum TypeOrUninit
{
eUninitialized,
eUTF8String,
eUnrestrictedDoubleSequence,
eDOMMatrixReadOnly
};
public:
enum class Type
{
eUTF8String = TypeOrUninit::eUTF8String,
eUnrestrictedDoubleSequence = TypeOrUninit::eUnrestrictedDoubleSequence,
eDOMMatrixReadOnly = TypeOrUninit::eDOMMatrixReadOnly
};
private:
union Value
{
UnionMember<nsCString > mUTF8String;
UnionMember<Sequence<double> > mUnrestrictedDoubleSequence;
UnionMember<OwningNonNull<mozilla::dom::DOMMatrixReadOnly> > mDOMMatrixReadOnly;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly()
: mType(eUninitialized)
{
}
OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly(OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly&& aOther);
explicit inline OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly(const OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly()
{
Uninit();
}
[[nodiscard]] nsCString&
RawSetAsUTF8String();
[[nodiscard]] nsCString&
SetAsUTF8String();
template <int N>
inline void
SetStringLiteral(const nsCString::char_type (&aData)[N])
{
RawSetAsUTF8String().AssignLiteral(aData);
}
inline bool
IsUTF8String() const
{
return mType == eUTF8String;
}
inline nsCString&
GetAsUTF8String()
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
return mValue.mUTF8String.Value();
}
inline nsCString const &
GetAsUTF8String() const
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
return mValue.mUTF8String.Value();
}
[[nodiscard]] Sequence<double>&
RawSetAsUnrestrictedDoubleSequence();
[[nodiscard]] Sequence<double>&
SetAsUnrestrictedDoubleSequence();
inline bool
IsUnrestrictedDoubleSequence() const
{
return mType == eUnrestrictedDoubleSequence;
}
inline Sequence<double>&
GetAsUnrestrictedDoubleSequence()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDoubleSequence(), "Wrong type!");
return mValue.mUnrestrictedDoubleSequence.Value();
}
inline Sequence<double> const &
GetAsUnrestrictedDoubleSequence() const
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDoubleSequence(), "Wrong type!");
return mValue.mUnrestrictedDoubleSequence.Value();
}
[[nodiscard]] OwningNonNull<mozilla::dom::DOMMatrixReadOnly>&
RawSetAsDOMMatrixReadOnly();
[[nodiscard]] OwningNonNull<mozilla::dom::DOMMatrixReadOnly>&
SetAsDOMMatrixReadOnly();
inline bool
IsDOMMatrixReadOnly() const
{
return mType == eDOMMatrixReadOnly;
}
inline OwningNonNull<mozilla::dom::DOMMatrixReadOnly>&
GetAsDOMMatrixReadOnly()
{
MOZ_RELEASE_ASSERT(IsDOMMatrixReadOnly(), "Wrong type!");
return mValue.mDOMMatrixReadOnly.Value();
}
inline OwningNonNull<mozilla::dom::DOMMatrixReadOnly> const &
GetAsDOMMatrixReadOnly() const
{
MOZ_RELEASE_ASSERT(IsDOMMatrixReadOnly(), "Wrong type!");
return mValue.mDOMMatrixReadOnly.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;
OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly&
operator=(OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly&
operator=(const OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& aOther);
private:
bool
TrySetToUTF8String(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyUTF8String();
bool
TrySetToUnrestrictedDoubleSequence(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToUnrestrictedDoubleSequence(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyUnrestrictedDoubleSequence();
bool
TrySetToDOMMatrixReadOnly(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToDOMMatrixReadOnly(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyDOMMatrixReadOnly();
};
struct DOMMatrixInit : public DOMMatrix2DInit
{
MOZ_INIT_OUTSIDE_CTOR Optional<bool> mIs2D;
MOZ_INIT_OUTSIDE_CTOR double mM13;
MOZ_INIT_OUTSIDE_CTOR double mM14;
MOZ_INIT_OUTSIDE_CTOR double mM23;
MOZ_INIT_OUTSIDE_CTOR double mM24;
MOZ_INIT_OUTSIDE_CTOR double mM31;
MOZ_INIT_OUTSIDE_CTOR double mM32;
MOZ_INIT_OUTSIDE_CTOR double mM33;
MOZ_INIT_OUTSIDE_CTOR double mM34;
MOZ_INIT_OUTSIDE_CTOR double mM43;
MOZ_INIT_OUTSIDE_CTOR double mM44;
DOMMatrixInit();
explicit inline DOMMatrixInit(const FastDictionaryInitializer& )
: DOMMatrix2DInit(FastDictionaryInitializer())
{
// Do nothing here; this is used by our "Fast" subclass
}
DOMMatrixInit(DOMMatrixInit&& aOther) = default;
explicit inline DOMMatrixInit(const DOMMatrixInit& aOther)
: DOMMatrix2DInit(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);
DOMMatrixInit&
operator=(const DOMMatrixInit& aOther);
private:
static bool
InitIds(JSContext* cx, DOMMatrixInitAtoms* atomsCache);
};
namespace binding_detail {
struct FastDOMMatrixInit : public DOMMatrixInit
{
inline FastDOMMatrixInit()
: DOMMatrixInit(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace DOMMatrix_Binding {
typedef mozilla::dom::DOMMatrix NativeType;
JSObject*
Deserialize(JSContext* aCx, nsIGlobalObject* aGlobal, JSStructuredCloneReader* aReader);
bool
Wrap(JSContext* aCx, mozilla::dom::DOMMatrix* 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::DOMMatrix,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace DOMMatrix_Binding
namespace DOMMatrixReadOnly_Binding {
typedef mozilla::dom::DOMMatrixReadOnly NativeType;
MOZ_CAN_RUN_SCRIPT bool
CollectJSONAttributes(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::DOMMatrixReadOnly* self, JS::Rooted<JSObject*>& result);
JSObject*
Deserialize(JSContext* aCx, nsIGlobalObject* aGlobal, JSStructuredCloneReader* aReader);
bool
Wrap(JSContext* aCx, mozilla::dom::DOMMatrixReadOnly* 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::DOMMatrixReadOnly,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace DOMMatrixReadOnly_Binding
} // namespace mozilla::dom
#endif // DOM_DOMMATRIXBINDING_H_