Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM InspectorUtils.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_INSPECTORUTILSBINDING_H_
#define DOM_INSPECTORUTILSBINDING_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/css/Rule.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"
#include "nsCycleCollectionParticipant.h"
#include "nsICSSDeclaration.h"
class nsICSSDeclaration;
namespace mozilla {
namespace css {
class Rule;
} // namespace css
namespace dom {
class InspectorCSSParser;
struct InspectorCSSPropertyDefinitionAtoms;
struct InspectorCSSTokenAtoms;
struct InspectorColorToResultAtoms;
struct InspectorDeclarationAtoms;
class InspectorFontFace;
struct InspectorFontFeatureAtoms;
struct InspectorRGBATupleAtoms;
struct InspectorStyleSheetRuleCountAndAtRulesResultAtoms;
class InspectorUtils;
struct InspectorVariationAxisAtoms;
struct InspectorVariationInstanceAtoms;
struct InspectorVariationValue;
struct InspectorVariationValueAtoms;
struct NativePropertyHooks;
class OwningCSSRuleOrInspectorDeclaration;
struct PropertyNamesOptionsAtoms;
struct PropertyPrefAtoms;
class ProtoAndIfaceCache;
struct SupportsOptionsAtoms;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class DeclarationOrigin : uint8_t {
User,
User_agent,
Pres_hints,
Style_attribute,
Animations,
Transitions,
Smil,
};
namespace binding_detail {
template <> struct EnumStrings<DeclarationOrigin> {
static constexpr nsLiteralCString Values[7] {
"user"_ns,
"user-agent"_ns,
"pres-hints"_ns,
"style-attribute"_ns,
"animations"_ns,
"transitions"_ns,
"smil"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, DeclarationOrigin aArgument, JS::MutableHandle<JS::Value> aValue);
enum class InspectorPropertyType : uint8_t {
Color,
Gradient,
Timing_function,
};
namespace binding_detail {
template <> struct EnumStrings<InspectorPropertyType> {
static constexpr nsLiteralCString Values[3] {
"color"_ns,
"gradient"_ns,
"timing-function"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, InspectorPropertyType aArgument, JS::MutableHandle<JS::Value> aValue);
void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningCSSRuleOrInspectorDeclaration& aUnion, const char* aName, uint32_t aFlags = 0);
void
ImplCycleCollectionUnlink(OwningCSSRuleOrInspectorDeclaration& aUnion);
struct InspectorCSSPropertyDefinition : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mFromJS;
MOZ_INIT_OUTSIDE_CTOR bool mInherits;
MOZ_INIT_OUTSIDE_CTOR nsCString mInitialValue;
MOZ_INIT_OUTSIDE_CTOR nsCString mName;
MOZ_INIT_OUTSIDE_CTOR nsCString mSyntax;
InspectorCSSPropertyDefinition();
explicit inline InspectorCSSPropertyDefinition(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorCSSPropertyDefinition(InspectorCSSPropertyDefinition&& aOther) = default;
explicit inline InspectorCSSPropertyDefinition(const InspectorCSSPropertyDefinition& 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);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
InspectorCSSPropertyDefinition&
operator=(const InspectorCSSPropertyDefinition& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorCSSPropertyDefinitionAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorCSSPropertyDefinition : public InspectorCSSPropertyDefinition
{
inline FastInspectorCSSPropertyDefinition()
: InspectorCSSPropertyDefinition(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct InspectorCSSToken : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Nullable<double> mNumber;
MOZ_INIT_OUTSIDE_CTOR nsCString mText;
MOZ_INIT_OUTSIDE_CTOR nsCString mTokenType;
MOZ_INIT_OUTSIDE_CTOR nsCString mUnit;
MOZ_INIT_OUTSIDE_CTOR nsCString mValue;
InspectorCSSToken();
explicit inline InspectorCSSToken(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorCSSToken(InspectorCSSToken&& aOther) = default;
explicit inline InspectorCSSToken(const InspectorCSSToken& 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);
InspectorCSSToken&
operator=(const InspectorCSSToken& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorCSSTokenAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorCSSToken : public InspectorCSSToken
{
inline FastInspectorCSSToken()
: InspectorCSSToken(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct InspectorColorToResult : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mAdjusted;
MOZ_INIT_OUTSIDE_CTOR nsString mColor;
MOZ_INIT_OUTSIDE_CTOR Sequence<float> mComponents;
InspectorColorToResult();
explicit inline InspectorColorToResult(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorColorToResult(InspectorColorToResult&& aOther) = default;
explicit inline InspectorColorToResult(const InspectorColorToResult& 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);
InspectorColorToResult&
operator=(const InspectorColorToResult& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorColorToResultAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorColorToResult : public InspectorColorToResult
{
inline FastInspectorColorToResult()
: InspectorColorToResult(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct InspectorDeclaration : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR DeclarationOrigin mDeclarationOrigin;
MOZ_INIT_OUTSIDE_CTOR OwningNonNull<nsICSSDeclaration> mStyle;
InspectorDeclaration();
explicit inline InspectorDeclaration(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorDeclaration(InspectorDeclaration&& aOther) = default;
explicit inline InspectorDeclaration(const InspectorDeclaration& 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);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
ImplCycleCollectionTraverse(aCallback, mStyle, "mStyle", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mStyle);
}
InspectorDeclaration&
operator=(const InspectorDeclaration& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorDeclarationAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorDeclaration : public InspectorDeclaration
{
inline FastInspectorDeclaration()
: InspectorDeclaration(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct InspectorFontFeature : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mLanguageSystem;
MOZ_INIT_OUTSIDE_CTOR nsString mScript;
MOZ_INIT_OUTSIDE_CTOR nsString mTag;
InspectorFontFeature();
explicit inline InspectorFontFeature(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorFontFeature(InspectorFontFeature&& aOther) = default;
explicit inline InspectorFontFeature(const InspectorFontFeature& 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);
InspectorFontFeature&
operator=(const InspectorFontFeature& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorFontFeatureAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorFontFeature : public InspectorFontFeature
{
inline FastInspectorFontFeature()
: InspectorFontFeature(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct InspectorRGBATuple : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR double mA;
MOZ_INIT_OUTSIDE_CTOR double mB;
MOZ_INIT_OUTSIDE_CTOR double mG;
MOZ_INIT_OUTSIDE_CTOR double mR;
InspectorRGBATuple();
explicit inline InspectorRGBATuple(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorRGBATuple(InspectorRGBATuple&& aOther) = default;
explicit inline InspectorRGBATuple(const InspectorRGBATuple& 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);
InspectorRGBATuple&
operator=(const InspectorRGBATuple& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorRGBATupleAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorRGBATuple : public InspectorRGBATuple
{
inline FastInspectorRGBATuple()
: InspectorRGBATuple(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct InspectorStyleSheetRuleCountAndAtRulesResult : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Sequence<OwningNonNull<mozilla::css::Rule>> mAtRules;
MOZ_INIT_OUTSIDE_CTOR uint32_t mRuleCount;
InspectorStyleSheetRuleCountAndAtRulesResult();
explicit inline InspectorStyleSheetRuleCountAndAtRulesResult(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorStyleSheetRuleCountAndAtRulesResult(InspectorStyleSheetRuleCountAndAtRulesResult&& aOther) = default;
explicit inline InspectorStyleSheetRuleCountAndAtRulesResult(const InspectorStyleSheetRuleCountAndAtRulesResult& 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);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
ImplCycleCollectionTraverse(aCallback, mAtRules, "mAtRules", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mAtRules);
}
InspectorStyleSheetRuleCountAndAtRulesResult&
operator=(const InspectorStyleSheetRuleCountAndAtRulesResult& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorStyleSheetRuleCountAndAtRulesResultAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorStyleSheetRuleCountAndAtRulesResult : public InspectorStyleSheetRuleCountAndAtRulesResult
{
inline FastInspectorStyleSheetRuleCountAndAtRulesResult()
: InspectorStyleSheetRuleCountAndAtRulesResult(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct InspectorVariationAxis : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR float mDefaultValue;
MOZ_INIT_OUTSIDE_CTOR float mMaxValue;
MOZ_INIT_OUTSIDE_CTOR float mMinValue;
MOZ_INIT_OUTSIDE_CTOR nsString mName;
MOZ_INIT_OUTSIDE_CTOR nsString mTag;
InspectorVariationAxis();
explicit inline InspectorVariationAxis(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorVariationAxis(InspectorVariationAxis&& aOther) = default;
explicit inline InspectorVariationAxis(const InspectorVariationAxis& 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);
InspectorVariationAxis&
operator=(const InspectorVariationAxis& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorVariationAxisAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorVariationAxis : public InspectorVariationAxis
{
inline FastInspectorVariationAxis()
: InspectorVariationAxis(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct InspectorVariationValue : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mAxis;
MOZ_INIT_OUTSIDE_CTOR float mValue;
InspectorVariationValue();
explicit inline InspectorVariationValue(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorVariationValue(InspectorVariationValue&& aOther) = default;
explicit inline InspectorVariationValue(const InspectorVariationValue& 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);
InspectorVariationValue&
operator=(const InspectorVariationValue& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorVariationValueAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorVariationValue : public InspectorVariationValue
{
inline FastInspectorVariationValue()
: InspectorVariationValue(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct PropertyNamesOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mIncludeAliases;
MOZ_INIT_OUTSIDE_CTOR bool mIncludeExperimentals;
MOZ_INIT_OUTSIDE_CTOR bool mIncludeShorthands;
PropertyNamesOptions();
explicit inline PropertyNamesOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
PropertyNamesOptions(PropertyNamesOptions&& aOther) = default;
explicit inline PropertyNamesOptions(const PropertyNamesOptions& 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);
PropertyNamesOptions&
operator=(const PropertyNamesOptions& aOther);
private:
static bool
InitIds(JSContext* cx, PropertyNamesOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastPropertyNamesOptions : public PropertyNamesOptions
{
inline FastPropertyNamesOptions()
: PropertyNamesOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct PropertyPref : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mName;
MOZ_INIT_OUTSIDE_CTOR nsString mPref;
PropertyPref();
explicit inline PropertyPref(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
PropertyPref(PropertyPref&& aOther) = default;
explicit inline PropertyPref(const PropertyPref& 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);
PropertyPref&
operator=(const PropertyPref& aOther);
private:
static bool
InitIds(JSContext* cx, PropertyPrefAtoms* atomsCache);
};
namespace binding_detail {
struct FastPropertyPref : public PropertyPref
{
inline FastPropertyPref()
: PropertyPref(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct SupportsOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mChrome;
MOZ_INIT_OUTSIDE_CTOR bool mQuirks;
MOZ_INIT_OUTSIDE_CTOR bool mUserAgent;
SupportsOptions();
explicit inline SupportsOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
SupportsOptions(SupportsOptions&& aOther) = default;
explicit inline SupportsOptions(const SupportsOptions& 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);
SupportsOptions&
operator=(const SupportsOptions& aOther);
private:
static bool
InitIds(JSContext* cx, SupportsOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastSupportsOptions : public SupportsOptions
{
inline FastSupportsOptions()
: SupportsOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
class CSSRuleOrInspectorDeclaration : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eCSSRule,
eInspectorDeclaration
};
public:
enum class Type
{
eCSSRule = TypeOrUninit::eCSSRule,
eInspectorDeclaration = TypeOrUninit::eInspectorDeclaration
};
private:
union Value
{
UnionMember<NonNull<mozilla::css::Rule> > mCSSRule;
UnionMember<binding_detail::FastInspectorDeclaration > mInspectorDeclaration;
};
TypeOrUninit mType;
Value mValue;
CSSRuleOrInspectorDeclaration(const CSSRuleOrInspectorDeclaration&) = delete;
CSSRuleOrInspectorDeclaration& operator=(const CSSRuleOrInspectorDeclaration&) = delete;
public:
explicit inline CSSRuleOrInspectorDeclaration()
: mType(eUninitialized)
{
}
inline ~CSSRuleOrInspectorDeclaration()
{
Uninit();
}
[[nodiscard]] inline NonNull<mozilla::css::Rule>&
RawSetAsCSSRule()
{
if (mType == eCSSRule) {
return mValue.mCSSRule.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eCSSRule;
return mValue.mCSSRule.SetValue();
}
[[nodiscard]] inline NonNull<mozilla::css::Rule>&
SetAsCSSRule()
{
if (mType == eCSSRule) {
return mValue.mCSSRule.Value();
}
Uninit();
mType = eCSSRule;
return mValue.mCSSRule.SetValue();
}
inline bool
IsCSSRule() const
{
return mType == eCSSRule;
}
inline NonNull<mozilla::css::Rule>&
GetAsCSSRule()
{
MOZ_RELEASE_ASSERT(IsCSSRule(), "Wrong type!");
return mValue.mCSSRule.Value();
}
inline mozilla::css::Rule&
GetAsCSSRule() const
{
MOZ_RELEASE_ASSERT(IsCSSRule(), "Wrong type!");
return mValue.mCSSRule.Value();
}
[[nodiscard]] inline binding_detail::FastInspectorDeclaration&
RawSetAsInspectorDeclaration()
{
if (mType == eInspectorDeclaration) {
return mValue.mInspectorDeclaration.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eInspectorDeclaration;
return mValue.mInspectorDeclaration.SetValue();
}
[[nodiscard]] inline binding_detail::FastInspectorDeclaration&
SetAsInspectorDeclaration()
{
if (mType == eInspectorDeclaration) {
return mValue.mInspectorDeclaration.Value();
}
Uninit();
mType = eInspectorDeclaration;
return mValue.mInspectorDeclaration.SetValue();
}
inline bool
IsInspectorDeclaration() const
{
return mType == eInspectorDeclaration;
}
inline binding_detail::FastInspectorDeclaration&
GetAsInspectorDeclaration()
{
MOZ_RELEASE_ASSERT(IsInspectorDeclaration(), "Wrong type!");
return mValue.mInspectorDeclaration.Value();
}
inline const InspectorDeclaration&
GetAsInspectorDeclaration() const
{
MOZ_RELEASE_ASSERT(IsInspectorDeclaration(), "Wrong type!");
return mValue.mInspectorDeclaration.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 eCSSRule: {
DestroyCSSRule();
break;
}
case eInspectorDeclaration: {
DestroyInspectorDeclaration();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToCSSRule(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToCSSRule(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyCSSRule()
{
MOZ_RELEASE_ASSERT(IsCSSRule(), "Wrong type!");
mValue.mCSSRule.Destroy();
mType = eUninitialized;
}
bool
TrySetToInspectorDeclaration(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToInspectorDeclaration(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyInspectorDeclaration()
{
MOZ_RELEASE_ASSERT(IsInspectorDeclaration(), "Wrong type!");
mValue.mInspectorDeclaration.Destroy();
mType = eUninitialized;
}
};
class OwningCSSRuleOrInspectorDeclaration : public AllOwningUnionBase
{
friend void ImplCycleCollectionUnlink(OwningCSSRuleOrInspectorDeclaration& aUnion);
enum TypeOrUninit
{
eUninitialized,
eCSSRule,
eInspectorDeclaration
};
public:
enum class Type
{
eCSSRule = TypeOrUninit::eCSSRule,
eInspectorDeclaration = TypeOrUninit::eInspectorDeclaration
};
private:
union Value
{
UnionMember<OwningNonNull<mozilla::css::Rule> > mCSSRule;
UnionMember<InspectorDeclaration > mInspectorDeclaration;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningCSSRuleOrInspectorDeclaration()
: mType(eUninitialized)
{
}
OwningCSSRuleOrInspectorDeclaration(OwningCSSRuleOrInspectorDeclaration&& aOther);
explicit inline OwningCSSRuleOrInspectorDeclaration(const OwningCSSRuleOrInspectorDeclaration& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningCSSRuleOrInspectorDeclaration()
{
Uninit();
}
[[nodiscard]] OwningNonNull<mozilla::css::Rule>&
RawSetAsCSSRule();
[[nodiscard]] OwningNonNull<mozilla::css::Rule>&
SetAsCSSRule();
inline bool
IsCSSRule() const
{
return mType == eCSSRule;
}
inline OwningNonNull<mozilla::css::Rule>&
GetAsCSSRule()
{
MOZ_RELEASE_ASSERT(IsCSSRule(), "Wrong type!");
return mValue.mCSSRule.Value();
}
inline OwningNonNull<mozilla::css::Rule> const &
GetAsCSSRule() const
{
MOZ_RELEASE_ASSERT(IsCSSRule(), "Wrong type!");
return mValue.mCSSRule.Value();
}
[[nodiscard]] InspectorDeclaration&
RawSetAsInspectorDeclaration();
[[nodiscard]] InspectorDeclaration&
SetAsInspectorDeclaration();
inline bool
IsInspectorDeclaration() const
{
return mType == eInspectorDeclaration;
}
inline InspectorDeclaration&
GetAsInspectorDeclaration()
{
MOZ_RELEASE_ASSERT(IsInspectorDeclaration(), "Wrong type!");
return mValue.mInspectorDeclaration.Value();
}
inline InspectorDeclaration const &
GetAsInspectorDeclaration() const
{
MOZ_RELEASE_ASSERT(IsInspectorDeclaration(), "Wrong type!");
return mValue.mInspectorDeclaration.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;
OwningCSSRuleOrInspectorDeclaration&
operator=(OwningCSSRuleOrInspectorDeclaration&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningCSSRuleOrInspectorDeclaration&
operator=(const OwningCSSRuleOrInspectorDeclaration& aOther);
private:
bool
TrySetToCSSRule(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToCSSRule(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyCSSRule();
bool
TrySetToInspectorDeclaration(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToInspectorDeclaration(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyInspectorDeclaration();
};
struct InspectorVariationInstance : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mName;
MOZ_INIT_OUTSIDE_CTOR Sequence<InspectorVariationValue> mValues;
InspectorVariationInstance();
explicit inline InspectorVariationInstance(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
InspectorVariationInstance(InspectorVariationInstance&& aOther) = default;
explicit inline InspectorVariationInstance(const InspectorVariationInstance& 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);
InspectorVariationInstance&
operator=(const InspectorVariationInstance& aOther);
private:
static bool
InitIds(JSContext* cx, InspectorVariationInstanceAtoms* atomsCache);
};
namespace binding_detail {
struct FastInspectorVariationInstance : public InspectorVariationInstance
{
inline FastInspectorVariationInstance()
: InspectorVariationInstance(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace InspectorCSSParser_Binding {
typedef mozilla::dom::InspectorCSSParser NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::InspectorCSSParser* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
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::InspectorCSSParser,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace InspectorCSSParser_Binding
namespace InspectorFontFace_Binding {
typedef mozilla::dom::InspectorFontFace NativeType;
static const uint16_t NAME_ID_COPYRIGHT = 0;
static const uint16_t NAME_ID_FAMILY = 1;
static const uint16_t NAME_ID_SUBFAMILY = 2;
static const uint16_t NAME_ID_UNIQUE = 3;
static const uint16_t NAME_ID_FULL = 4;
static const uint16_t NAME_ID_VERSION = 5;
static const uint16_t NAME_ID_POSTSCRIPT = 6;
static const uint16_t NAME_ID_TRADEMARK = 7;
static const uint16_t NAME_ID_MANUFACTURER = 8;
static const uint16_t NAME_ID_DESIGNER = 9;
static const uint16_t NAME_ID_DESCRIPTION = 10;
static const uint16_t NAME_ID_VENDOR_URL = 11;
static const uint16_t NAME_ID_DESIGNER_URL = 12;
static const uint16_t NAME_ID_LICENSE = 13;
static const uint16_t NAME_ID_LICENSE_URL = 14;
static const uint16_t NAME_ID_TYPOGRAPHIC_FAMILY = 16;
static const uint16_t NAME_ID_TYPOGRAPHIC_SUBFAMILY = 17;
static const uint16_t NAME_ID_COMPATIBLE_FULL = 18;
static const uint16_t NAME_ID_SAMPLE_TEXT = 19;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::InspectorFontFace* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
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::InspectorFontFace,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace InspectorFontFace_Binding
namespace InspectorUtils_Binding {
typedef mozilla::dom::InspectorUtils NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
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::InspectorUtils,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace InspectorUtils_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::DeclarationOrigin>
{
static constexpr dom::DeclarationOrigin value = dom::DeclarationOrigin::Smil;
static_assert(static_cast<uint8_t>(dom::DeclarationOrigin::User) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::DeclarationOrigin>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::InspectorPropertyType>
{
static constexpr dom::InspectorPropertyType value = dom::InspectorPropertyType::Timing_function;
static_assert(static_cast<uint8_t>(dom::InspectorPropertyType::Color) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::InspectorPropertyType>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_INSPECTORUTILSBINDING_H_