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

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

Issue 180723006: Have ElementData::attributeItem() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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.h ('k') | Source/core/dom/NamedNodeMap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ElementData.cpp
diff --git a/Source/core/dom/ElementData.cpp b/Source/core/dom/ElementData.cpp
index 2cff71fc531461b532f7e88af58ce8febf7a54d9..dbd47f0fdacdd821daa0551b70e00f9a4a1fa55f 100644
--- a/Source/core/dom/ElementData.cpp
+++ b/Source/core/dom/ElementData.cpp
@@ -105,9 +105,9 @@ bool ElementData::isEquivalent(const ElementData* other) const
return false;
for (unsigned i = 0; i < length; ++i) {
- const Attribute* attribute = attributeItem(i);
- const Attribute* otherAttr = other->getAttributeItem(attribute->name());
- if (!otherAttr || attribute->value() != otherAttr->value())
+ const Attribute& attribute = attributeItem(i);
+ const Attribute* otherAttr = other->getAttributeItem(attribute.name());
+ if (!otherAttr || attribute.value() != otherAttr->value())
return false;
}
@@ -119,7 +119,7 @@ size_t ElementData::getAttrIndex(Attr* attr) const
// This relies on the fact that Attr's QualifiedName == the Attribute's name.
unsigned length = this->length();
for (unsigned i = 0; i < length; ++i) {
- if (attributeItem(i)->name() == attr->qualifiedName())
+ if (attributeItem(i).name() == attr->qualifiedName())
return i;
}
return kNotFound;
@@ -130,17 +130,17 @@ size_t ElementData::getAttributeItemIndexSlowCase(const AtomicString& name, bool
// Continue to checking case-insensitively and/or full namespaced names if necessary:
unsigned length = this->length();
for (unsigned i = 0; i < length; ++i) {
- const Attribute* attribute = attributeItem(i);
+ const Attribute& attribute = attributeItem(i);
// FIXME: Why check the prefix? Namespace is all that should matter
// and all HTML/SVG attributes have a null namespace!
- if (!attribute->name().hasPrefix()) {
- if (shouldIgnoreAttributeCase && equalIgnoringCase(name, attribute->localName()))
+ if (!attribute.name().hasPrefix()) {
+ if (shouldIgnoreAttributeCase && equalIgnoringCase(name, attribute.localName()))
return i;
} else {
// FIXME: Would be faster to do this comparison without calling toString, which
// generates a temporary string by concatenation. But this branch is only reached
// if the attribute name has a prefix, which is rare in HTML.
- if (equalPossiblyIgnoringCase(name, attribute->name().toString(), shouldIgnoreAttributeCase))
+ if (equalPossiblyIgnoringCase(name, attribute.name().toString(), shouldIgnoreAttributeCase))
return i;
}
}
« no previous file with comments | « Source/core/dom/ElementData.h ('k') | Source/core/dom/NamedNodeMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698