Bug 645956 - Part 2: Remove NS_NewCSSImportRule, r=bzbarsky

This commit is contained in:
Craig Topper 2011-03-22 22:22:59 -07:00
parent 742b017a7c
commit 2ad1f0e447
3 changed files with 5 additions and 58 deletions

View File

@ -54,7 +54,7 @@ class NS_FINAL_CLASS ImportRule : public Rule,
public nsIDOMCSSImportRule
{
public:
ImportRule(nsMediaList* aMedia);
ImportRule(nsMediaList* aMedia, const nsString& aURLSpec);
private:
// for |Clone|
ImportRule(const ImportRule& aCopy);
@ -77,12 +77,6 @@ public:
virtual PRInt32 GetType() const;
virtual already_AddRefed<nsICSSRule> Clone() const;
void SetURLSpec(const nsString& aURLSpec) { mURLSpec = aURLSpec; }
void GetURLSpec(nsString& aURLSpec) const { aURLSpec = mURLSpec; }
nsresult SetMedia(const nsString& aMedia);
void GetMedia(nsString& aMedia) const;
void SetSheet(nsCSSStyleSheet*);
// nsIDOMCSSRule interface
@ -100,8 +94,4 @@ private:
} // namespace css
} // namespace mozilla
nsresult
NS_NewCSSImportRule(mozilla::css::ImportRule** aInstancePtrResult,
const nsString& aURLSpec, nsMediaList* aMedia);
#endif /* mozilla_css_ImportRule_h__ */

View File

@ -1926,18 +1926,13 @@ CSSParserImpl::ProcessImport(const nsString& aURLSpec,
RuleAppendFunc aAppendFunc,
void* aData)
{
nsRefPtr<css::ImportRule> rule;
nsresult rv = NS_NewCSSImportRule(getter_AddRefs(rule), aURLSpec, aMedia);
if (NS_FAILED(rv)) { // out of memory
mScanner.SetLowLevelError(rv);
return;
}
nsRefPtr<css::ImportRule> rule = new css::ImportRule(aMedia, aURLSpec);
(*aAppendFunc)(rule, aData);
// Diagnose bad URIs even if we don't have a child loader.
nsCOMPtr<nsIURI> url;
// Charset will be deduced from mBaseURI, which is more or less correct.
rv = NS_NewURI(getter_AddRefs(url), aURLSpec, nsnull, mBaseURI);
nsresult rv = NS_NewURI(getter_AddRefs(url), aURLSpec, nsnull, mBaseURI);
if (NS_FAILED(rv)) {
if (rv == NS_ERROR_MALFORMED_URI) {

View File

@ -384,9 +384,9 @@ CSSCharsetRuleImpl::GetParentRule(nsIDOMCSSRule** aParentRule)
namespace mozilla {
namespace css {
ImportRule::ImportRule(nsMediaList* aMedia)
ImportRule::ImportRule(nsMediaList* aMedia, const nsString& aURLSpec)
: Rule()
, mURLSpec()
, mURLSpec(aURLSpec)
, mMedia(aMedia)
{
// XXXbz This is really silly.... the mMedia here will be replaced
@ -462,26 +462,6 @@ ImportRule::Clone() const
return clone.forget();
}
nsresult
ImportRule::SetMedia(const nsString& aMedia)
{
if (mMedia) {
return mMedia->SetText(aMedia);
} else {
return NS_OK;
}
}
void
ImportRule::GetMedia(nsString& aMedia) const
{
if (mMedia) {
mMedia->GetText(aMedia);
} else {
aMedia.Truncate();
}
}
void
ImportRule::SetSheet(nsCSSStyleSheet* aSheet)
{
@ -580,24 +560,6 @@ ImportRule::GetStyleSheet(nsIDOMCSSStyleSheet * *aStyleSheet)
// must be outside the namespace
DOMCI_DATA(CSSImportRule, css::ImportRule)
nsresult
NS_NewCSSImportRule(css::ImportRule** aInstancePtrResult,
const nsString& aURLSpec,
nsMediaList* aMedia)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
css::ImportRule* it = new css::ImportRule(aMedia);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->SetURLSpec(aURLSpec);
NS_ADDREF(*aInstancePtrResult = it);
return NS_OK;
}
static PRBool
CloneRuleInto(nsICSSRule* aRule, void* aArray)
{