Bug 851892 part 4. Make css::Rule wrappercached. r=heycam,peterv

Note that this increases the size of css::Rule by three words, unfortunately.
This commit is contained in:
Boris Zbarsky 2017-01-13 10:41:02 -05:00
Родитель add14f2176
Коммит d4570e4e2e
10 изменённых файлов: 217 добавлений и 9 удалений

Просмотреть файл

@ -19,10 +19,25 @@ namespace dom {
class TabChildGlobal; class TabChildGlobal;
class ProcessGlobal; class ProcessGlobal;
} // namespace dom } // namespace dom
namespace css {
class ImportRule;
class NameSpaceRule;
class StyleRule;
class MediaRule;
class DocumentRule;
} // namespace css
class ServoStyleRule;
class CSSSupportsRule;
} // namespace mozilla } // namespace mozilla
class SandboxPrivate; class SandboxPrivate;
class nsInProcessTabChildGlobal; class nsInProcessTabChildGlobal;
class nsWindowRoot; class nsWindowRoot;
class nsCSSFontFaceRule;
class nsCSSFontFeatureValuesRule;
class nsCSSKeyframeRule;
class nsCSSKeyframesRule;
class nsCSSPageRule;
class nsCSSCounterStyleRule;
#define NS_WRAPPERCACHE_IID \ #define NS_WRAPPERCACHE_IID \
{ 0x6f3179a1, 0x36f7, 0x4a5c, \ { 0x6f3179a1, 0x36f7, 0x4a5c, \
@ -272,11 +287,27 @@ protected:
} }
private: private:
// Friend declarations for things that need to be able to call
// SetIsNotDOMBinding(). The goal is to get rid of all of these, and
// SetIsNotDOMBinding() too.
friend class mozilla::dom::TabChildGlobal; friend class mozilla::dom::TabChildGlobal;
friend class mozilla::dom::ProcessGlobal; friend class mozilla::dom::ProcessGlobal;
friend class SandboxPrivate; friend class SandboxPrivate;
friend class nsInProcessTabChildGlobal; friend class nsInProcessTabChildGlobal;
friend class nsWindowRoot; friend class nsWindowRoot;
friend class mozilla::css::ImportRule;
friend class mozilla::css::NameSpaceRule;
friend class mozilla::css::StyleRule;
friend class mozilla::css::MediaRule;
friend class mozilla::css::DocumentRule;
friend class mozilla::ServoStyleRule;
friend class mozilla::CSSSupportsRule;
friend class nsCSSFontFaceRule;
friend class nsCSSFontFeatureValuesRule;
friend class nsCSSKeyframeRule;
friend class nsCSSKeyframesRule;
friend class nsCSSPageRule;
friend class nsCSSCounterStyleRule;
void SetIsNotDOMBinding() void SetIsNotDOMBinding()
{ {
MOZ_ASSERT(!mWrapper && !(GetWrapperFlags() & ~WRAPPER_IS_NOT_DOM_BINDING), MOZ_ASSERT(!mWrapper && !(GetWrapperFlags() & ~WRAPPER_IS_NOT_DOM_BINDING),

Просмотреть файл

@ -52,6 +52,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// nsIDOMCSSRule interface // nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE NS_DECL_NSIDOMCSSRULE

Просмотреть файл

@ -54,6 +54,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
override MOZ_MUST_OVERRIDE; override MOZ_MUST_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// nsIDOMCSSRule interface // nsIDOMCSSRule interface
NS_DECL_NSIDOMCSSRULE NS_DECL_NSIDOMCSSRULE

Просмотреть файл

@ -12,6 +12,7 @@
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "nsISupports.h" #include "nsISupports.h"
#include "nsIDOMCSSRule.h" #include "nsIDOMCSSRule.h"
#include "nsWrapperCache.h"
class nsIDocument; class nsIDocument;
struct nsRuleData; struct nsRuleData;
@ -29,7 +30,9 @@ class GroupRule;
DECL_STYLE_RULE_INHERIT_NO_DOMRULE \ DECL_STYLE_RULE_INHERIT_NO_DOMRULE \
virtual nsIDOMCSSRule* GetDOMRule() override; virtual nsIDOMCSSRule* GetDOMRule() override;
class Rule : public nsISupports { class Rule : public nsISupports
, public nsWrapperCache
{
protected: protected:
Rule(uint32_t aLineNumber, uint32_t aColumnNumber) Rule(uint32_t aLineNumber, uint32_t aColumnNumber)
: mSheet(nullptr), : mSheet(nullptr),
@ -52,7 +55,7 @@ protected:
public: public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(Rule) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Rule)
#ifdef DEBUG #ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const = 0; virtual void List(FILE* out = stdout, int32_t aIndent = 0) const = 0;

Просмотреть файл

@ -104,6 +104,7 @@ ServoStyleRule::ServoStyleRule(already_AddRefed<RawServoStyleRule> aRawRule)
, mRawRule(aRawRule) , mRawRule(aRawRule)
, mDecls(Servo_StyleRule_GetStyle(mRawRule).Consume()) , mDecls(Servo_StyleRule_GetStyle(mRawRule).Consume())
{ {
SetIsNotDOMBinding();
} }
// QueryInterface implementation for ServoStyleRule // QueryInterface implementation for ServoStyleRule
@ -152,6 +153,14 @@ ServoStyleRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
return aMallocSizeOf(this); return aMallocSizeOf(this);
} }
/* virtual */ JSObject*
ServoStyleRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
#ifdef DEBUG #ifdef DEBUG
void void
ServoStyleRule::List(FILE* out, int32_t aIndent) const ServoStyleRule::List(FILE* out, int32_t aIndent) const

Просмотреть файл

@ -66,6 +66,8 @@ public:
already_AddRefed<Rule> Clone() const final; already_AddRefed<Rule> Clone() const final;
nsIDOMCSSRule* GetDOMRule() final { return this; } nsIDOMCSSRule* GetDOMRule() final { return this; }
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final; size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
#ifdef DEBUG #ifdef DEBUG
void List(FILE* out = stdout, int32_t aIndent = 0) const final; void List(FILE* out = stdout, int32_t aIndent = 0) const final;
#endif #endif

Просмотреть файл

@ -1380,6 +1380,7 @@ StyleRule::StyleRule(nsCSSSelectorList* aSelector,
mSelector(aSelector), mSelector(aSelector),
mDeclaration(aDeclaration) mDeclaration(aDeclaration)
{ {
SetIsNotDOMBinding();
NS_PRECONDITION(aDeclaration, "must have a declaration"); NS_PRECONDITION(aDeclaration, "must have a declaration");
mDeclaration->SetOwningRule(this); mDeclaration->SetOwningRule(this);
@ -1391,6 +1392,7 @@ StyleRule::StyleRule(const StyleRule& aCopy)
mSelector(aCopy.mSelector ? aCopy.mSelector->Clone() : nullptr), mSelector(aCopy.mSelector ? aCopy.mSelector->Clone() : nullptr),
mDeclaration(new Declaration(*aCopy.mDeclaration)) mDeclaration(new Declaration(*aCopy.mDeclaration))
{ {
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this); mDeclaration->SetOwningRule(this);
// rest is constructed lazily on existing data // rest is constructed lazily on existing data
} }
@ -1574,6 +1576,14 @@ StyleRule::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
return n; return n;
} }
/* virtual */ JSObject*
StyleRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
} // namespace css } // namespace css
} // namespace mozilla } // namespace mozilla

Просмотреть файл

@ -354,6 +354,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
private: private:
~StyleRule(); ~StyleRule();

Просмотреть файл

@ -57,10 +57,11 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(Rule)
NS_IMPL_CYCLE_COLLECTING_RELEASE(Rule) NS_IMPL_CYCLE_COLLECTING_RELEASE(Rule)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Rule) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Rule)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_0(Rule) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(Rule)
/* virtual */ void /* virtual */ void
Rule::SetStyleSheet(StyleSheet* aSheet) Rule::SetStyleSheet(StyleSheet* aSheet)
@ -179,6 +180,7 @@ ImportRule::ImportRule(nsMediaList* aMedia, const nsString& aURLSpec,
, mURLSpec(aURLSpec) , mURLSpec(aURLSpec)
, mMedia(aMedia) , mMedia(aMedia)
{ {
SetIsNotDOMBinding();
// XXXbz This is really silly.... the mMedia here will be replaced // XXXbz This is really silly.... the mMedia here will be replaced
// with itself if we manage to load a sheet. Which should really // with itself if we manage to load a sheet. Which should really
// never fail nowadays, in sane cases. // never fail nowadays, in sane cases.
@ -188,6 +190,7 @@ ImportRule::ImportRule(const ImportRule& aCopy)
: Rule(aCopy), : Rule(aCopy),
mURLSpec(aCopy.mURLSpec) mURLSpec(aCopy.mURLSpec)
{ {
SetIsNotDOMBinding();
// Whether or not an @import rule has a null sheet is a permanent // Whether or not an @import rule has a null sheet is a permanent
// property of that @import rule, since it is null only if the target // property of that @import rule, since it is null only if the target
// sheet failed security checks. // sheet failed security checks.
@ -357,6 +360,14 @@ ImportRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
// - mChildSheet, because it is measured via CSSStyleSheetInner::mSheets // - mChildSheet, because it is measured via CSSStyleSheetInner::mSheets
} }
/* virtual */ JSObject*
ImportRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
GroupRule::GroupRule(uint32_t aLineNumber, uint32_t aColumnNumber) GroupRule::GroupRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: Rule(aLineNumber, aColumnNumber) : Rule(aLineNumber, aColumnNumber)
{ {
@ -588,11 +599,13 @@ GroupRule::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
MediaRule::MediaRule(uint32_t aLineNumber, uint32_t aColumnNumber) MediaRule::MediaRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: GroupRule(aLineNumber, aColumnNumber) : GroupRule(aLineNumber, aColumnNumber)
{ {
SetIsNotDOMBinding();
} }
MediaRule::MediaRule(const MediaRule& aCopy) MediaRule::MediaRule(const MediaRule& aCopy)
: GroupRule(aCopy) : GroupRule(aCopy)
{ {
SetIsNotDOMBinding();
if (aCopy.mMedia) { if (aCopy.mMedia) {
mMedia = aCopy.mMedia->Clone(); mMedia = aCopy.mMedia->Clone();
// XXXldb This doesn't really make sense. // XXXldb This doesn't really make sense.
@ -803,6 +816,14 @@ MediaRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
return n; return n;
} }
/* virtual */ JSObject*
MediaRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
void void
MediaRule::AppendConditionText(nsAString& aOutput) MediaRule::AppendConditionText(nsAString& aOutput)
{ {
@ -816,12 +837,14 @@ MediaRule::AppendConditionText(nsAString& aOutput)
DocumentRule::DocumentRule(uint32_t aLineNumber, uint32_t aColumnNumber) DocumentRule::DocumentRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: GroupRule(aLineNumber, aColumnNumber) : GroupRule(aLineNumber, aColumnNumber)
{ {
SetIsNotDOMBinding();
} }
DocumentRule::DocumentRule(const DocumentRule& aCopy) DocumentRule::DocumentRule(const DocumentRule& aCopy)
: GroupRule(aCopy) : GroupRule(aCopy)
, mURLs(new URL(*aCopy.mURLs)) , mURLs(new URL(*aCopy.mURLs))
{ {
SetIsNotDOMBinding();
} }
DocumentRule::~DocumentRule() DocumentRule::~DocumentRule()
@ -1044,6 +1067,14 @@ DocumentRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
return n; return n;
} }
/* virtual */ JSObject*
DocumentRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
void void
DocumentRule::AppendConditionText(nsAString& aCssText) DocumentRule::AppendConditionText(nsAString& aCssText)
{ {
@ -1079,6 +1110,7 @@ NameSpaceRule::NameSpaceRule(nsIAtom* aPrefix, const nsString& aURLSpec,
mPrefix(aPrefix), mPrefix(aPrefix),
mURLSpec(aURLSpec) mURLSpec(aURLSpec)
{ {
SetIsNotDOMBinding();
} }
NameSpaceRule::NameSpaceRule(const NameSpaceRule& aCopy) NameSpaceRule::NameSpaceRule(const NameSpaceRule& aCopy)
@ -1086,6 +1118,7 @@ NameSpaceRule::NameSpaceRule(const NameSpaceRule& aCopy)
mPrefix(aCopy.mPrefix), mPrefix(aCopy.mPrefix),
mURLSpec(aCopy.mURLSpec) mURLSpec(aCopy.mURLSpec)
{ {
SetIsNotDOMBinding();
} }
NameSpaceRule::~NameSpaceRule() NameSpaceRule::~NameSpaceRule()
@ -1203,6 +1236,13 @@ NameSpaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
// - mURLSpec // - mURLSpec
} }
/* virtual */ JSObject*
NameSpaceRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
} // namespace css } // namespace css
} // namespace mozilla } // namespace mozilla
@ -1666,6 +1706,13 @@ nsCSSFontFaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
// - mDecl // - mDecl
} }
/* virtual */ JSObject*
nsCSSFontFaceRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
// ----------------------------------- // -----------------------------------
// nsCSSFontFeatureValuesRule // nsCSSFontFeatureValuesRule
@ -1905,6 +1952,14 @@ nsCSSFontFeatureValuesRule::SizeOfIncludingThis(
return aMallocSizeOf(this); return aMallocSizeOf(this);
} }
/* virtual */ JSObject*
nsCSSFontFeatureValuesRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
// ------------------------------------------- // -------------------------------------------
// nsCSSKeyframeStyleDeclaration // nsCSSKeyframeStyleDeclaration
// //
@ -1983,6 +2038,7 @@ nsCSSKeyframeRule::nsCSSKeyframeRule(const nsCSSKeyframeRule& aCopy)
, mKeys(aCopy.mKeys) , mKeys(aCopy.mKeys)
, mDeclaration(new css::Declaration(*aCopy.mDeclaration)) , mDeclaration(new css::Declaration(*aCopy.mDeclaration))
{ {
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this); mDeclaration->SetOwningRule(this);
} }
@ -2192,6 +2248,13 @@ nsCSSKeyframeRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
// - mDOMDeclaration // - mDOMDeclaration
} }
/* virtual */ JSObject*
nsCSSKeyframeRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
// ------------------------------------------- // -------------------------------------------
// nsCSSKeyframesRule // nsCSSKeyframesRule
@ -2204,6 +2267,7 @@ nsCSSKeyframesRule::nsCSSKeyframesRule(const nsCSSKeyframesRule& aCopy)
: GroupRule(aCopy), : GroupRule(aCopy),
mName(aCopy.mName) mName(aCopy.mName)
{ {
SetIsNotDOMBinding();
} }
nsCSSKeyframesRule::~nsCSSKeyframesRule() nsCSSKeyframesRule::~nsCSSKeyframesRule()
@ -2443,6 +2507,14 @@ nsCSSKeyframesRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
return n; return n;
} }
/* virtual */ JSObject*
nsCSSKeyframesRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
// ------------------------------------------- // -------------------------------------------
// nsCSSPageStyleDeclaration // nsCSSPageStyleDeclaration
// //
@ -2520,6 +2592,7 @@ nsCSSPageRule::nsCSSPageRule(const nsCSSPageRule& aCopy)
: Rule(aCopy) : Rule(aCopy)
, mDeclaration(new css::Declaration(*aCopy.mDeclaration)) , mDeclaration(new css::Declaration(*aCopy.mDeclaration))
{ {
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this); mDeclaration->SetOwningRule(this);
} }
@ -2661,6 +2734,14 @@ nsCSSPageRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
return aMallocSizeOf(this); return aMallocSizeOf(this);
} }
/* virtual */ JSObject*
nsCSSPageRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
namespace mozilla { namespace mozilla {
CSSSupportsRule::CSSSupportsRule(bool aConditionMet, CSSSupportsRule::CSSSupportsRule(bool aConditionMet,
@ -2670,6 +2751,7 @@ CSSSupportsRule::CSSSupportsRule(bool aConditionMet,
, mUseGroup(aConditionMet) , mUseGroup(aConditionMet)
, mCondition(aCondition) , mCondition(aCondition)
{ {
SetIsNotDOMBinding();
} }
CSSSupportsRule::~CSSSupportsRule() CSSSupportsRule::~CSSSupportsRule()
@ -2681,6 +2763,7 @@ CSSSupportsRule::CSSSupportsRule(const CSSSupportsRule& aCopy)
mUseGroup(aCopy.mUseGroup), mUseGroup(aCopy.mUseGroup),
mCondition(aCopy.mCondition) mCondition(aCopy.mCondition)
{ {
SetIsNotDOMBinding();
} }
#ifdef DEBUG #ifdef DEBUG
@ -2816,6 +2899,14 @@ CSSSupportsRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
return n; return n;
} }
/* virtual */ JSObject*
CSSSupportsRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}
} // namespace mozilla } // namespace mozilla
// ------------------------------------------- // -------------------------------------------
@ -2827,6 +2918,7 @@ nsCSSCounterStyleRule::nsCSSCounterStyleRule(const nsCSSCounterStyleRule& aCopy)
, mName(aCopy.mName) , mName(aCopy.mName)
, mGeneration(aCopy.mGeneration) , mGeneration(aCopy.mGeneration)
{ {
SetIsNotDOMBinding();
for (size_t i = 0; i < ArrayLength(mValues); ++i) { for (size_t i = 0; i < ArrayLength(mValues); ++i) {
mValues[i] = aCopy.mValues[i]; mValues[i] = aCopy.mValues[i];
} }
@ -3275,3 +3367,11 @@ nsCSSCounterStyleRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{ {
return aMallocSizeOf(this); return aMallocSizeOf(this);
} }
/* virtual */ JSObject*
nsCSSCounterStyleRule::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
NS_NOTREACHED("We called SetIsNotDOMBinding() in our constructor");
return nullptr;
}

Просмотреть файл

@ -95,6 +95,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const override MOZ_MUST_OVERRIDE; const override MOZ_MUST_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected: protected:
void AppendConditionText(nsAString& aOutput); void AppendConditionText(nsAString& aOutput);
@ -169,6 +172,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const override MOZ_MUST_OVERRIDE; const override MOZ_MUST_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected: protected:
void AppendConditionText(nsAString& aOutput); void AppendConditionText(nsAString& aOutput);
@ -235,11 +241,17 @@ class nsCSSFontFaceRule final : public mozilla::css::Rule,
{ {
public: public:
nsCSSFontFaceRule(uint32_t aLineNumber, uint32_t aColumnNumber) nsCSSFontFaceRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: mozilla::css::Rule(aLineNumber, aColumnNumber) {} : mozilla::css::Rule(aLineNumber, aColumnNumber)
{
SetIsNotDOMBinding();
}
nsCSSFontFaceRule(const nsCSSFontFaceRule& aCopy) nsCSSFontFaceRule(const nsCSSFontFaceRule& aCopy)
// copy everything except our reference count // copy everything except our reference count
: mozilla::css::Rule(aCopy), mDecl(aCopy.mDecl) {} : mozilla::css::Rule(aCopy), mDecl(aCopy.mDecl)
{
SetIsNotDOMBinding();
}
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsCSSFontFaceRule, NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsCSSFontFaceRule,
@ -264,6 +276,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
void GetDescriptors(mozilla::CSSFontFaceDescriptors& aDescriptors) const void GetDescriptors(mozilla::CSSFontFaceDescriptors& aDescriptors) const
{ aDescriptors = mDecl.mDescriptors; } { aDescriptors = mDecl.mDescriptors; }
@ -300,13 +315,19 @@ class nsCSSFontFeatureValuesRule final : public mozilla::css::Rule,
{ {
public: public:
nsCSSFontFeatureValuesRule(uint32_t aLineNumber, uint32_t aColumnNumber) nsCSSFontFeatureValuesRule(uint32_t aLineNumber, uint32_t aColumnNumber)
: mozilla::css::Rule(aLineNumber, aColumnNumber) {} : mozilla::css::Rule(aLineNumber, aColumnNumber)
{
SetIsNotDOMBinding();
}
nsCSSFontFeatureValuesRule(const nsCSSFontFeatureValuesRule& aCopy) nsCSSFontFeatureValuesRule(const nsCSSFontFeatureValuesRule& aCopy)
// copy everything except our reference count // copy everything except our reference count
: mozilla::css::Rule(aCopy), : mozilla::css::Rule(aCopy),
mFamilyList(aCopy.mFamilyList), mFamilyList(aCopy.mFamilyList),
mFeatureValues(aCopy.mFeatureValues) {} mFeatureValues(aCopy.mFeatureValues)
{
SetIsNotDOMBinding();
}
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
@ -337,6 +358,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected: protected:
~nsCSSFontFeatureValuesRule() {} ~nsCSSFontFeatureValuesRule() {}
@ -384,6 +408,7 @@ public:
, mKeys(mozilla::Move(aKeys)) , mKeys(mozilla::Move(aKeys))
, mDeclaration(mozilla::Move(aDeclaration)) , mDeclaration(mozilla::Move(aDeclaration))
{ {
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this); mDeclaration->SetOwningRule(this);
} }
private: private:
@ -414,6 +439,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
void DoGetKeyText(nsAString &aKeyText) const; void DoGetKeyText(nsAString &aKeyText) const;
private: private:
@ -432,6 +460,7 @@ public:
: mozilla::css::GroupRule(aLineNumber, aColumnNumber) : mozilla::css::GroupRule(aLineNumber, aColumnNumber)
, mName(aName) , mName(aName)
{ {
SetIsNotDOMBinding();
} }
private: private:
nsCSSKeyframesRule(const nsCSSKeyframesRule& aCopy); nsCSSKeyframesRule(const nsCSSKeyframesRule& aCopy);
@ -464,6 +493,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
private: private:
uint32_t FindRuleIndexForKey(const nsAString& aKey); uint32_t FindRuleIndexForKey(const nsAString& aKey);
@ -507,6 +539,7 @@ public:
: mozilla::css::Rule(aLineNumber, aColumnNumber) : mozilla::css::Rule(aLineNumber, aColumnNumber)
, mDeclaration(aDeclaration) , mDeclaration(aDeclaration)
{ {
SetIsNotDOMBinding();
mDeclaration->SetOwningRule(this); mDeclaration->SetOwningRule(this);
} }
private: private:
@ -535,6 +568,10 @@ public:
void ChangeDeclaration(mozilla::css::Declaration* aDeclaration); void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
private: private:
RefPtr<mozilla::css::Declaration> mDeclaration; RefPtr<mozilla::css::Declaration> mDeclaration;
// lazily created when needed: // lazily created when needed:
@ -543,7 +580,7 @@ private:
namespace mozilla { namespace mozilla {
class CSSSupportsRule : public css::GroupRule, class CSSSupportsRule final : public css::GroupRule,
public nsIDOMCSSSupportsRule public nsIDOMCSSSupportsRule
{ {
public: public:
@ -580,6 +617,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected: protected:
virtual ~CSSSupportsRule(); virtual ~CSSSupportsRule();
@ -599,6 +639,7 @@ public:
, mName(aName) , mName(aName)
, mGeneration(0) , mGeneration(0)
{ {
SetIsNotDOMBinding();
} }
private: private:
@ -646,6 +687,9 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
private: private:
typedef NS_STDCALL_FUNCPROTO(nsresult, Getter, nsCSSCounterStyleRule, typedef NS_STDCALL_FUNCPROTO(nsresult, Getter, nsCSSCounterStyleRule,
GetSymbols, (nsAString&)); GetSymbols, (nsAString&));