Bug 868729 - Remove nsHTMLCSSStyleSheet::Init; r=bz

This commit is contained in:
Ms2ger 2013-05-05 09:03:20 +02:00
parent f2e25db30c
commit 651b9b2b24
3 changed files with 10 additions and 24 deletions

View File

@ -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

View File

@ -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)

View File

@ -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