Index: Source/core/dom/ChildNodeList.cpp |
diff --git a/Source/core/dom/ChildNodeList.cpp b/Source/core/dom/ChildNodeList.cpp |
index d87dec6e81c0538a3cf5bb8832274c9f4bb3c633..8c72856e08ece51e5ed21997f0bc876decc3895b 100644 |
--- a/Source/core/dom/ChildNodeList.cpp |
+++ b/Source/core/dom/ChildNodeList.cpp |
@@ -44,11 +44,6 @@ ChildNodeList::~ChildNodeList() |
m_parent->nodeLists()->removeChildNodeList(this); |
} |
-Node* ChildNodeList::itemBefore(const Node* previous) const |
-{ |
- return LIKELY(!!previous) ? previous->previousSibling() : rootNode().lastChild(); |
-} |
- |
Node* ChildNodeList::traverseForwardToOffset(unsigned offset, Node& currentNode, unsigned& currentOffset) const |
{ |
ASSERT(currentOffset < offset); |
@@ -60,4 +55,15 @@ Node* ChildNodeList::traverseForwardToOffset(unsigned offset, Node& currentNode, |
return 0; |
} |
+Node* ChildNodeList::traverseBackwardToOffset(unsigned offset, Node& currentNode, unsigned& currentOffset) const |
+{ |
+ ASSERT(currentOffset > offset); |
+ Node* previous = ¤tNode; |
+ while ((previous = previous->previousSibling())) { |
+ if (--currentOffset == offset) |
+ return previous; |
+ } |
+ return 0; |
+} |
+ |
} // namespace WebCore |