| Index: Source/core/dom/NodeTraversal.h
|
| diff --git a/Source/core/dom/NodeTraversal.h b/Source/core/dom/NodeTraversal.h
|
| index 652d7025e9dbaed598d867f8173237bebbdd0310..fafabc8e2de7d3fc1872b805ef837d167c8916eb 100644
|
| --- a/Source/core/dom/NodeTraversal.h
|
| +++ b/Source/core/dom/NodeTraversal.h
|
| @@ -70,11 +70,17 @@ public:
|
| static Node* nextAncestorSibling(const Node&, const Node* stayWithin);
|
| static Node& highestAncestorOrSelf(Node&);
|
|
|
| + // Children traversal.
|
| + static Node* childAt(const Node& parent, unsigned index) { return childAtTemplate(parent, index); }
|
| + static Node* childAt(const ContainerNode& parent, unsigned index) { return childAtTemplate(parent, index); }
|
| +
|
| private:
|
| template <class NodeType>
|
| static Node* traverseNextTemplate(NodeType&);
|
| template <class NodeType>
|
| static Node* traverseNextTemplate(NodeType&, const Node* stayWithin);
|
| + template <class NodeType>
|
| + static Node* childAtTemplate(NodeType&, unsigned);
|
| };
|
|
|
| template <class NodeType>
|
| @@ -123,6 +129,15 @@ inline Node& NodeTraversal::highestAncestorOrSelf(Node& current)
|
| return *highest;
|
| }
|
|
|
| +template <class NodeType>
|
| +inline Node* NodeTraversal::childAtTemplate(NodeType& parent, unsigned index)
|
| +{
|
| + Node* child = parent.firstChild();
|
| + while (child && index--)
|
| + child = child->nextSibling();
|
| + return child;
|
| +}
|
| +
|
| } // namespace blink
|
|
|
| #endif
|
|
|