Commit 746608f5 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Remove ContainerNode overload for ElementTraversal::previous()

Remove ContainerNode overload for NodeTraversal::previous() as it adds no
benefit compared to the one taking a Node in argument.

The ElementTraversal::previous() implementation calls NodeTraversal::previous()
which does not have a ContainerNode overload. The NodeTraversal::previous()
implementation calls previousSibling() and parentNode() on the argument so
having a ContainerNode overload for it wouldn't help as those operations are
fast on pure Nodes.

R=esprehn@chromium.org, adamk@chromium.org

Review URL: https://codereview.chromium.org/425033002

git-svn-id: svn://svn.chromium.org/blink/trunk@179163 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 88255944
...@@ -59,10 +59,8 @@ public: ...@@ -59,10 +59,8 @@ public:
static ElementType* next(const Node& current) { return nextTemplate(current); } static ElementType* next(const Node& current) { return nextTemplate(current); }
static ElementType* next(const ContainerNode& current, const Node* stayWithin) { return nextTemplate(current, stayWithin); } static ElementType* next(const ContainerNode& current, const Node* stayWithin) { return nextTemplate(current, stayWithin); }
static ElementType* next(const Node& current, const Node* stayWithin) { return nextTemplate(current, stayWithin); } static ElementType* next(const Node& current, const Node* stayWithin) { return nextTemplate(current, stayWithin); }
static ElementType* previous(const ContainerNode& current) { return previousTemplate(current); } static ElementType* previous(const Node&);
static ElementType* previous(const Node& current) { return previousTemplate(current); } static ElementType* previous(const Node&, const Node* stayWithin);
static ElementType* previous(const ContainerNode& current, const Node* stayWithin) { return previousTemplate(current, stayWithin); }
static ElementType* previous(const Node& current, const Node* stayWithin) { return previousTemplate(current, stayWithin); }
// Like next, but skips children. // Like next, but skips children.
static ElementType* nextSkippingChildren(const Node&); static ElementType* nextSkippingChildren(const Node&);
...@@ -95,10 +93,6 @@ private: ...@@ -95,10 +93,6 @@ private:
static ElementType* nextTemplate(NodeType&); static ElementType* nextTemplate(NodeType&);
template <class NodeType> template <class NodeType>
static ElementType* nextTemplate(NodeType&, const Node* stayWithin); static ElementType* nextTemplate(NodeType&, const Node* stayWithin);
template <class NodeType>
static ElementType* previousTemplate(NodeType&);
template <class NodeType>
static ElementType* previousTemplate(NodeType&, const Node* stayWithin);
}; };
typedef Traversal<Element> ElementTraversal; typedef Traversal<Element> ElementTraversal;
...@@ -211,8 +205,7 @@ inline ElementType* Traversal<ElementType>::nextTemplate(NodeType& current, cons ...@@ -211,8 +205,7 @@ inline ElementType* Traversal<ElementType>::nextTemplate(NodeType& current, cons
} }
template <class ElementType> template <class ElementType>
template <class NodeType> inline ElementType* Traversal<ElementType>::previous(const Node& current)
inline ElementType* Traversal<ElementType>::previousTemplate(NodeType& current)
{ {
Node* node = NodeTraversal::previous(current); Node* node = NodeTraversal::previous(current);
while (node && !isElementOfType<const ElementType>(*node)) while (node && !isElementOfType<const ElementType>(*node))
...@@ -221,8 +214,7 @@ inline ElementType* Traversal<ElementType>::previousTemplate(NodeType& current) ...@@ -221,8 +214,7 @@ inline ElementType* Traversal<ElementType>::previousTemplate(NodeType& current)
} }
template <class ElementType> template <class ElementType>
template <class NodeType> inline ElementType* Traversal<ElementType>::previous(const Node& current, const Node* stayWithin)
inline ElementType* Traversal<ElementType>::previousTemplate(NodeType& current, const Node* stayWithin)
{ {
Node* node = NodeTraversal::previous(current, stayWithin); Node* node = NodeTraversal::previous(current, stayWithin);
while (node && !isElementOfType<const ElementType>(*node)) while (node && !isElementOfType<const ElementType>(*node))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment