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

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

Issue 177613003: Consistently cache ElementData::length() before loops (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test failure Created 6 years, 10 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 | « Source/core/dom/ElementData.cpp ('k') | Source/core/html/HTMLEmbedElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 63dd1935cc7dc1452b07f22e7becee1113658d3c..08bea08b9483b1b31c7fb1e6ef4416a85294c805 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -1341,7 +1341,8 @@ bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const
return elem->namespaceURI() == namespaceURI;
if (elem->hasAttributes()) {
- for (unsigned i = 0; i < elem->attributeCount(); i++) {
+ unsigned attributeCount = elem->attributeCount();
+ for (unsigned i = 0; i < attributeCount; ++i) {
const Attribute* attr = elem->attributeItem(i);
if (attr->localName() == xmlnsAtom)
@@ -1426,7 +1427,8 @@ const AtomicString& Node::lookupNamespaceURI(const String& prefix) const
return elem->namespaceURI();
if (elem->hasAttributes()) {
- for (unsigned i = 0; i < elem->attributeCount(); i++) {
+ unsigned attributeCount = elem->attributeCount();
+ for (unsigned i = 0; i < attributeCount; ++i) {
const Attribute* attr = elem->attributeItem(i);
if (attr->prefix() == xmlnsAtom && attr->localName() == prefix) {
« no previous file with comments | « Source/core/dom/ElementData.cpp ('k') | Source/core/html/HTMLEmbedElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698