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

Unified Diff: Source/core/html/HTMLCollection.cpp

Issue 154803002: Use ContainerNode type instead of Node for LiveNodeListBase's rootNode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCollection.cpp
diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp
index 12574b936ccf69480f342f8f8b7f4bbde8d46cb8..e39fdd75e569f359799db8c20cb794952cac738e 100644
--- a/Source/core/html/HTMLCollection.cpp
+++ b/Source/core/html/HTMLCollection.cpp
@@ -284,12 +284,12 @@ template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const El
return nodeList.nodeMatches(element);
}
-static Node* previousNode(const Node& base, const Node& previous, bool onlyIncludeDirectChildren)
+static Node* previousNode(const ContainerNode& base, const Node& previous, bool onlyIncludeDirectChildren)
{
return onlyIncludeDirectChildren ? previous.previousSibling() : NodeTraversal::previous(previous, &base);
}
-static inline Node* lastDescendant(const Node& node)
+static inline Node* lastDescendant(const ContainerNode& node)
{
Node* descendant = node.lastChild();
for (Node* current = descendant; current; current = current->lastChild())
@@ -297,7 +297,7 @@ static inline Node* lastDescendant(const Node& node)
return descendant;
}
-static Node* lastNode(const Node& rootNode, bool onlyIncludeDirectChildren)
+static Node* lastNode(const ContainerNode& rootNode, bool onlyIncludeDirectChildren)
{
return onlyIncludeDirectChildren ? rootNode.lastChild() : lastDescendant(rootNode);
}
@@ -306,7 +306,7 @@ template <typename Collection>
ALWAYS_INLINE Element* LiveNodeListBase::iterateForPreviousNode(const Collection& collection, Node* current)
{
bool onlyIncludeDirectChildren = collection.shouldOnlyIncludeDirectChildren();
- Node& rootNode = collection.rootNode();
+ ContainerNode& rootNode = collection.rootNode();
for (; current; current = previousNode(rootNode, *current, onlyIncludeDirectChildren)) {
if (current->isElementNode() && isMatchingElement(collection, toElement(*current)))
return toElement(current);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698