Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Unified Diff: Source/core/dom/Element.cpp

Issue 22842013: setAttributeNode() does not set the new value to an existing attribute if specified attribute is in… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: modifying the layout testcase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index e1c3099cf55947c5e21e9c58811291f3fe6c68f3..3d59dc934eb07e1325676dc5044ed70bcb4d078e 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -867,21 +867,23 @@ inline void Element::setAttributeInternal(size_t index, const QualifiedName& nam
return;
}
+ const QualifiedName& existingAttributeName = attributeItem(index)->name();
+
if (!inSynchronizationOfLazyAttribute)
- willModifyAttribute(name, attributeItem(index)->value(), newValue);
+ willModifyAttribute(existingAttributeName, attributeItem(index)->value(), newValue);
if (newValue != attributeItem(index)->value()) {
// If there is an Attr node hooked to this attribute, the Attr::setValue() call below
// will write into the ElementData.
// FIXME: Refactor this so it makes some sense.
- if (RefPtr<Attr> attrNode = inSynchronizationOfLazyAttribute ? 0 : attrIfExists(name))
+ if (RefPtr<Attr> attrNode = inSynchronizationOfLazyAttribute ? 0 : attrIfExists(existingAttributeName))
attrNode->setValue(newValue);
else
ensureUniqueElementData()->attributeItem(index)->setValue(newValue);
}
if (!inSynchronizationOfLazyAttribute)
- didModifyAttribute(name, newValue);
+ didModifyAttribute(existingAttributeName, newValue);
}
static inline AtomicString makeIdForStyleResolution(const AtomicString& value, bool inQuirksMode)

Powered by Google App Engine
This is Rietveld 408576698