Index: Source/core/dom/NodeTraversal.cpp |
diff --git a/Source/core/dom/NodeTraversal.cpp b/Source/core/dom/NodeTraversal.cpp |
index d5d298042d2784ef73491936c7037e96700b1e30..b5eba511658b779a44fdf5666f002bd6279262ff 100644 |
--- a/Source/core/dom/NodeTraversal.cpp |
+++ b/Source/core/dom/NodeTraversal.cpp |
@@ -74,6 +74,29 @@ Node* nextIncludingPseudoSkippingChildren(const Node& current, const Node* stayW |
return 0; |
} |
+Node* nextAncestorSibling(const Node& current) |
+{ |
+ ASSERT(!current.nextSibling()); |
+ for (Node* parent = current.parentNode(); parent; parent = parent->parentNode()) { |
+ if (parent->nextSibling()) |
+ return parent->nextSibling(); |
+ } |
+ return 0; |
+} |
+ |
+Node* nextAncestorSibling(const Node& current, const Node* stayWithin) |
+{ |
+ ASSERT(!current.nextSibling()); |
+ ASSERT(current != stayWithin); |
+ for (Node* parent = current.parentNode(); parent; parent = parent->parentNode()) { |
+ if (parent == stayWithin) |
+ return 0; |
+ if (parent->nextSibling()) |
+ return parent->nextSibling(); |
+ } |
+ return 0; |
+} |
+ |
Node* previous(const Node& current, const Node* stayWithin) |
{ |
if (current == stayWithin) |