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

Unified Diff: Source/core/dom/Node.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/NamedNodeMap.cpp ('k') | Source/core/dom/PresentationAttributeStyle.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 af9f5b2f76f3ac0ecf034321eedec209e5ccb89e..c68b65a70962d84fb059d981da4f58dcb101cb33 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -1343,10 +1343,10 @@ bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const
if (elem->hasAttributes()) {
unsigned attributeCount = elem->attributeCount();
for (unsigned i = 0; i < attributeCount; ++i) {
- const Attribute* attr = elem->attributeItem(i);
+ const Attribute& attr = elem->attributeItem(i);
- if (attr->localName() == xmlnsAtom)
- return attr->value() == namespaceURI;
+ if (attr.localName() == xmlnsAtom)
+ return attr.value() == namespaceURI;
}
}
@@ -1429,16 +1429,17 @@ const AtomicString& Node::lookupNamespaceURI(const String& prefix) const
if (elem->hasAttributes()) {
unsigned attributeCount = elem->attributeCount();
for (unsigned i = 0; i < attributeCount; ++i) {
- const Attribute* attr = elem->attributeItem(i);
+ const Attribute& attr = elem->attributeItem(i);
- if (attr->prefix() == xmlnsAtom && attr->localName() == prefix) {
- if (!attr->value().isEmpty())
- return attr->value();
+ if (attr.prefix() == xmlnsAtom && attr.localName() == prefix) {
+ if (!attr.value().isEmpty())
+ return attr.value();
return nullAtom;
- } else if (attr->localName() == xmlnsAtom && prefix.isNull()) {
- if (!attr->value().isEmpty())
- return attr->value();
+ }
+ if (attr.localName() == xmlnsAtom && prefix.isNull()) {
+ if (!attr.value().isEmpty())
+ return attr.value();
return nullAtom;
}
@@ -1592,10 +1593,10 @@ unsigned short Node::compareDocumentPositionInternal(const Node* otherNode, Shad
// the same nodeType are inserted into or removed from the direct container. This would be the case, for example,
// when comparing two attributes of the same element, and inserting or removing additional attributes might change
// the order between existing attributes.
- const Attribute* attribute = owner1->attributeItem(i);
- if (attr1->qualifiedName() == attribute->name())
+ const Attribute& attribute = owner1->attributeItem(i);
+ if (attr1->qualifiedName() == attribute.name())
return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_FOLLOWING;
- if (attr2->qualifiedName() == attribute->name())
+ if (attr2->qualifiedName() == attribute.name())
return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_PRECEDING;
}
« no previous file with comments | « Source/core/dom/NamedNodeMap.cpp ('k') | Source/core/dom/PresentationAttributeStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698