diff --git a/layout/style/Rule.h b/layout/style/Rule.h index fb3efa8a588..99c6d01a144 100644 --- a/layout/style/Rule.h +++ b/layout/style/Rule.h @@ -33,7 +33,7 @@ class GroupRule; class Rule : public nsISupports { protected: Rule(uint32_t aLineNumber, uint32_t aColumnNumber) - : mSheet(0), + : mSheet(nullptr), mParentRule(nullptr), mLineNumber(aLineNumber), mColumnNumber(aColumnNumber) @@ -80,8 +80,7 @@ public: virtual int32_t GetType() const = 0; - CSSStyleSheet* GetStyleSheet() const; - nsHTMLCSSStyleSheet* GetHTMLCSSStyleSheet() const; + CSSStyleSheet* GetStyleSheet() const { return mSheet; } // Return the document the rule lives in, if any nsIDocument* GetDocument() const @@ -91,9 +90,6 @@ public: } virtual void SetStyleSheet(CSSStyleSheet* aSheet); - // This does not need to be virtual, because GroupRule and MediaRule are not - // used for inline style. - void SetHTMLCSSStyleSheet(nsHTMLCSSStyleSheet* aSheet); void SetParentRule(GroupRule* aRule) { // We don't reference count this up reference. The group rule @@ -133,9 +129,8 @@ public: void* aData); protected: - // This is either a CSSStyleSheet* or an nsHTMLStyleSheet*. The former - // if the low bit is 0, the latter if the low bit is 1. - uintptr_t mSheet; + // This is sometimes null (e.g., for style attributes). + CSSStyleSheet* mSheet; // When the parent GroupRule is destroyed, it will call SetParentRule(nullptr) // on this object. (Through SetParentRuleReference); GroupRule* MOZ_NON_OWNING_REF mParentRule; diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index 05b4ded88d1..2ad5c4da2a2 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -55,43 +55,13 @@ IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(class_, super_) namespace mozilla { namespace css { -CSSStyleSheet* -Rule::GetStyleSheet() const -{ - if (!(mSheet & 0x1)) { - return reinterpret_cast(mSheet); - } - - return nullptr; -} - -nsHTMLCSSStyleSheet* -Rule::GetHTMLCSSStyleSheet() const -{ - if (mSheet & 0x1) { - return reinterpret_cast(mSheet & ~uintptr_t(0x1)); - } - - return nullptr; -} - /* virtual */ void Rule::SetStyleSheet(CSSStyleSheet* aSheet) { // We don't reference count this up reference. The style sheet // will tell us when it's going away or when we're detached from // it. - mSheet = reinterpret_cast(aSheet); -} - -void -Rule::SetHTMLCSSStyleSheet(nsHTMLCSSStyleSheet* aSheet) -{ - // We don't reference count this up reference. The style sheet - // will tell us when it's going away or when we're detached from - // it. - mSheet = reinterpret_cast(aSheet); - mSheet |= 0x1; + mSheet = aSheet; } nsresult