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

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: Modified for fixing the crash Created 7 years, 3 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
« no previous file with comments | « LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 8de80c724afcf8f528719204ccd268dfd73568b3..81b0e865000df9fd37f6d9f02e57243e4cec8e8c 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -868,21 +868,23 @@ inline void Element::setAttributeInternal(size_t index, const QualifiedName& nam
return;
}
+ 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)
« no previous file with comments | « LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698