mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1184842. Change nsAttrAndChildArray::SetAndTakeAttr to nsAttrAndChildArray::SetAndSwapAttr. r=peterv
This commit is contained in:
parent
60019c952c
commit
5fc079e9ea
@ -2257,7 +2257,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
||||
nsMutationGuard::DidMutate();
|
||||
|
||||
// Copy aParsedValue for later use since it will be lost when we call
|
||||
// SetAndTakeMappedAttr below
|
||||
// SetAndSwapMappedAttr below
|
||||
nsAttrValue aValueForAfterSetAttr;
|
||||
if (aCallAfterSetAttr) {
|
||||
aValueForAfterSetAttr.SetTo(aParsedValue);
|
||||
@ -2276,7 +2276,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
||||
// stuff to Element?
|
||||
if (!IsAttributeMapped(aName) ||
|
||||
!SetMappedAttribute(document, aName, aParsedValue, &rv)) {
|
||||
rv = mAttrsAndChildren.SetAndTakeAttr(aName, aParsedValue);
|
||||
rv = mAttrsAndChildren.SetAndSwapAttr(aName, aParsedValue);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -2285,7 +2285,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
||||
aNamespaceID,
|
||||
nsIDOMNode::ATTRIBUTE_NODE);
|
||||
|
||||
rv = mAttrsAndChildren.SetAndTakeAttr(ni, aParsedValue);
|
||||
rv = mAttrsAndChildren.SetAndSwapAttr(ni, aParsedValue);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1090,7 +1090,8 @@ protected:
|
||||
* @param aOldValue previous value of attribute. Only needed if
|
||||
* aFireMutation is true or if the element is a
|
||||
* custom element (in web components).
|
||||
* @param aParsedValue parsed new value of attribute
|
||||
* @param aParsedValue parsed new value of attribute. Replaced by the
|
||||
* old value of the attribute.
|
||||
* @param aModType nsIDOMMutationEvent::MODIFICATION or ADDITION. Only
|
||||
* needed if aFireMutation or aNotify is true.
|
||||
* @param aFireMutation should mutation-events be fired?
|
||||
|
@ -387,14 +387,12 @@ nsAttrAndChildArray::AttrAt(uint32_t aPos) const
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttrAndChildArray::SetAndTakeAttr(nsIAtom* aLocalName, nsAttrValue& aValue)
|
||||
nsAttrAndChildArray::SetAndSwapAttr(nsIAtom* aLocalName, nsAttrValue& aValue)
|
||||
{
|
||||
uint32_t i, slotCount = AttrSlotCount();
|
||||
for (i = 0; i < slotCount && AttrSlotIsTaken(i); ++i) {
|
||||
if (ATTRS(mImpl)[i].mName.Equals(aLocalName)) {
|
||||
ATTRS(mImpl)[i].mValue.Reset();
|
||||
ATTRS(mImpl)[i].mValue.SwapValueWith(aValue);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -414,12 +412,12 @@ nsAttrAndChildArray::SetAndTakeAttr(nsIAtom* aLocalName, nsAttrValue& aValue)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttrAndChildArray::SetAndTakeAttr(mozilla::dom::NodeInfo* aName, nsAttrValue& aValue)
|
||||
nsAttrAndChildArray::SetAndSwapAttr(mozilla::dom::NodeInfo* aName, nsAttrValue& aValue)
|
||||
{
|
||||
int32_t namespaceID = aName->NamespaceID();
|
||||
nsIAtom* localName = aName->NameAtom();
|
||||
if (namespaceID == kNameSpaceID_None) {
|
||||
return SetAndTakeAttr(localName, aValue);
|
||||
return SetAndSwapAttr(localName, aValue);
|
||||
}
|
||||
|
||||
uint32_t i, slotCount = AttrSlotCount();
|
||||
|
@ -88,8 +88,8 @@ public:
|
||||
const nsAttrValue* GetAttr(const nsAString& aName,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
const nsAttrValue* AttrAt(uint32_t aPos) const;
|
||||
nsresult SetAndTakeAttr(nsIAtom* aLocalName, nsAttrValue& aValue);
|
||||
nsresult SetAndTakeAttr(mozilla::dom::NodeInfo* aName, nsAttrValue& aValue);
|
||||
nsresult SetAndSwapAttr(nsIAtom* aLocalName, nsAttrValue& aValue);
|
||||
nsresult SetAndSwapAttr(mozilla::dom::NodeInfo* aName, nsAttrValue& aValue);
|
||||
|
||||
// Remove the attr at position aPos. The value of the attr is placed in
|
||||
// aValue; any value that was already in aValue is destroyed.
|
||||
|
@ -138,7 +138,7 @@ nsStyledElementNotElementCSSInlineStyle::ReparseStyleAttribute(bool aForceInData
|
||||
ParseStyleAttribute(stringValue, attrValue, aForceInDataDoc);
|
||||
// Don't bother going through SetInlineStyleRule, we don't want to fire off
|
||||
// mutation events or document notifications anyway
|
||||
nsresult rv = mAttrsAndChildren.SetAndTakeAttr(nsGkAtoms::style, attrValue);
|
||||
nsresult rv = mAttrsAndChildren.SetAndSwapAttr(nsGkAtoms::style, attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
ParseStyleAttribute(stringValue, attrValue, true);
|
||||
// Don't bother going through SetInlineStyleRule, we don't want to fire off
|
||||
// mutation events or document notifications anyway
|
||||
rv = mAttrsAndChildren.SetAndTakeAttr(nsGkAtoms::style, attrValue);
|
||||
rv = mAttrsAndChildren.SetAndSwapAttr(nsGkAtoms::style, attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
@ -1454,6 +1454,8 @@ nsSVGElement::WillChangeValue(nsIAtom* aName)
|
||||
* b) WillChangeXXX will ensure the object represents a serialized version of
|
||||
* the old attribute value so that the value doesn't change when the
|
||||
* underlying SVG type is updated.
|
||||
*
|
||||
* aNewValue is replaced with the old value.
|
||||
*/
|
||||
void
|
||||
nsSVGElement::DidChangeValue(nsIAtom* aName,
|
||||
@ -1489,7 +1491,7 @@ nsSVGElement::MaybeSerializeAttrBeforeRemoval(nsIAtom* aName, bool aNotify)
|
||||
nsAutoString serializedValue;
|
||||
attrValue->ToString(serializedValue);
|
||||
nsAttrValue oldAttrValue(serializedValue);
|
||||
mAttrsAndChildren.SetAndTakeAttr(aName, oldAttrValue);
|
||||
mAttrsAndChildren.SetAndSwapAttr(aName, oldAttrValue);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -404,10 +404,10 @@ nsXULElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
}
|
||||
|
||||
if (originalName->IsAtom()) {
|
||||
rv = element->mAttrsAndChildren.SetAndTakeAttr(originalName->Atom(),
|
||||
rv = element->mAttrsAndChildren.SetAndSwapAttr(originalName->Atom(),
|
||||
attrValue);
|
||||
} else {
|
||||
rv = element->mAttrsAndChildren.SetAndTakeAttr(originalName->NodeInfo(),
|
||||
rv = element->mAttrsAndChildren.SetAndSwapAttr(originalName->NodeInfo(),
|
||||
attrValue);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1896,10 +1896,10 @@ nsXULElement::MakeHeavyweight(nsXULPrototypeElement* aPrototype)
|
||||
|
||||
// XXX we might wanna have a SetAndTakeAttr that takes an nsAttrName
|
||||
if (protoattr->mName.IsAtom()) {
|
||||
rv = mAttrsAndChildren.SetAndTakeAttr(protoattr->mName.Atom(), attrValue);
|
||||
rv = mAttrsAndChildren.SetAndSwapAttr(protoattr->mName.Atom(), attrValue);
|
||||
}
|
||||
else {
|
||||
rv = mAttrsAndChildren.SetAndTakeAttr(protoattr->mName.NodeInfo(),
|
||||
rv = mAttrsAndChildren.SetAndSwapAttr(protoattr->mName.NodeInfo(),
|
||||
attrValue);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
Loading…
Reference in New Issue
Block a user