Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM XULPopupElement.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_XULPOPUPELEMENTBINDING_H_
#define DOM_XULPOPUPELEMENTBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/Event.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 ActivateMenuItemOptionsAtoms;
class Event;
struct NativePropertyHooks;
struct OpenPopupOptionsAtoms;
class OwningStringOrOpenPopupOptions;
class ProtoAndIfaceCache;
class XULPopupElement;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningStringOrOpenPopupOptions& aUnion, const char* aName, uint32_t aFlags = 0);
void
ImplCycleCollectionUnlink(OwningStringOrOpenPopupOptions& aUnion);
struct ActivateMenuItemOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mAltKey;
MOZ_INIT_OUTSIDE_CTOR int16_t mButton;
MOZ_INIT_OUTSIDE_CTOR bool mCtrlKey;
MOZ_INIT_OUTSIDE_CTOR bool mMetaKey;
MOZ_INIT_OUTSIDE_CTOR bool mShiftKey;
ActivateMenuItemOptions();
explicit inline ActivateMenuItemOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
ActivateMenuItemOptions(ActivateMenuItemOptions&& aOther) = default;
explicit inline ActivateMenuItemOptions(const ActivateMenuItemOptions& 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);
ActivateMenuItemOptions&
operator=(const ActivateMenuItemOptions& aOther);
private:
static bool
InitIds(JSContext* cx, ActivateMenuItemOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastActivateMenuItemOptions : public ActivateMenuItemOptions
{
inline FastActivateMenuItemOptions()
: ActivateMenuItemOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct OpenPopupOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mAttributesOverride;
MOZ_INIT_OUTSIDE_CTOR bool mIsContextMenu;
MOZ_INIT_OUTSIDE_CTOR nsString mPosition;
MOZ_INIT_OUTSIDE_CTOR RefPtr<mozilla::dom::Event> mTriggerEvent;
MOZ_INIT_OUTSIDE_CTOR int32_t mX;
MOZ_INIT_OUTSIDE_CTOR int32_t mY;
OpenPopupOptions();
explicit inline OpenPopupOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
OpenPopupOptions(OpenPopupOptions&& aOther) = default;
explicit inline OpenPopupOptions(const OpenPopupOptions& 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);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
ImplCycleCollectionTraverse(aCallback, mTriggerEvent, "mTriggerEvent", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mTriggerEvent);
}
OpenPopupOptions&
operator=(const OpenPopupOptions& aOther);
private:
static bool
InitIds(JSContext* cx, OpenPopupOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastOpenPopupOptions : public OpenPopupOptions
{
inline FastOpenPopupOptions()
: OpenPopupOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
class StringOrOpenPopupOptions : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eString,
eOpenPopupOptions
};
public:
enum class Type
{
eString = TypeOrUninit::eString,
eOpenPopupOptions = TypeOrUninit::eOpenPopupOptions
};
private:
union Value
{
UnionMember<binding_detail::FakeString<char16_t> > mString;
UnionMember<binding_detail::FastOpenPopupOptions > mOpenPopupOptions;
};
TypeOrUninit mType;
Value mValue;
StringOrOpenPopupOptions(const StringOrOpenPopupOptions&) = delete;
StringOrOpenPopupOptions& operator=(const StringOrOpenPopupOptions&) = delete;
public:
explicit inline StringOrOpenPopupOptions()
: mType(eUninitialized)
{
}
inline ~StringOrOpenPopupOptions()
{
Uninit();
}
[[nodiscard]] inline binding_detail::FakeString<char16_t>&
RawSetAsString()
{
if (mType == eString) {
return mValue.mString.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eString;
return mValue.mString.SetValue();
}
[[nodiscard]] inline binding_detail::FakeString<char16_t>&
SetAsString()
{
if (mType == eString) {
return mValue.mString.Value();
}
Uninit();
mType = eString;
return mValue.mString.SetValue();
}
template <int N>
inline void
SetStringLiteral(const nsString::char_type (&aData)[N])
{
RawSetAsString().AssignLiteral(aData);
}
inline bool
IsString() const
{
return mType == eString;
}
inline binding_detail::FakeString<char16_t>&
GetAsString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
inline const nsAString&
GetAsString() const
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
[[nodiscard]] inline binding_detail::FastOpenPopupOptions&
RawSetAsOpenPopupOptions()
{
if (mType == eOpenPopupOptions) {
return mValue.mOpenPopupOptions.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eOpenPopupOptions;
return mValue.mOpenPopupOptions.SetValue();
}
[[nodiscard]] inline binding_detail::FastOpenPopupOptions&
SetAsOpenPopupOptions()
{
if (mType == eOpenPopupOptions) {
return mValue.mOpenPopupOptions.Value();
}
Uninit();
mType = eOpenPopupOptions;
return mValue.mOpenPopupOptions.SetValue();
}
inline bool
IsOpenPopupOptions() const
{
return mType == eOpenPopupOptions;
}
inline binding_detail::FastOpenPopupOptions&
GetAsOpenPopupOptions()
{
MOZ_RELEASE_ASSERT(IsOpenPopupOptions(), "Wrong type!");
return mValue.mOpenPopupOptions.Value();
}
inline const OpenPopupOptions&
GetAsOpenPopupOptions() const
{
MOZ_RELEASE_ASSERT(IsOpenPopupOptions(), "Wrong type!");
return mValue.mOpenPopupOptions.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 eString: {
DestroyString();
break;
}
case eOpenPopupOptions: {
DestroyOpenPopupOptions();
break;
}
}
}
private:
bool
TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
mValue.mString.Destroy();
mType = eUninitialized;
}
bool
TrySetToOpenPopupOptions(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToOpenPopupOptions(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyOpenPopupOptions()
{
MOZ_RELEASE_ASSERT(IsOpenPopupOptions(), "Wrong type!");
mValue.mOpenPopupOptions.Destroy();
mType = eUninitialized;
}
};
class OwningStringOrOpenPopupOptions : public AllOwningUnionBase
{
friend void ImplCycleCollectionUnlink(OwningStringOrOpenPopupOptions& aUnion);
enum TypeOrUninit
{
eUninitialized,
eString,
eOpenPopupOptions
};
public:
enum class Type
{
eString = TypeOrUninit::eString,
eOpenPopupOptions = TypeOrUninit::eOpenPopupOptions
};
private:
union Value
{
UnionMember<nsString > mString;
UnionMember<OpenPopupOptions > mOpenPopupOptions;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningStringOrOpenPopupOptions()
: mType(eUninitialized)
{
}
OwningStringOrOpenPopupOptions(OwningStringOrOpenPopupOptions&& aOther);
explicit inline OwningStringOrOpenPopupOptions(const OwningStringOrOpenPopupOptions& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningStringOrOpenPopupOptions()
{
Uninit();
}
[[nodiscard]] nsString&
RawSetAsString();
[[nodiscard]] nsString&
SetAsString();
template <int N>
inline void
SetStringLiteral(const nsString::char_type (&aData)[N])
{
RawSetAsString().AssignLiteral(aData);
}
inline bool
IsString() const
{
return mType == eString;
}
inline nsString&
GetAsString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
inline nsString const &
GetAsString() const
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
[[nodiscard]] OpenPopupOptions&
RawSetAsOpenPopupOptions();
[[nodiscard]] OpenPopupOptions&
SetAsOpenPopupOptions();
inline bool
IsOpenPopupOptions() const
{
return mType == eOpenPopupOptions;
}
inline OpenPopupOptions&
GetAsOpenPopupOptions()
{
MOZ_RELEASE_ASSERT(IsOpenPopupOptions(), "Wrong type!");
return mValue.mOpenPopupOptions.Value();
}
inline OpenPopupOptions const &
GetAsOpenPopupOptions() const
{
MOZ_RELEASE_ASSERT(IsOpenPopupOptions(), "Wrong type!");
return mValue.mOpenPopupOptions.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();
OwningStringOrOpenPopupOptions&
operator=(OwningStringOrOpenPopupOptions&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningStringOrOpenPopupOptions&
operator=(const OwningStringOrOpenPopupOptions& aOther);
private:
bool
TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyString();
bool
TrySetToOpenPopupOptions(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToOpenPopupOptions(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyOpenPopupOptions();
};
namespace XULPopupElement_Binding {
typedef mozilla::dom::XULPopupElement NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
CountMaybeMissingProperty(JS::Handle<JSObject*> proxy, JS::Handle<jsid> id);
bool
Wrap(JSContext* aCx, mozilla::dom::XULPopupElement* 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::XULPopupElement,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace XULPopupElement_Binding
} // namespace mozilla::dom
#endif // DOM_XULPOPUPELEMENTBINDING_H_