Issue #2490 - Part 8: Get rid of css::Rule::GetDOMRule.

This commit is contained in:
Moonchild 2024-03-30 22:32:33 +01:00 committed by roytam1
commit bb2aaeac9f
11 changed files with 17 additions and 107 deletions

View file

@ -43,13 +43,6 @@
using namespace mozilla;
using namespace mozilla::dom;
#define IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(class_, super_) \
/* virtual */ nsIDOMCSSRule* class_::GetDOMRule() \
{ return this; }
#define IMPL_STYLE_RULE_INHERIT(class_, super_) \
IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(class_, super_)
// base class for all rule types in a CSS style sheet
namespace mozilla {
@ -119,11 +112,7 @@ Rule::SetStyleSheet(CSSStyleSheet* aSheet)
NS_IMETHODIMP
Rule::GetParentRule(nsIDOMCSSRule** aParentRule)
{
if (mParentRule) {
NS_IF_ADDREF(*aParentRule = mParentRule->GetDOMRule());
} else {
*aParentRule = nullptr;
}
NS_IF_ADDREF(*aParentRule = mParentRule);
return NS_OK;
}
@ -229,7 +218,7 @@ GroupRuleRuleList::IndexedGetter(uint32_t aIndex, bool& aFound)
RefPtr<Rule> rule = mGroupRule->GetStyleRuleAt(aIndex);
if (rule) {
aFound = true;
return rule->GetDOMRule();
return rule;
}
}
@ -291,8 +280,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ImportRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSImportRule)
NS_INTERFACE_MAP_END_INHERITING(Rule)
IMPL_STYLE_RULE_INHERIT(ImportRule, Rule)
NS_IMPL_CYCLE_COLLECTION_CLASS(ImportRule)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ImportRule)
@ -591,14 +578,11 @@ GroupRule::AppendRulesToCssText(nsAString& aCssText) const
// get all the rules
for (int32_t index = 0, count = mRules.Count(); index < count; ++index) {
Rule* rule = mRules.ObjectAt(index);
nsIDOMCSSRule* domRule = rule->GetDOMRule();
if (domRule) {
nsAutoString cssText;
domRule->GetCssText(cssText);
aCssText.AppendLiteral(" ");
aCssText.Append(cssText);
aCssText.Append('\n');
}
nsAutoString cssText;
rule->GetCssText(cssText);
aCssText.AppendLiteral(" ");
aCssText.Append(cssText);
aCssText.Append('\n');
}
aCssText.Append('}');
@ -1156,8 +1140,6 @@ NameSpaceRule::IsCCLeaf() const
return Rule::IsCCLeaf();
}
IMPL_STYLE_RULE_INHERIT(NameSpaceRule, Rule)
#ifdef DEBUG
/* virtual */ void
NameSpaceRule::List(FILE* out, int32_t aIndent) const
@ -1505,7 +1487,7 @@ nsCSSFontFaceStyleDecl::IndexedGetter(uint32_t index, bool& aFound, nsAString &
NS_IMETHODIMP
nsCSSFontFaceStyleDecl::GetParentRule(nsIDOMCSSRule** aParentRule)
{
NS_IF_ADDREF(*aParentRule = ContainingRule()->GetDOMRule());
NS_IF_ADDREF(*aParentRule = ContainingRule());
return NS_OK;
}
@ -1602,8 +1584,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsCSSFontFaceRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSFontFaceRule)
NS_INTERFACE_MAP_END_INHERITING(Rule)
IMPL_STYLE_RULE_INHERIT(nsCSSFontFaceRule, Rule)
#ifdef DEBUG
void
nsCSSFontFaceRule::List(FILE* out, int32_t aIndent) const
@ -1733,8 +1713,6 @@ nsCSSFontFeatureValuesRule::IsCCLeaf() const
return Rule::IsCCLeaf();
}
IMPL_STYLE_RULE_INHERIT(nsCSSFontFeatureValuesRule, Rule)
static void
FeatureValuesToString(
const nsTArray<gfxFontFeatureValueSet::FeatureValues>& aFeatureValues,
@ -2068,8 +2046,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsCSSKeyframeRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSKeyframeRule)
NS_INTERFACE_MAP_END_INHERITING(mozilla::css::Rule)
IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(nsCSSKeyframeRule, Rule)
#ifdef DEBUG
void
nsCSSKeyframeRule::List(FILE* out, int32_t aIndent) const
@ -2592,8 +2568,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsCSSPageRule)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSPageRule)
NS_INTERFACE_MAP_END_INHERITING(mozilla::css::Rule)
IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(nsCSSPageRule, Rule)
#ifdef DEBUG
void
nsCSSPageRule::List(FILE* out, int32_t aIndent) const
@ -2862,8 +2836,6 @@ nsCSSCounterStyleRule::IsCCLeaf() const
return Rule::IsCCLeaf();
}
IMPL_STYLE_RULE_INHERIT(nsCSSCounterStyleRule, css::Rule)
#ifdef DEBUG
void
nsCSSCounterStyleRule::List(FILE* out, int32_t aIndent) const