From f6a3dfccf4256115d1892ac344383c3aef33b431 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 22 Mar 2011 22:23:04 -0700 Subject: [PATCH] Bug 645956 - Part 3: Remove NS_NewCSSNamespaceRule, r=bzbarsky --- layout/style/NameSpaceRule.h | 8 +------- layout/style/nsCSSParser.cpp | 15 ++++++--------- layout/style/nsCSSRules.cpp | 26 +++----------------------- 3 files changed, 10 insertions(+), 39 deletions(-) diff --git a/layout/style/NameSpaceRule.h b/layout/style/NameSpaceRule.h index 728672bf91d5..03e827b3ec44 100644 --- a/layout/style/NameSpaceRule.h +++ b/layout/style/NameSpaceRule.h @@ -57,7 +57,7 @@ class NS_FINAL_CLASS NameSpaceRule : public Rule, public nsIDOMCSSRule { public: - NameSpaceRule(); + NameSpaceRule(nsIAtom* aPrefix, const nsString& aURLSpec); private: // for |Clone| NameSpaceRule(const NameSpaceRule& aCopy); @@ -79,10 +79,8 @@ public: virtual already_AddRefed Clone() const; nsIAtom* GetPrefix() const { return mPrefix; } - void SetPrefix(nsIAtom* aPrefix) { mPrefix = aPrefix; } void GetURLSpec(nsString& aURLSpec) const { aURLSpec = mURLSpec; } - void SetURLSpec(const nsString& aURLSpec) { mURLSpec = aURLSpec; } // nsIDOMCSSRule interface NS_DECL_NSIDOMCSSRULE @@ -97,8 +95,4 @@ private: NS_DEFINE_STATIC_IID_ACCESSOR(mozilla::css::NameSpaceRule, NS_CSS_NAMESPACE_RULE_IMPL_CID) -nsresult -NS_NewCSSNameSpaceRule(mozilla::css::NameSpaceRule** aInstancePtrResult, - nsIAtom* aPrefix, const nsString& aURLSpec); - #endif /* mozilla_css_NameSpaceRule_h__ */ diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 435b9c326026..a6f093b540d6 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -2105,22 +2105,19 @@ CSSParserImpl::ProcessNameSpace(const nsString& aPrefix, RuleAppendFunc aAppendFunc, void* aData) { - nsRefPtr rule; nsCOMPtr prefix; if (!aPrefix.IsEmpty()) { prefix = do_GetAtom(aPrefix); } - NS_NewCSSNameSpaceRule(getter_AddRefs(rule), prefix, aURLSpec); - if (rule) { - (*aAppendFunc)(rule, aData); + nsRefPtr rule = new css::NameSpaceRule(prefix, aURLSpec); + (*aAppendFunc)(rule, aData); - // If this was the first namespace rule encountered, it will trigger - // creation of a namespace map. - if (!mNameSpaceMap) { - mNameSpaceMap = mSheet->GetNameSpaceMap(); - } + // If this was the first namespace rule encountered, it will trigger + // creation of a namespace map. + if (!mNameSpaceMap) { + mNameSpaceMap = mSheet->GetNameSpaceMap(); } } diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index ae5225a0600f..3af1c7b97906 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -1155,10 +1155,10 @@ DOMCI_DATA(CSSMozDocumentRule, css::DocumentRule) namespace mozilla { namespace css { -NameSpaceRule::NameSpaceRule() +NameSpaceRule::NameSpaceRule(nsIAtom* aPrefix, const nsString& aURLSpec) : Rule(), - mPrefix(nsnull), - mURLSpec() + mPrefix(aPrefix), + mURLSpec(aURLSpec) { } @@ -1278,26 +1278,6 @@ NameSpaceRule::GetParentRule(nsIDOMCSSRule** aParentRule) // Must be outside namespace DOMCI_DATA(CSSNameSpaceRule, css::NameSpaceRule) -nsresult -NS_NewCSSNameSpaceRule(css::NameSpaceRule** aInstancePtrResult, - nsIAtom* aPrefix, const nsString& aURLSpec) -{ - if (! aInstancePtrResult) { - return NS_ERROR_NULL_POINTER; - } - - css::NameSpaceRule* it = new css::NameSpaceRule(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - it->SetPrefix(aPrefix); - it->SetURLSpec(aURLSpec); - NS_ADDREF(*aInstancePtrResult = it); - return NS_OK; -} - // ------------------------------------------- // nsCSSFontFaceStyleDecl and related routines //