| Index: Source/core/dom/NodeTraversal.h
|
| diff --git a/Source/core/dom/NodeTraversal.h b/Source/core/dom/NodeTraversal.h
|
| index c0c9053e0aec733cd7b04df5acb1b7a364564dcb..652d7025e9dbaed598d867f8173237bebbdd0310 100644
|
| --- a/Source/core/dom/NodeTraversal.h
|
| +++ b/Source/core/dom/NodeTraversal.h
|
| @@ -26,6 +26,7 @@
|
| #ifndef NodeTraversal_h
|
| #define NodeTraversal_h
|
|
|
| +#include "core/dom/ContainerNode.h"
|
| #include "core/dom/Node.h"
|
|
|
| namespace blink {
|
| @@ -67,6 +68,7 @@ public:
|
|
|
| static Node* nextAncestorSibling(const Node&);
|
| static Node* nextAncestorSibling(const Node&, const Node* stayWithin);
|
| + static Node& highestAncestorOrSelf(Node&);
|
|
|
| private:
|
| template <class NodeType>
|
| @@ -113,6 +115,14 @@ inline Node* NodeTraversal::nextSkippingChildren(const Node& current, const Node
|
| return nextAncestorSibling(current, stayWithin);
|
| }
|
|
|
| +inline Node& NodeTraversal::highestAncestorOrSelf(Node& current)
|
| +{
|
| + Node* highest = ¤t;
|
| + while (highest->parentNode())
|
| + highest = highest->parentNode();
|
| + return *highest;
|
| +}
|
| +
|
| } // namespace blink
|
|
|
| #endif
|
|
|