diff --git a/content/base/src/nsRuleNode.cpp b/content/base/src/nsRuleNode.cpp index f26df07f0131..1b8fd8160be9 100644 --- a/content/base/src/nsRuleNode.cpp +++ b/content/base/src/nsRuleNode.cpp @@ -102,7 +102,7 @@ public: */ struct ChildrenHashEntry : public PLDHashEntryHdr { - // key (the rule) is |mRuleNode->Rule()| + // key (the rule) is |mRuleNode->GetRule()| nsRuleNode *mRuleNode; }; @@ -110,7 +110,7 @@ PR_STATIC_CALLBACK(const void *) ChildrenHashGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) { ChildrenHashEntry *entry = NS_STATIC_CAST(ChildrenHashEntry*, hdr); - return entry->mRuleNode->Rule(); + return entry->mRuleNode->GetRule(); } PR_STATIC_CALLBACK(PRBool) @@ -119,7 +119,7 @@ ChildrenHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, { const ChildrenHashEntry *entry = NS_STATIC_CAST(const ChildrenHashEntry*, hdr); - return entry->mRuleNode->Rule() == key; + return entry->mRuleNode->GetRule() == key; } static PLDHashTableOps ChildrenHashOps = { @@ -537,22 +537,6 @@ nsRuleNode::ConvertChildrenToHash() SetChildrenHash(hash); } -nsresult -nsRuleNode::PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched) -{ - *aMatched = PR_FALSE; - nsRuleNode* ruleDest = this; - while (ruleDest) { - if (ruleDest->mRule == aRule) { - *aMatched = PR_TRUE; - break; - } - ruleDest = ruleDest->mParent; - } - - return NS_OK; -} - PR_STATIC_CALLBACK(PLDHashOperator) ClearStyleDataHelper(PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg) @@ -582,14 +566,6 @@ nsRuleNode::ClearStyleData() return NS_OK; } -nsresult -nsRuleNode::GetPresContext(nsIPresContext** aResult) -{ - *aResult = mPresContext; - NS_IF_ADDREF(*aResult); - return NS_OK; -} - inline void nsRuleNode::PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode) { @@ -1943,10 +1919,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext, PRBool dummy; PRUint32 noneBits; PRUint32 fontBit = nsCachedStyleData::GetBitForSID(eStyleStruct_Font); - nsRuleNode* ruleNode = nsnull; - nsCOMPtr rule; - for (; i >= 0; --i) { nsStyleContext* context = (nsStyleContext*)contextPath[i]; nsRuleDataFont fontData; // Declare a struct with null CSS values. @@ -1954,17 +1927,15 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext, ruleData.mFontData = &fontData; // Trimmed down version of ::WalkRuleTree() to re-apply the style rules - context->GetRuleNode(&ruleNode); - while (ruleNode) { + for (nsRuleNode* ruleNode = context->GetRuleNode(); ruleNode; + ruleNode = ruleNode->GetParent()) { ruleNode->GetBits(nsRuleNode::eNoneBits, &noneBits); if (noneBits & fontBit) // no more font rules on this branch, get out break; - ruleNode->GetRule(getter_AddRefs(rule)); + nsIStyleRule *rule = ruleNode->GetRule(); if (rule) rule->MapRuleInfoInto(&ruleData); - - ruleNode = ruleNode->GetParent(); } // Compute the delta from the information that the rules specified diff --git a/content/base/src/nsStyleContext.cpp b/content/base/src/nsStyleContext.cpp index f6daeb03e547..3df4cd4b0267 100644 --- a/content/base/src/nsStyleContext.cpp +++ b/content/base/src/nsStyleContext.cpp @@ -92,7 +92,7 @@ nsStyleContext::~nsStyleContext() { NS_ASSERTION((nsnull == mChild) && (nsnull == mEmptyChild), "destructing context with children"); - nsIPresContext *presContext = mRuleNode->PresContext(); + nsIPresContext *presContext = mRuleNode->GetPresContext(); nsCOMPtr shell; presContext->GetShell(getter_AddRefs(shell)); @@ -347,14 +347,13 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct) char* resetOrInherit = NS_REINTERPRET_CAST(char*, *NS_REINTERPRET_CAST(void**, resetOrInheritSlot)); if (!resetOrInherit) { - nsCOMPtr presContext; - mRuleNode->GetPresContext(getter_AddRefs(presContext)); + nsIPresContext *presContext = mRuleNode->GetPresContext(); if (mCachedStyleData.IsReset(aSID)) { - mCachedStyleData.mResetData = new (presContext.get()) nsResetStyleData; + mCachedStyleData.mResetData = new (presContext) nsResetStyleData; resetOrInherit = NS_REINTERPRET_CAST(char*, mCachedStyleData.mResetData); } else { mCachedStyleData.mInheritedData = - new (presContext.get()) nsInheritedStyleData; + new (presContext) nsInheritedStyleData; resetOrInherit = NS_REINTERPRET_CAST(char*, mCachedStyleData.mInheritedData); } @@ -553,8 +552,7 @@ void nsStyleContext::List(FILE* out, PRInt32 aIndent) fputs("{\n", out); nsRuleNode* ruleNode = mRuleNode; while (ruleNode) { - nsCOMPtr styleRule; - ruleNode->GetRule(getter_AddRefs(styleRule)); + nsIStyleRule *styleRule = ruleNode->GetRule(); if (styleRule) { styleRule->List(out, aIndent + 1); } @@ -838,8 +836,7 @@ void nsStyleContext::Destroy() { // Get the pres context from our rule node. - nsCOMPtr presContext; - mRuleNode->GetPresContext(getter_AddRefs(presContext)); + nsCOMPtr presContext = mRuleNode->GetPresContext(); // Call our destructor. this->~nsStyleContext(); diff --git a/content/base/src/nsStyleSet.cpp b/content/base/src/nsStyleSet.cpp index 9baf2b190e96..69febce4fac1 100644 --- a/content/base/src/nsStyleSet.cpp +++ b/content/base/src/nsStyleSet.cpp @@ -91,7 +91,7 @@ struct nsRuleNodeList void Destroy() { if (mNext) mNext->Destroy(); - mRuleNode->PresContext()->FreeToShell(sizeof(nsRuleNodeList), this); + mRuleNode->GetPresContext()->FreeToShell(sizeof(nsRuleNodeList), this); }; nsRuleNode* mRuleNode; @@ -1041,8 +1041,7 @@ StyleSetImpl::AddImportantRules(nsRuleNode* aCurrLevelNode, AddImportantRules(aCurrLevelNode->GetParent(), aLastPrevLevelNode); - nsCOMPtr rule;; - aCurrLevelNode->GetRule(getter_AddRefs(rule)); + nsIStyleRule *rule = aCurrLevelNode->GetRule(); nsCOMPtr cssRule(do_QueryInterface(rule)); if (cssRule) { nsCOMPtr impRule = cssRule->GetImportantRule(); @@ -1518,8 +1517,7 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext, else { // really a new parent nsCOMPtr pseudoTag = aStyleContext->GetPseudoType(); - nsRuleNode* ruleNode; - aStyleContext->GetRuleNode(&ruleNode); + nsRuleNode* ruleNode = aStyleContext->GetRuleNode(); EnsureRuleWalker(aPresContext); NS_ENSURE_TRUE(mRuleWalker, nsnull); mRuleWalker->SetCurrentNode(ruleNode); diff --git a/content/html/style/src/nsHTMLStyleSheet.cpp b/content/html/style/src/nsHTMLStyleSheet.cpp index e493d6da38cb..acca1d48a038 100644 --- a/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/content/html/style/src/nsHTMLStyleSheet.cpp @@ -808,7 +808,9 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData, else if (tag == nsHTMLAtoms::table) { if (aData->mCompatMode == eCompatibility_NavQuirks) { nscolor bodyColor; - nsresult rv = GetBodyColor(ruleWalker->GetCurrentNode()->PresContext(), &bodyColor); + nsresult rv = + GetBodyColor(ruleWalker->GetCurrentNode()->GetPresContext(), + &bodyColor); if (NS_SUCCEEDED(rv) && (!mDocumentColorRule || bodyColor != mDocumentColorRule->mColor)) { if (mDocumentColorRule) { diff --git a/content/html/style/src/nsInspectorCSSUtils.cpp b/content/html/style/src/nsInspectorCSSUtils.cpp index 9d4a2e01ecae..c8026d098714 100644 --- a/content/html/style/src/nsInspectorCSSUtils.cpp +++ b/content/html/style/src/nsInspectorCSSUtils.cpp @@ -75,7 +75,8 @@ nsInspectorCSSUtils::GetRuleNodeParent(nsRuleNode *aNode, nsRuleNode **aParent) NS_IMETHODIMP nsInspectorCSSUtils::GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule) { - return aNode->GetRule(aRule); + *aRule = aNode->GetRule(); + return NS_OK; } NS_IMETHODIMP @@ -181,6 +182,6 @@ nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent, NS_ENSURE_TRUE(presShell, NS_ERROR_UNEXPECTED); nsRefPtr sContext = GetStyleContextForContent(aContent, presShell); - sContext->GetRuleNode(aRuleNode); + *aRuleNode = sContext->GetRuleNode(); return NS_OK; } diff --git a/content/shared/public/nsRuleNode.h b/content/shared/public/nsRuleNode.h index c2532afc8cb0..b17bf0549147 100644 --- a/content/shared/public/nsRuleNode.h +++ b/content/shared/public/nsRuleNode.h @@ -539,26 +539,15 @@ public: nsresult GetBits(PRInt32 aType, PRUint32* aResult); nsresult Transition(nsIStyleRule* aRule, nsRuleNode** aResult); - nsRuleNode* GetParent() { return mParent; } - PRBool IsRoot() { return mParent == nsnull; } - nsresult GetRule(nsIStyleRule** aResult) - { - *aResult = mRule; - NS_IF_ADDREF(*aResult); - return NS_OK; - } - nsIStyleRule* Rule() { - // NOTE: Does not |AddRef|. - return mRule; - } - nsIPresContext* PresContext() { - // NOTE: Does not |AddRef|. - return mPresContext; - } + nsRuleNode* GetParent() const { return mParent; } + PRBool IsRoot() const { return mParent == nsnull; } + + // NOTE: Does not |AddRef|. + nsIStyleRule* GetRule() const { return mRule; } + // NOTE: Does not |AddRef|. + nsIPresContext* GetPresContext() const { return mPresContext; } nsresult ClearStyleData(); - nsresult GetPresContext(nsIPresContext** aResult); - nsresult PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched); const nsStyleStruct* GetStyleData(nsStyleStructID aSID, nsStyleContext* aContext, PRBool aComputeData); diff --git a/content/shared/public/nsStyleContext.h b/content/shared/public/nsStyleContext.h index be3629234e85..f3409f79c0ea 100644 --- a/content/shared/public/nsStyleContext.h +++ b/content/shared/public/nsStyleContext.h @@ -88,7 +88,7 @@ public: void SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct); - void GetRuleNode(nsRuleNode** aResult) { *aResult = mRuleNode; } + nsRuleNode* GetRuleNode() { return mRuleNode; } void AddStyleBit(const PRUint32& aBit) { mBits |= aBit; } void GetStyleBits(PRUint32* aBits) { *aBits = mBits; } diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index 43b7c1429af9..b28a502d933e 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -1736,10 +1736,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, NS_ASSERTION(newContext, "failed to get new style context"); if (newContext) { if (!parentContext) { - nsRuleNode *oldNode, *newNode; - oldContext->GetRuleNode(&oldNode); - newContext->GetRuleNode(&newNode); - if (oldNode == newNode) { + if (oldContext->GetRuleNode() == newContext->GetRuleNode()) { // We're the root of the style context tree and the new style // context returned has the same rule node. This means that // we can use FindChildWithRules to keep a lot of the old diff --git a/layout/base/public/nsIFrame.h b/layout/base/public/nsIFrame.h index 1d19cb8016ab..e65950044c32 100644 --- a/layout/base/public/nsIFrame.h +++ b/layout/base/public/nsIFrame.h @@ -396,6 +396,11 @@ class nsIFrame : public nsISupports { public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAME_IID) + + nsIPresContext* GetPresContext() { + return GetStyleContext()->GetRuleNode()->GetPresContext(); + } + /** * Called to initialize the frame. This is called immediately after creating * the frame. diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 1d19cb8016ab..e65950044c32 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -396,6 +396,11 @@ class nsIFrame : public nsISupports { public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAME_IID) + + nsIPresContext* GetPresContext() { + return GetStyleContext()->GetRuleNode()->GetPresContext(); + } + /** * Called to initialize the frame. This is called immediately after creating * the frame. diff --git a/layout/html/base/src/nsFrameManager.cpp b/layout/html/base/src/nsFrameManager.cpp index 43b7c1429af9..b28a502d933e 100644 --- a/layout/html/base/src/nsFrameManager.cpp +++ b/layout/html/base/src/nsFrameManager.cpp @@ -1736,10 +1736,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, NS_ASSERTION(newContext, "failed to get new style context"); if (newContext) { if (!parentContext) { - nsRuleNode *oldNode, *newNode; - oldContext->GetRuleNode(&oldNode); - newContext->GetRuleNode(&newNode); - if (oldNode == newNode) { + if (oldContext->GetRuleNode() == newContext->GetRuleNode()) { // We're the root of the style context tree and the new style // context returned has the same rule node. This means that // we can use FindChildWithRules to keep a lot of the old diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index e493d6da38cb..acca1d48a038 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -808,7 +808,9 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData, else if (tag == nsHTMLAtoms::table) { if (aData->mCompatMode == eCompatibility_NavQuirks) { nscolor bodyColor; - nsresult rv = GetBodyColor(ruleWalker->GetCurrentNode()->PresContext(), &bodyColor); + nsresult rv = + GetBodyColor(ruleWalker->GetCurrentNode()->GetPresContext(), + &bodyColor); if (NS_SUCCEEDED(rv) && (!mDocumentColorRule || bodyColor != mDocumentColorRule->mColor)) { if (mDocumentColorRule) { diff --git a/layout/style/nsInspectorCSSUtils.cpp b/layout/style/nsInspectorCSSUtils.cpp index 9d4a2e01ecae..c8026d098714 100644 --- a/layout/style/nsInspectorCSSUtils.cpp +++ b/layout/style/nsInspectorCSSUtils.cpp @@ -75,7 +75,8 @@ nsInspectorCSSUtils::GetRuleNodeParent(nsRuleNode *aNode, nsRuleNode **aParent) NS_IMETHODIMP nsInspectorCSSUtils::GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule) { - return aNode->GetRule(aRule); + *aRule = aNode->GetRule(); + return NS_OK; } NS_IMETHODIMP @@ -181,6 +182,6 @@ nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent, NS_ENSURE_TRUE(presShell, NS_ERROR_UNEXPECTED); nsRefPtr sContext = GetStyleContextForContent(aContent, presShell); - sContext->GetRuleNode(aRuleNode); + *aRuleNode = sContext->GetRuleNode(); return NS_OK; } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index f26df07f0131..1b8fd8160be9 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -102,7 +102,7 @@ public: */ struct ChildrenHashEntry : public PLDHashEntryHdr { - // key (the rule) is |mRuleNode->Rule()| + // key (the rule) is |mRuleNode->GetRule()| nsRuleNode *mRuleNode; }; @@ -110,7 +110,7 @@ PR_STATIC_CALLBACK(const void *) ChildrenHashGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) { ChildrenHashEntry *entry = NS_STATIC_CAST(ChildrenHashEntry*, hdr); - return entry->mRuleNode->Rule(); + return entry->mRuleNode->GetRule(); } PR_STATIC_CALLBACK(PRBool) @@ -119,7 +119,7 @@ ChildrenHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, { const ChildrenHashEntry *entry = NS_STATIC_CAST(const ChildrenHashEntry*, hdr); - return entry->mRuleNode->Rule() == key; + return entry->mRuleNode->GetRule() == key; } static PLDHashTableOps ChildrenHashOps = { @@ -537,22 +537,6 @@ nsRuleNode::ConvertChildrenToHash() SetChildrenHash(hash); } -nsresult -nsRuleNode::PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched) -{ - *aMatched = PR_FALSE; - nsRuleNode* ruleDest = this; - while (ruleDest) { - if (ruleDest->mRule == aRule) { - *aMatched = PR_TRUE; - break; - } - ruleDest = ruleDest->mParent; - } - - return NS_OK; -} - PR_STATIC_CALLBACK(PLDHashOperator) ClearStyleDataHelper(PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg) @@ -582,14 +566,6 @@ nsRuleNode::ClearStyleData() return NS_OK; } -nsresult -nsRuleNode::GetPresContext(nsIPresContext** aResult) -{ - *aResult = mPresContext; - NS_IF_ADDREF(*aResult); - return NS_OK; -} - inline void nsRuleNode::PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode) { @@ -1943,10 +1919,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext, PRBool dummy; PRUint32 noneBits; PRUint32 fontBit = nsCachedStyleData::GetBitForSID(eStyleStruct_Font); - nsRuleNode* ruleNode = nsnull; - nsCOMPtr rule; - for (; i >= 0; --i) { nsStyleContext* context = (nsStyleContext*)contextPath[i]; nsRuleDataFont fontData; // Declare a struct with null CSS values. @@ -1954,17 +1927,15 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext, ruleData.mFontData = &fontData; // Trimmed down version of ::WalkRuleTree() to re-apply the style rules - context->GetRuleNode(&ruleNode); - while (ruleNode) { + for (nsRuleNode* ruleNode = context->GetRuleNode(); ruleNode; + ruleNode = ruleNode->GetParent()) { ruleNode->GetBits(nsRuleNode::eNoneBits, &noneBits); if (noneBits & fontBit) // no more font rules on this branch, get out break; - ruleNode->GetRule(getter_AddRefs(rule)); + nsIStyleRule *rule = ruleNode->GetRule(); if (rule) rule->MapRuleInfoInto(&ruleData); - - ruleNode = ruleNode->GetParent(); } // Compute the delta from the information that the rules specified diff --git a/layout/style/nsRuleNode.h b/layout/style/nsRuleNode.h index c2532afc8cb0..b17bf0549147 100644 --- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -539,26 +539,15 @@ public: nsresult GetBits(PRInt32 aType, PRUint32* aResult); nsresult Transition(nsIStyleRule* aRule, nsRuleNode** aResult); - nsRuleNode* GetParent() { return mParent; } - PRBool IsRoot() { return mParent == nsnull; } - nsresult GetRule(nsIStyleRule** aResult) - { - *aResult = mRule; - NS_IF_ADDREF(*aResult); - return NS_OK; - } - nsIStyleRule* Rule() { - // NOTE: Does not |AddRef|. - return mRule; - } - nsIPresContext* PresContext() { - // NOTE: Does not |AddRef|. - return mPresContext; - } + nsRuleNode* GetParent() const { return mParent; } + PRBool IsRoot() const { return mParent == nsnull; } + + // NOTE: Does not |AddRef|. + nsIStyleRule* GetRule() const { return mRule; } + // NOTE: Does not |AddRef|. + nsIPresContext* GetPresContext() const { return mPresContext; } nsresult ClearStyleData(); - nsresult GetPresContext(nsIPresContext** aResult); - nsresult PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched); const nsStyleStruct* GetStyleData(nsStyleStructID aSID, nsStyleContext* aContext, PRBool aComputeData); diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index f6daeb03e547..3df4cd4b0267 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -92,7 +92,7 @@ nsStyleContext::~nsStyleContext() { NS_ASSERTION((nsnull == mChild) && (nsnull == mEmptyChild), "destructing context with children"); - nsIPresContext *presContext = mRuleNode->PresContext(); + nsIPresContext *presContext = mRuleNode->GetPresContext(); nsCOMPtr shell; presContext->GetShell(getter_AddRefs(shell)); @@ -347,14 +347,13 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct) char* resetOrInherit = NS_REINTERPRET_CAST(char*, *NS_REINTERPRET_CAST(void**, resetOrInheritSlot)); if (!resetOrInherit) { - nsCOMPtr presContext; - mRuleNode->GetPresContext(getter_AddRefs(presContext)); + nsIPresContext *presContext = mRuleNode->GetPresContext(); if (mCachedStyleData.IsReset(aSID)) { - mCachedStyleData.mResetData = new (presContext.get()) nsResetStyleData; + mCachedStyleData.mResetData = new (presContext) nsResetStyleData; resetOrInherit = NS_REINTERPRET_CAST(char*, mCachedStyleData.mResetData); } else { mCachedStyleData.mInheritedData = - new (presContext.get()) nsInheritedStyleData; + new (presContext) nsInheritedStyleData; resetOrInherit = NS_REINTERPRET_CAST(char*, mCachedStyleData.mInheritedData); } @@ -553,8 +552,7 @@ void nsStyleContext::List(FILE* out, PRInt32 aIndent) fputs("{\n", out); nsRuleNode* ruleNode = mRuleNode; while (ruleNode) { - nsCOMPtr styleRule; - ruleNode->GetRule(getter_AddRefs(styleRule)); + nsIStyleRule *styleRule = ruleNode->GetRule(); if (styleRule) { styleRule->List(out, aIndent + 1); } @@ -838,8 +836,7 @@ void nsStyleContext::Destroy() { // Get the pres context from our rule node. - nsCOMPtr presContext; - mRuleNode->GetPresContext(getter_AddRefs(presContext)); + nsCOMPtr presContext = mRuleNode->GetPresContext(); // Call our destructor. this->~nsStyleContext(); diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h index be3629234e85..f3409f79c0ea 100644 --- a/layout/style/nsStyleContext.h +++ b/layout/style/nsStyleContext.h @@ -88,7 +88,7 @@ public: void SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct); - void GetRuleNode(nsRuleNode** aResult) { *aResult = mRuleNode; } + nsRuleNode* GetRuleNode() { return mRuleNode; } void AddStyleBit(const PRUint32& aBit) { mBits |= aBit; } void GetStyleBits(PRUint32* aBits) { *aBits = mBits; } diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index 9baf2b190e96..69febce4fac1 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -91,7 +91,7 @@ struct nsRuleNodeList void Destroy() { if (mNext) mNext->Destroy(); - mRuleNode->PresContext()->FreeToShell(sizeof(nsRuleNodeList), this); + mRuleNode->GetPresContext()->FreeToShell(sizeof(nsRuleNodeList), this); }; nsRuleNode* mRuleNode; @@ -1041,8 +1041,7 @@ StyleSetImpl::AddImportantRules(nsRuleNode* aCurrLevelNode, AddImportantRules(aCurrLevelNode->GetParent(), aLastPrevLevelNode); - nsCOMPtr rule;; - aCurrLevelNode->GetRule(getter_AddRefs(rule)); + nsIStyleRule *rule = aCurrLevelNode->GetRule(); nsCOMPtr cssRule(do_QueryInterface(rule)); if (cssRule) { nsCOMPtr impRule = cssRule->GetImportantRule(); @@ -1518,8 +1517,7 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext, else { // really a new parent nsCOMPtr pseudoTag = aStyleContext->GetPseudoType(); - nsRuleNode* ruleNode; - aStyleContext->GetRuleNode(&ruleNode); + nsRuleNode* ruleNode = aStyleContext->GetRuleNode(); EnsureRuleWalker(aPresContext); NS_ENSURE_TRUE(mRuleWalker, nsnull); mRuleWalker->SetCurrentNode(ruleNode);