From ce5ab085efd5f68fec79067e318a13bddae1cd26 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 2 Jul 2014 12:53:40 +0200 Subject: [PATCH] Bug 1032116 - Outparamdel nsIStyleSheetLinkingElement::GetStyleSheet; r=dbaron --- content/base/public/nsIStyleSheetLinkingElement.h | 7 ++----- content/base/src/nsStyleLinkElement.cpp | 9 +++------ content/base/src/nsStyleLinkElement.h | 2 +- layout/style/nsCSSRuleProcessor.cpp | 4 +--- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/content/base/public/nsIStyleSheetLinkingElement.h b/content/base/public/nsIStyleSheetLinkingElement.h index c4221655033..16e938575cd 100644 --- a/content/base/public/nsIStyleSheetLinkingElement.h +++ b/content/base/public/nsIStyleSheetLinkingElement.h @@ -15,8 +15,6 @@ class nsIURI; { 0xd753c84a, 0x17fd, 0x4d5f, \ { 0xb2, 0xe9, 0x63, 0x52, 0x8c, 0x87, 0x99, 0x7a } } -class nsIStyleSheet; - namespace mozilla { class CSSStyleSheet; } // namespace mozilla @@ -37,10 +35,9 @@ public: /** * Used to obtain the style sheet linked in by this element. * - * @param aStyleSheet out parameter that returns the style - * sheet associated with this element. + * @return the style sheet associated with this element. */ - NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) = 0; + NS_IMETHOD_(mozilla::CSSStyleSheet*) GetStyleSheet() = 0; /** * Initialize the stylesheet linking element. If aDontLoadStyle is diff --git a/content/base/src/nsStyleLinkElement.cpp b/content/base/src/nsStyleLinkElement.cpp index 771a0a52fe6..e1254805711 100644 --- a/content/base/src/nsStyleLinkElement.cpp +++ b/content/base/src/nsStyleLinkElement.cpp @@ -77,13 +77,10 @@ nsStyleLinkElement::SetStyleSheet(CSSStyleSheet* aStyleSheet) return NS_OK; } -NS_IMETHODIMP -nsStyleLinkElement::GetStyleSheet(nsIStyleSheet*& aStyleSheet) +NS_IMETHODIMP_(CSSStyleSheet*) +nsStyleLinkElement::GetStyleSheet() { - aStyleSheet = mStyleSheet; - NS_IF_ADDREF(aStyleSheet); - - return NS_OK; + return mStyleSheet; } NS_IMETHODIMP diff --git a/content/base/src/nsStyleLinkElement.h b/content/base/src/nsStyleLinkElement.h index d3b3f6c23e4..01b1dab1f8b 100644 --- a/content/base/src/nsStyleLinkElement.h +++ b/content/base/src/nsStyleLinkElement.h @@ -41,7 +41,7 @@ public: // nsIStyleSheetLinkingElement NS_IMETHOD SetStyleSheet(mozilla::CSSStyleSheet* aStyleSheet) MOZ_OVERRIDE; - NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) MOZ_OVERRIDE; + NS_IMETHOD_(mozilla::CSSStyleSheet*) GetStyleSheet() MOZ_OVERRIDE; NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) MOZ_OVERRIDE; NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver, bool* aWillNotify, diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 5d8f9299dd9..ee57a983a42 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -560,9 +560,7 @@ RuleHash::~RuleHash() RuleValue* value = &(mUniversalRules[i]); nsAutoString selectorText; uint32_t lineNumber = value->mRule->GetLineNumber(); - nsCOMPtr sheet; - value->mRule->GetStyleSheet(*getter_AddRefs(sheet)); - nsRefPtr cssSheet = do_QueryObject(sheet); + nsRefPtr cssSheet = value->mRule->GetStyleSheet(); value->mSelector->ToString(selectorText, cssSheet); printf(" line %d, %s\n",