Bug 1330060 part 1. Move GetInlineStyleDeclaration up to Element so it doesn't have to be virtual. r=bkelly

This commit is contained in:
Boris Zbarsky 2017-01-11 19:03:16 -05:00
parent 4bdd0944f9
commit 34c39939f2
4 changed files with 11 additions and 18 deletions

View File

@ -2001,8 +2001,17 @@ Element::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
}
DeclarationBlock*
Element::GetInlineStyleDeclaration()
Element::GetInlineStyleDeclaration() const
{
if (!MayHaveStyle()) {
return nullptr;
}
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsGkAtoms::style);
if (attrVal && attrVal->Type() == nsAttrValue::eCSSDeclaration) {
return attrVal->GetCSSDeclarationValue();
}
return nullptr;
}

View File

@ -267,7 +267,7 @@ public:
/**
* Get the inline style declaration, if any, for this element.
*/
virtual DeclarationBlock* GetInlineStyleDeclaration();
DeclarationBlock* GetInlineStyleDeclaration() const;
/**
* Set the inline style declaration for this element. This will send

View File

@ -93,21 +93,6 @@ nsStyledElement::SetInlineStyleDeclaration(DeclarationBlock* aDeclaration,
aNotify, kDontCallAfterSetAttr);
}
DeclarationBlock*
nsStyledElement::GetInlineStyleDeclaration()
{
if (!MayHaveStyle()) {
return nullptr;
}
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsGkAtoms::style);
if (attrVal && attrVal->Type() == nsAttrValue::eCSSDeclaration) {
return attrVal->GetCSSDeclarationValue();
}
return nullptr;
}
// ---------------------------------------------------------------
// Others and helpers

View File

@ -44,7 +44,6 @@ public:
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
// Element interface methods
virtual mozilla::DeclarationBlock* GetInlineStyleDeclaration() override;
virtual nsresult SetInlineStyleDeclaration(mozilla::DeclarationBlock* aDeclaration,
const nsAString* aSerialized,
bool aNotify) override;