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

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

Issue 171663005: Consistently use ElementTraversal API when looking for an Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/css/RuleFeature.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 13a6cc2bea7a9267f68ce3098bf9f44009e62ab2..a5fdf4235deaa355d3db8acba275cb50a4a887c2 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -2323,7 +2323,7 @@ HTMLElement* Document::body() const
if (!documentElement())
return 0;
- for (Node* child = documentElement()->firstChild(); child; child = child->nextSibling()) {
+ for (Element* child = ElementTraversal::firstWithin(*documentElement()); child; child = ElementTraversal::nextSibling(*child)) {
if (child->hasTagName(framesetTag) || child->hasTagName(bodyTag))
return toHTMLElement(child);
}
@@ -2365,9 +2365,9 @@ HTMLHeadElement* Document::head()
if (!de)
return 0;
- for (Node* node = de->firstChild(); node; node = node->nextSibling()) {
- if (node->hasTagName(headTag))
- return toHTMLHeadElement(node);
+ for (Element* child = ElementTraversal::firstWithin(*de); child; child = ElementTraversal::nextSibling(*child)) {
+ if (child->hasTagName(headTag))
+ return toHTMLHeadElement(child);
}
return 0;
}
« no previous file with comments | « Source/core/css/RuleFeature.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698