From 651b9b2b240cbdfccb4b877998c40a909267849f Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 5 May 2013 09:03:20 +0200 Subject: [PATCH] Bug 868729 - Remove nsHTMLCSSStyleSheet::Init; r=bz --- content/base/src/nsDocument.cpp | 4 +--- layout/style/nsHTMLCSSStyleSheet.cpp | 24 ++++++------------------ layout/style/nsHTMLCSSStyleSheet.h | 6 +++--- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index ad175112f7e..af02fb36514 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -2232,9 +2232,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI) } mStyleAttrStyleSheet->Reset(aURI); } else { - mStyleAttrStyleSheet = new nsHTMLCSSStyleSheet(); - nsresult rv = mStyleAttrStyleSheet->Init(aURI, this); - NS_ENSURE_SUCCESS(rv, rv); + mStyleAttrStyleSheet = new nsHTMLCSSStyleSheet(aURI, this); } // The loop over style sets below will handle putting this sheet diff --git a/layout/style/nsHTMLCSSStyleSheet.cpp b/layout/style/nsHTMLCSSStyleSheet.cpp index d9bf578e239..1c93aceefcf 100644 --- a/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/layout/style/nsHTMLCSSStyleSheet.cpp @@ -39,9 +39,13 @@ ClearAttrCache(const nsAString& aKey, MiscContainer*& aValue, void*) } // anonymous namespace -nsHTMLCSSStyleSheet::nsHTMLCSSStyleSheet() - : mDocument(nullptr) +nsHTMLCSSStyleSheet::nsHTMLCSSStyleSheet(nsIURI* aURL, nsIDocument* aDocument) + : mURL(aURL) + , mDocument(aDocument) // not refcounted! { + MOZ_ASSERT(aURL); + MOZ_ASSERT(aDocument); + mCachedStyleAttrs.Init(); } nsHTMLCSSStyleSheet::~nsHTMLCSSStyleSheet() @@ -102,22 +106,6 @@ nsHTMLCSSStyleSheet::RulesMatching(XULTreeRuleProcessorData* aData) } #endif -nsresult -nsHTMLCSSStyleSheet::Init(nsIURI* aURL, nsIDocument* aDocument) -{ - NS_PRECONDITION(aURL && aDocument, "null ptr"); - if (! aURL || ! aDocument) - return NS_ERROR_NULL_POINTER; - - if (mURL || mDocument) - return NS_ERROR_ALREADY_INITIALIZED; - - mDocument = aDocument; // not refcounted! - mURL = aURL; - mCachedStyleAttrs.Init(); - return NS_OK; -} - // Test if style is dependent on content state /* virtual */ nsRestyleHint nsHTMLCSSStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData) diff --git a/layout/style/nsHTMLCSSStyleSheet.h b/layout/style/nsHTMLCSSStyleSheet.h index 2d530a37502..4bab6919f32 100644 --- a/layout/style/nsHTMLCSSStyleSheet.h +++ b/layout/style/nsHTMLCSSStyleSheet.h @@ -20,14 +20,14 @@ struct MiscContainer; class nsHTMLCSSStyleSheet MOZ_FINAL : public nsIStyleSheet, - public nsIStyleRuleProcessor { + public nsIStyleRuleProcessor +{ public: - nsHTMLCSSStyleSheet(); + nsHTMLCSSStyleSheet(nsIURI* aURL, nsIDocument* aDocument); ~nsHTMLCSSStyleSheet(); NS_DECL_ISUPPORTS - nsresult Init(nsIURI* aURL, nsIDocument* aDocument); void Reset(nsIURI* aURL); // nsIStyleSheet