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

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

Issue 65303008: Have ElementTraversal::firstWithin() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase 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 8e1db0e1c29a187fa843ebf656f89656db5831eb..f3307d98e76488d2768967549dc3d4a3c6425831 100644
--- a/Source/core/dom/ElementTraversal.h
+++ b/Source/core/dom/ElementTraversal.h
@@ -33,8 +33,8 @@ namespace WebCore {
namespace ElementTraversal {
// First element child of the node.
-Element* firstWithin(const Node*);
-Element* firstWithin(const ContainerNode*);
+Element* firstWithin(const Node&);
+Element* firstWithin(const ContainerNode&);
// Pre-order traversal skipping non-element nodes.
Element* next(const Node&);
@@ -57,16 +57,16 @@ Element* nextIncludingPseudoSkippingChildren(const Node*, const Node* stayWithin
Element* pseudoAwarePreviousSibling(const Node&);
template <class NodeType>
-inline Element* firstElementWithinTemplate(NodeType* current)
+inline Element* firstElementWithinTemplate(NodeType& current)
{
// Except for the root containers, only elements can have element children.
- Node* node = current->firstChild();
+ Node* node = current.firstChild();
while (node && !node->isElementNode())
node = node->nextSibling();
return toElement(node);
}
-inline Element* firstWithin(const ContainerNode* current) { return firstElementWithinTemplate(current); }
-inline Element* firstWithin(const Node* current) { return firstElementWithinTemplate(current); }
+inline Element* firstWithin(const ContainerNode& current) { return firstElementWithinTemplate(current); }
+inline Element* firstWithin(const Node& current) { return firstElementWithinTemplate(current); }
template <class NodeType>
inline Element* traverseNextElementTemplate(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