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

Unified Diff: Source/core/dom/ElementTraversal.h

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master 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 | « Source/core/dom/DocumentOrderedMap.cpp ('k') | Source/core/dom/LiveNodeList.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ElementTraversal.h
diff --git a/Source/core/dom/ElementTraversal.h b/Source/core/dom/ElementTraversal.h
index 027873290dab71fbc0f8aedbd47b114eac1eeb8b..0e85492cf15ef62cefc0a11e6cab7d87224f3894 100644
--- a/Source/core/dom/ElementTraversal.h
+++ b/Source/core/dom/ElementTraversal.h
@@ -37,10 +37,10 @@ Element* firstWithin(const Node*);
Element* firstWithin(const ContainerNode*);
// Pre-order traversal skipping non-element nodes.
-Element* next(const Node*);
-Element* next(const Node*, const Node* stayWithin);
-Element* next(const ContainerNode*);
-Element* next(const ContainerNode*, const Node* stayWithin);
+Element* next(const Node&);
+Element* next(const Node&, const Node* stayWithin);
+Element* next(const ContainerNode&);
+Element* next(const ContainerNode&, const Node* stayWithin);
// Like next, but skips children.
Element* nextSkippingChildren(const Node*);
@@ -69,26 +69,26 @@ inline Element* firstWithin(const ContainerNode* current) { return firstElementW
inline Element* firstWithin(const Node* current) { return firstElementWithinTemplate(current); }
template <class NodeType>
-inline Element* traverseNextElementTemplate(NodeType* current)
+inline Element* traverseNextElementTemplate(NodeType& current)
{
Node* node = NodeTraversal::next(current);
while (node && !node->isElementNode())
node = NodeTraversal::nextSkippingChildren(node);
return toElement(node);
}
-inline Element* next(const ContainerNode* current) { return traverseNextElementTemplate(current); }
-inline Element* next(const Node* current) { return traverseNextElementTemplate(current); }
+inline Element* next(const ContainerNode& current) { return traverseNextElementTemplate(current); }
+inline Element* next(const Node& current) { return traverseNextElementTemplate(current); }
template <class NodeType>
-inline Element* traverseNextElementTemplate(NodeType* current, const Node* stayWithin)
+inline Element* traverseNextElementTemplate(NodeType& current, const Node* stayWithin)
{
Node* node = NodeTraversal::next(current, stayWithin);
while (node && !node->isElementNode())
node = NodeTraversal::nextSkippingChildren(node, stayWithin);
return toElement(node);
}
-inline Element* next(const ContainerNode* current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
-inline Element* next(const Node* current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
+inline Element* next(const ContainerNode& current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
+inline Element* next(const Node& current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
template <class NodeType>
inline Element* traverseNextElementSkippingChildrenTemplate(NodeType* current)
« no previous file with comments | « Source/core/dom/DocumentOrderedMap.cpp ('k') | Source/core/dom/LiveNodeList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698