Bug 645956 - Part 1: Remove NS_NewCSSStyleRule, r=bzbarsky

This commit is contained in:
Craig Topper 2011-03-22 19:56:47 -07:00
parent 8bbf26beb9
commit 6096667acd
6 changed files with 7 additions and 19 deletions

View File

@ -1214,7 +1214,7 @@ MappedAttrParser::CreateStyleRule()
return nsnull; // No mapped attributes were parsed
}
nsRefPtr<css::StyleRule> rule = NS_NewCSSStyleRule(nsnull, mDecl);
nsRefPtr<css::StyleRule> rule = new css::StyleRule(nsnull, mDecl);
mDecl = nsnull; // We no longer own the declaration -- drop our pointer to it
return rule.forget();
}

View File

@ -1286,6 +1286,7 @@ StyleRule::StyleRule(nsCSSSelectorList* aSelector,
mLineNumber(0),
mWasMatched(PR_FALSE)
{
NS_PRECONDITION(aDeclaration, "must have a declaration");
}
// for |Clone|
@ -1506,13 +1507,3 @@ StyleRule::SetSelectorText(const nsAString& aSelectorText)
} // namespace css
} // namespace mozilla
already_AddRefed<css::StyleRule>
NS_NewCSSStyleRule(nsCSSSelectorList* aSelector,
css::Declaration* aDeclaration)
{
NS_PRECONDITION(aDeclaration, "must have a declaration");
css::StyleRule *it = new css::StyleRule(aSelector, aDeclaration);
NS_ADDREF(it);
return it;
}

View File

@ -381,8 +381,4 @@ private:
NS_DEFINE_STATIC_IID_ACCESSOR(mozilla::css::StyleRule, NS_CSS_STYLE_RULE_IMPL_CID)
already_AddRefed<mozilla::css::StyleRule>
NS_NewCSSStyleRule(nsCSSSelectorList* aSelector,
mozilla::css::Declaration* aDeclaration);
#endif /* mozilla_css_StyleRule_h__ */

View File

@ -987,7 +987,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAString& aAttributeValue,
css::Declaration* declaration = ParseDeclarationBlock(haveBraces);
if (declaration) {
// Create a style rule for the declaration
*aResult = NS_NewCSSStyleRule(nsnull, declaration).get();
NS_ADDREF(*aResult = new css::StyleRule(nsnull, declaration));
} else {
*aResult = nsnull;
}
@ -2434,7 +2434,7 @@ CSSParserImpl::ParseRuleSet(RuleAppendFunc aAppendFunc, void* aData,
// Translate the selector list and declaration block into style data
nsRefPtr<css::StyleRule> rule = NS_NewCSSStyleRule(slist, declaration);
nsRefPtr<css::StyleRule> rule = new css::StyleRule(slist, declaration);
rule->SetLineNumber(linenum);
(*aAppendFunc)(rule, aData);

View File

@ -152,7 +152,7 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(PRBool aAllocate)
// cannot fail
css::Declaration *decl = new css::Declaration();
decl->InitializeEmpty();
nsRefPtr<css::StyleRule> newRule = NS_NewCSSStyleRule(nsnull, decl);
nsRefPtr<css::StyleRule> newRule = new css::StyleRule(nsnull, decl);
// this *can* fail (inside SetAttrAndNotify, at least).
nsresult rv;

View File

@ -1818,7 +1818,8 @@ BuildStyleRule(nsCSSProperty aProperty,
return nsnull;
}
return NS_NewCSSStyleRule(nsnull, declaration.forget());
nsRefPtr<css::StyleRule> rule = new css::StyleRule(nsnull, declaration.forget());
return rule.forget();
}
inline