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

Unified Diff: Source/core/dom/LiveNodeList.cpp

Issue 229213002: Make HTMLCollection / NodeList backward traversal consistent with forward one (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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
Index: Source/core/dom/LiveNodeList.cpp
diff --git a/Source/core/dom/LiveNodeList.cpp b/Source/core/dom/LiveNodeList.cpp
index 25ea0915f19e03593d60fc9f9ea81c494e77d90d..7425e9cbf99404b4ed3f77ba930571e578d62d78 100644
--- a/Source/core/dom/LiveNodeList.cpp
+++ b/Source/core/dom/LiveNodeList.cpp
@@ -40,14 +40,14 @@ void LiveNodeList::invalidateCache(Document*) const
m_collectionIndexCache.invalidate();
}
-Element* LiveNodeList::itemBefore(const Element* previous) const
+Element* LiveNodeList::traverseToFirstElement() const
{
- return LiveNodeListBase::itemBefore(*this, previous);
+ return firstMatchingElement(*this);
}
-Element* LiveNodeList::traverseToFirstElement() const
+Element* LiveNodeList::traverseToLastElement() const
{
- return firstMatchingElement(*this);
+ return lastMatchingElement(*this);
}
Element* LiveNodeList::traverseForwardToOffset(unsigned offset, Element& currentNode, unsigned& currentOffset) const
@@ -55,4 +55,9 @@ Element* LiveNodeList::traverseForwardToOffset(unsigned offset, Element& current
return traverseMatchingElementsForwardToOffset(*this, offset, currentNode, currentOffset);
}
+Element* LiveNodeList::traverseBackwardToOffset(unsigned offset, Element& currentNode, unsigned& currentOffset) const
+{
+ return traverseMatchingElementsBackwardToOffset(*this, offset, currentNode, currentOffset);
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698