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

@ -19,7 +19,6 @@
#include "nsIFrame.h"
#include "ActiveLayerTracker.h"
#include "StyleSetHandle.h"
#include "DeclarationBlockInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -73,7 +72,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSAttributeDeclaration)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSAttributeDeclaration)
nsresult
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
{
NS_ASSERTION(mElement, "Must have Element to set the declaration!");
return mIsSMILOverride
@ -89,13 +88,13 @@ nsDOMCSSAttributeDeclaration::DocToUpdate()
return mElement->OwnerDoc();
}
DeclarationBlock*
css::Declaration*
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(Operation aOperation)
{
if (!mElement)
return nullptr;
DeclarationBlock* declaration;
css::Declaration* declaration;
if (mIsSMILOverride) {
declaration = mElement->GetSMILOverrideStyleDeclaration();
} else {
@ -132,9 +131,9 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(Operation aOperation)
}
// cannot fail
RefPtr<DeclarationBlock> decl;
RefPtr<css::Declaration> decl;
decl = new css::Declaration();
decl->AsGecko()->InitializeEmpty();
decl->InitializeEmpty();
// this *can* fail (inside SetAttrAndNotify, at least).
nsresult rv;