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

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

Issue 224303004: Stop passing the root node to node lists traversal functions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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/dom/LiveNodeList.cpp ('k') | Source/core/html/CollectionIndexCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/LiveNodeListBase.h
diff --git a/Source/core/dom/LiveNodeListBase.h b/Source/core/dom/LiveNodeListBase.h
index ecc1730cac35ff56d25909390b1e81df512e991e..06e47d1895e838a5499c1c873a776777e7e6ad14 100644
--- a/Source/core/dom/LiveNodeListBase.h
+++ b/Source/core/dom/LiveNodeListBase.h
@@ -87,11 +87,11 @@ protected:
template <typename Collection>
static Element* itemBefore(const Collection&, const Element* previousItem);
template <class NodeListType>
- static Element* firstMatchingElement(const NodeListType&, const ContainerNode&);
+ static Element* firstMatchingElement(const NodeListType&);
template <class NodeListType>
- static Element* nextMatchingElement(const NodeListType&, Element& current, const ContainerNode& root);
+ static Element* nextMatchingElement(const NodeListType&, Element& current);
template <class NodeListType>
- static Element* traverseMatchingElementsForwardToOffset(const NodeListType&, unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root);
+ static Element* traverseMatchingElementsForwardToOffset(const NodeListType&, unsigned offset, Element& currentElement, unsigned& currentOffset);
private:
void invalidateIdNameCacheMaps() const;
@@ -174,8 +174,9 @@ Element* LiveNodeListBase::itemBefore(const Collection& collection, const Elemen
}
template <class NodeListType>
-Element* LiveNodeListBase::firstMatchingElement(const NodeListType& nodeList, const ContainerNode& root)
+Element* LiveNodeListBase::firstMatchingElement(const NodeListType& nodeList)
{
+ ContainerNode& root = nodeList.rootNode();
Element* element = ElementTraversal::firstWithin(root);
while (element && !isMatchingElement(nodeList, *element))
element = ElementTraversal::next(*element, &root);
@@ -183,8 +184,9 @@ Element* LiveNodeListBase::firstMatchingElement(const NodeListType& nodeList, co
}
template <class NodeListType>
-Element* LiveNodeListBase::nextMatchingElement(const NodeListType& nodeList, Element& current, const ContainerNode& root)
+Element* LiveNodeListBase::nextMatchingElement(const NodeListType& nodeList, Element& current)
{
+ ContainerNode& root = nodeList.rootNode();
Element* next = &current;
do {
next = ElementTraversal::next(*next, &root);
@@ -193,11 +195,11 @@ Element* LiveNodeListBase::nextMatchingElement(const NodeListType& nodeList, Ele
}
template <class NodeListType>
-Element* LiveNodeListBase::traverseMatchingElementsForwardToOffset(const NodeListType& nodeList, unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root)
+Element* LiveNodeListBase::traverseMatchingElementsForwardToOffset(const NodeListType& nodeList, unsigned offset, Element& currentElement, unsigned& currentOffset)
{
ASSERT(currentOffset < offset);
Element* next = &currentElement;
- while ((next = nextMatchingElement(nodeList, *next, root))) {
+ while ((next = nextMatchingElement(nodeList, *next))) {
if (++currentOffset == offset)
return next;
}
« no previous file with comments | « Source/core/dom/LiveNodeList.cpp ('k') | Source/core/html/CollectionIndexCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698