Bug 1423490 part 2. Stop overriding SetAttr in SVGStyleElement. r=bytesized

This aligns the behavior with HTMLStyleElement.

There are no more overrides, so SetAttr can become non-virtual.

MozReview-Commit-ID: 9PFrHg7x0nY
This commit is contained in:
Boris Zbarsky 2018-01-03 14:21:23 -05:00
Родитель 39d7ed06f0
Коммит 2414b4dea3
3 изменённых файлов: 19 добавлений и 40 удалений

Просмотреть файл

@ -914,10 +914,10 @@ public:
* @param aNotify specifies how whether or not the document should be
* notified of the attribute change.
*/
virtual nsresult SetAttr(int32_t aNameSpaceID, nsAtom* aName,
nsAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify);
nsresult SetAttr(int32_t aNameSpaceID, nsAtom* aName,
nsAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify);
/**
* Remove an attribute so that it is no longer explicitly specified.

Просмотреть файл

@ -90,45 +90,26 @@ SVGStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
}
nsresult
SVGStyleElement::SetAttr(int32_t aNameSpaceID, nsAtom* aName,
nsAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
SVGStyleElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
nsresult rv = SVGStyleElementBase::SetAttr(aNameSpaceID, aName, aPrefix,
aValue, aSubjectPrincipal, aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
aName == nsGkAtoms::type) {
UpdateStyleSheetInternal(nullptr, nullptr, true);
} else if (aName == nsGkAtoms::scoped &&
OwnerDoc()->IsScopedStyleEnabled()) {
UpdateStyleSheetScopedness(true);
UpdateStyleSheetScopedness(!!aValue);
}
}
return rv;
}
nsresult
SVGStyleElement::UnsetAttr(int32_t aNameSpaceID, nsAtom* aAttribute,
bool aNotify)
{
nsresult rv = SVGStyleElementBase::UnsetAttr(aNameSpaceID, aAttribute,
aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::title ||
aAttribute == nsGkAtoms::media ||
aAttribute == nsGkAtoms::type) {
UpdateStyleSheetInternal(nullptr, nullptr, true);
} else if (aAttribute == nsGkAtoms::scoped &&
OwnerDoc()->IsScopedStyleEnabled()) {
UpdateStyleSheetScopedness(false);
}
}
return rv;
return SVGStyleElementBase::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aMaybeScriptedPrincipal,
aNotify);
}
bool

Просмотреть файл

@ -44,13 +44,11 @@ public:
bool aCompileEventHandlers) override;
virtual void UnbindFromTree(bool aDeep = true,
bool aNullParent = true) override;
using Element::SetAttr;
virtual nsresult SetAttr(int32_t aNameSpaceID, nsAtom* aName,
nsAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsAtom* aAttribute,
bool aNotify) override;
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) override;
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,