summaryrefslogtreecommitdiffstats
path: root/dom/xul
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 05:26:58 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 05:26:58 -0400
commit091d06b43b294390a96106e57a7462f6303107a3 (patch)
tree831e71266ad1a623bc0d0db5e423132cf672314e /dom/xul
parent0f5dcf963a2479a61e370b6b6ffac41be1d5e120 (diff)
downloadUXP-091d06b43b294390a96106e57a7462f6303107a3.tar
UXP-091d06b43b294390a96106e57a7462f6303107a3.tar.gz
UXP-091d06b43b294390a96106e57a7462f6303107a3.tar.lz
UXP-091d06b43b294390a96106e57a7462f6303107a3.tar.xz
UXP-091d06b43b294390a96106e57a7462f6303107a3.zip
Bug 1363481 - Add the old attribute value as a parameter to Element::AfterSetAttr
Tag #1375
Diffstat (limited to 'dom/xul')
-rw-r--r--dom/xul/nsXULElement.cpp18
-rw-r--r--dom/xul/nsXULElement.h4
2 files changed, 15 insertions, 7 deletions
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);
}
diff --git a/dom/xul/nsXULElement.h b/dom/xul/nsXULElement.h
index c2dcadf5f..a30714145 100644
--- a/dom/xul/nsXULElement.h
+++ b/dom/xul/nsXULElement.h
@@ -627,7 +627,9 @@ protected:
const nsAttrValueOrString* aValue,
bool aNotify) override;
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
- const nsAttrValue* aValue, bool aNotify) override;
+ const nsAttrValue* aValue,
+ const nsAttrValue* aOldValue,
+ bool aNotify) override;
virtual void UpdateEditableState(bool aNotify) override;