| Index: Source/core/dom/NodeTraversal.h
|
| diff --git a/Source/core/dom/NodeTraversal.h b/Source/core/dom/NodeTraversal.h
|
| index f48ddd687833feae0d842424d3b4dcb8d18b1623..995613a46958b917a087ad08b5b26a30b00e1c6d 100644
|
| --- a/Source/core/dom/NodeTraversal.h
|
| +++ b/Source/core/dom/NodeTraversal.h
|
| @@ -26,7 +26,6 @@
|
| #define NodeTraversal_h
|
|
|
| #include "core/dom/Node.h"
|
| -#include "wtf/TreeNode.h"
|
|
|
| namespace WebCore {
|
|
|
| @@ -64,17 +63,56 @@ Node* previousIncludingPseudo(const Node&, const Node* stayWithin = 0);
|
| Node* nextIncludingPseudo(const Node&, const Node* stayWithin = 0);
|
| Node* nextIncludingPseudoSkippingChildren(const Node&, const Node* stayWithin = 0);
|
|
|
| -inline Node* next(const Node& current) { return traverseNext<Node>(current); }
|
| -inline Node* next(const ContainerNode& current) { return traverseNext<Node, ContainerNode>(current); }
|
| -
|
| -inline Node* next(const Node& current, const Node* stayWithin) { return traverseNext<Node>(current, stayWithin); }
|
| -inline Node* next(const ContainerNode& current, const Node* stayWithin) { return traverseNext<Node, ContainerNode>(current, stayWithin); }
|
| -
|
| -inline Node* nextSkippingChildren(const Node& current) { return traverseNextSkippingChildren<Node>(current); }
|
| -inline Node* nextSkippingChildren(const ContainerNode& current) { return traverseNextSkippingChildren<Node, ContainerNode>(current); }
|
| -
|
| -inline Node* nextSkippingChildren(const Node& current, const Node* stayWithin) { return traverseNextSkippingChildren<Node>(current, stayWithin); }
|
| -inline Node* nextSkippingChildren(const ContainerNode& current, const Node* stayWithin) { return traverseNextSkippingChildren<Node, ContainerNode>(current, stayWithin); }
|
| +Node* nextAncestorSibling(const Node&);
|
| +Node* nextAncestorSibling(const Node&, const Node* stayWithin);
|
| +
|
| +template <class NodeType>
|
| +inline Node* traverseNextTemplate(NodeType& current)
|
| +{
|
| + if (current.firstChild())
|
| + return current.firstChild();
|
| + if (current.nextSibling())
|
| + return current.nextSibling();
|
| + return nextAncestorSibling(current);
|
| +}
|
| +inline Node* next(const Node& current) { return traverseNextTemplate(current); }
|
| +inline Node* next(const ContainerNode& current) { return traverseNextTemplate(current); }
|
| +
|
| +template <class NodeType>
|
| +inline Node* traverseNextTemplate(NodeType& current, const Node* stayWithin)
|
| +{
|
| + if (current.firstChild())
|
| + return current.firstChild();
|
| + if (current == stayWithin)
|
| + return 0;
|
| + if (current.nextSibling())
|
| + return current.nextSibling();
|
| + return nextAncestorSibling(current, stayWithin);
|
| +}
|
| +inline Node* next(const Node& current, const Node* stayWithin) { return traverseNextTemplate(current, stayWithin); }
|
| +inline Node* next(const ContainerNode& current, const Node* stayWithin) { return traverseNextTemplate(current, stayWithin); }
|
| +
|
| +template <class NodeType>
|
| +inline Node* traverseNextSkippingChildrenTemplate(NodeType& current)
|
| +{
|
| + if (current.nextSibling())
|
| + return current.nextSibling();
|
| + return nextAncestorSibling(current);
|
| +}
|
| +inline Node* nextSkippingChildren(const Node& current) { return traverseNextSkippingChildrenTemplate(current); }
|
| +inline Node* nextSkippingChildren(const ContainerNode& current) { return traverseNextSkippingChildrenTemplate(current); }
|
| +
|
| +template <class NodeType>
|
| +inline Node* traverseNextSkippingChildrenTemplate(NodeType& current, const Node* stayWithin)
|
| +{
|
| + if (current == stayWithin)
|
| + return 0;
|
| + if (current.nextSibling())
|
| + return current.nextSibling();
|
| + return nextAncestorSibling(current, stayWithin);
|
| +}
|
| +inline Node* nextSkippingChildren(const Node& current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
|
| +inline Node* nextSkippingChildren(const ContainerNode& current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
|
|
|
| }
|
|
|
|
|