Issue #2488 - Part 2: Remove the DeclarationBlock class and use Declaration directly

This commit is contained in:
FranklinDM 2024-03-28 19:04:36 +08:00 committed by roytam1
commit 4d7bdedade
27 changed files with 210 additions and 356 deletions

View file

@ -10,7 +10,7 @@
#include "nsHTMLCSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/css/Declaration.h"
#include "nsIStyleRuleProcessor.h"
#include "nsPresContext.h"
#include "nsRuleWalker.h"
@ -39,7 +39,7 @@ nsHTMLCSSStyleSheet::~nsHTMLCSSStyleSheet()
// Ideally we'd just call MiscContainer::Evict, but we can't do that since
// we're iterating the hashtable.
if (value->mType == nsAttrValue::eCSSDeclaration) {
DeclarationBlock* declaration = value->mValue.mCSSDeclaration;
css::Declaration* declaration = value->mValue.mCSSDeclaration;
declaration->SetHTMLCSSStyleSheet(nullptr);
} else {
MOZ_ASSERT_UNREACHABLE("unexpected cached nsAttrValue type");
@ -65,10 +65,10 @@ nsHTMLCSSStyleSheet::ElementRulesMatching(nsPresContext* aPresContext,
nsRuleWalker* aRuleWalker)
{
// just get the one and only style rule from the content's STYLE attribute
DeclarationBlock* declaration = aElement->GetInlineStyleDeclaration();
css::Declaration* declaration = aElement->GetInlineStyleDeclaration();
if (declaration) {
declaration->SetImmutable();
aRuleWalker->Forward(declaration->AsGecko());
aRuleWalker->Forward(declaration);
}
declaration = aElement->GetSMILOverrideStyleDeclaration();
@ -78,7 +78,7 @@ nsHTMLCSSStyleSheet::ElementRulesMatching(nsPresContext* aPresContext,
// Animation restyle (or non-restyle traversal of rules)
// Now we can walk SMIL overrride style, without triggering transitions.
declaration->SetImmutable();
aRuleWalker->Forward(declaration->AsGecko());
aRuleWalker->Forward(declaration);
}
}
}
@ -94,10 +94,10 @@ nsHTMLCSSStyleSheet::PseudoElementRulesMatching(Element* aPseudoElement,
MOZ_ASSERT(aPseudoElement);
// just get the one and only style rule from the content's STYLE attribute
DeclarationBlock* declaration = aPseudoElement->GetInlineStyleDeclaration();
css::Declaration* declaration = aPseudoElement->GetInlineStyleDeclaration();
if (declaration) {
declaration->SetImmutable();
aRuleWalker->Forward(declaration->AsGecko());
aRuleWalker->Forward(declaration);
}
}