From 091d06b43b294390a96106e57a7462f6303107a3 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 05:26:58 -0400 Subject: Bug 1363481 - Add the old attribute value as a parameter to Element::AfterSetAttr Tag #1375 --- dom/xul/nsXULElement.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'dom/xul/nsXULElement.cpp') diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index e96bbeef4..af050d9f8 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -360,12 +360,15 @@ nsXULElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const attrValue.SetTo(*originalValue); } + bool oldValueSet; if (originalName->IsAtom()) { rv = element->mAttrsAndChildren.SetAndSwapAttr(originalName->Atom(), - attrValue); + attrValue, + &oldValueSet); } else { rv = element->mAttrsAndChildren.SetAndSwapAttr(originalName->NodeInfo(), - attrValue); + attrValue, + &oldValueSet); } NS_ENSURE_SUCCESS(rv, rv); element->AddListenerFor(*originalName, true); @@ -1053,7 +1056,8 @@ nsXULElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName, nsresult nsXULElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, - const nsAttrValue* aValue, bool aNotify) + const nsAttrValue* aValue, + const nsAttrValue* aOldValue, bool aNotify) { if (aNamespaceID == kNameSpaceID_None) { if (aValue) { @@ -1174,7 +1178,7 @@ nsXULElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, } return nsStyledElement::AfterSetAttr(aNamespaceID, aName, - aValue, aNotify); + aValue, aOldValue, aNotify); } bool @@ -1908,12 +1912,14 @@ nsXULElement::MakeHeavyweight(nsXULPrototypeElement* aPrototype) attrValue.SetTo(protoattr->mValue); } + bool oldValueSet; // XXX we might wanna have a SetAndTakeAttr that takes an nsAttrName if (protoattr->mName.IsAtom()) { - rv = mAttrsAndChildren.SetAndSwapAttr(protoattr->mName.Atom(), attrValue); + rv = mAttrsAndChildren.SetAndSwapAttr(protoattr->mName.Atom(), + attrValue, &oldValueSet); } else { rv = mAttrsAndChildren.SetAndSwapAttr(protoattr->mName.NodeInfo(), - attrValue); + attrValue, &oldValueSet); } NS_ENSURE_SUCCESS(rv, rv); } -- cgit v1.2.3