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

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

Issue 60143002: Minimize performance regression caused by r157508 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reworked patch Created 7 years, 1 month 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 | « no previous file | 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 d7d1695d4bb43b3500db8b05a4d4bc42d6c90aa5..db7ace97e2c10869333f046d87afa13bb59f4c0a 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -178,11 +178,12 @@ static void removeAttrNodeListForElement(Element* element)
element->setHasSyntheticAttrChildNodes(false);
}
-static Attr* findAttrNodeInList(AttrNodeList& attrNodeList, const QualifiedName& name)
+static Attr* findAttrNodeInList(const AttrNodeList& attrNodeList, const QualifiedName& name)
{
- for (unsigned i = 0; i < attrNodeList.size(); ++i) {
- if (attrNodeList[i]->qualifiedName() == name)
- return attrNodeList[i].get();
+ AttrNodeList::const_iterator end = attrNodeList.end();
+ for (AttrNodeList::const_iterator it = attrNodeList.begin(); it != end; ++it) {
+ if ((*it)->qualifiedName() == name)
eseidel 2013/11/06 03:12:24 I wonder if this really wants matches() :) Which
+ return it->get();
}
return 0;
}
@@ -923,12 +924,13 @@ inline void Element::setAttributeInternal(size_t index, const QualifiedName& nam
return;
}
- QualifiedName existingAttributeName = attributeItem(index)->name();
+ const Attribute* existingAttribute = attributeItem(index);
+ QualifiedName existingAttributeName = existingAttribute->name();
if (!inSynchronizationOfLazyAttribute)
- willModifyAttribute(existingAttributeName, attributeItem(index)->value(), newValue);
+ willModifyAttribute(existingAttributeName, existingAttribute->value(), newValue);
- if (newValue != attributeItem(index)->value()) {
+ if (newValue != existingAttribute->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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698