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

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

Issue 69543007: Have NodeTraversal::nextSkippingChildren() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
Index: Source/core/dom/NodeTraversal.h
diff --git a/Source/core/dom/NodeTraversal.h b/Source/core/dom/NodeTraversal.h
index d428e8f80f564d1a4c4faf619e142618b490ef3e..67d6ae99e9d884ccf1c8d0f90b387ad8b2cd790a 100644
--- a/Source/core/dom/NodeTraversal.h
+++ b/Source/core/dom/NodeTraversal.h
@@ -64,8 +64,8 @@ Node* previousIncludingPseudo(const Node*, const Node* stayWithin = 0);
Node* nextIncludingPseudo(const Node*, const Node* stayWithin = 0);
Node* nextIncludingPseudoSkippingChildren(const Node*, const Node* stayWithin = 0);
-Node* nextAncestorSibling(const Node*);
-Node* nextAncestorSibling(const Node*, const Node* stayWithin);
+Node* nextAncestorSibling(const Node&);
+Node* nextAncestorSibling(const Node&, const Node* stayWithin);
template <class NodeType>
inline Node* traverseNextTemplate(NodeType& current)
@@ -74,7 +74,7 @@ inline Node* traverseNextTemplate(NodeType& current)
return current.firstChild();
if (current.nextSibling())
return current.nextSibling();
- return nextAncestorSibling(&current);
+ return nextAncestorSibling(current);
}
inline Node* next(const Node& current) { return traverseNextTemplate(current); }
inline Node* next(const ContainerNode& current) { return traverseNextTemplate(current); }
@@ -88,32 +88,32 @@ inline Node* traverseNextTemplate(NodeType& current, const Node* stayWithin)
return 0;
if (current.nextSibling())
return current.nextSibling();
- return nextAncestorSibling(&current, stayWithin);
+ return nextAncestorSibling(current, stayWithin);
}
inline Node* next(const Node& current, const Node* stayWithin) { return traverseNextTemplate(current, stayWithin); }
inline Node* next(const ContainerNode& current, const Node* stayWithin) { return traverseNextTemplate(current, stayWithin); }
template <class NodeType>
-inline Node* traverseNextSkippingChildrenTemplate(NodeType* current)
+inline Node* traverseNextSkippingChildrenTemplate(NodeType& current)
{
- if (current->nextSibling())
- return current->nextSibling();
+ if (current.nextSibling())
+ return current.nextSibling();
return nextAncestorSibling(current);
}
-inline Node* nextSkippingChildren(const Node* current) { return traverseNextSkippingChildrenTemplate(current); }
-inline Node* nextSkippingChildren(const ContainerNode* current) { return traverseNextSkippingChildrenTemplate(current); }
+inline Node* nextSkippingChildren(const Node& current) { return traverseNextSkippingChildrenTemplate(current); }
+inline Node* nextSkippingChildren(const ContainerNode& current) { return traverseNextSkippingChildrenTemplate(current); }
template <class NodeType>
-inline Node* traverseNextSkippingChildrenTemplate(NodeType* current, const Node* stayWithin)
+inline Node* traverseNextSkippingChildrenTemplate(NodeType& current, const Node* stayWithin)
{
if (current == stayWithin)
return 0;
- if (current->nextSibling())
- return current->nextSibling();
+ if (current.nextSibling())
+ return current.nextSibling();
return nextAncestorSibling(current, stayWithin);
}
-inline Node* nextSkippingChildren(const Node* current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
-inline Node* nextSkippingChildren(const ContainerNode* current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
+inline Node* nextSkippingChildren(const Node& current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
+inline Node* nextSkippingChildren(const ContainerNode& current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
}

Powered by Google App Engine
This is Rietveld 408576698