Remove unnecessary overloads taking a ContainerNode in Element Traversal
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Sep 2014 02:23:01 +0000 (02:23 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Sep 2014 02:23:01 +0000 (02:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136767

Reviewed by Darin Adler.

Remove unnecessary overloads taking a ContainerNode in Element Traversal.
Several of those don't bring any performance improvements as the needed
methods are defined on Node (not ContainerNode).

No new tests, no behavior change.

* dom/ElementTraversal.h:
(WebCore::Traversal<Element>::previous):
NodeTraversal::previous() takes a const Node* in argument so the
ContainerNode overload is not needed.

(WebCore::Traversal<ElementType>::previous):
Unnecessary now that Traversal<Element>::previous() takes a const Node*
in argument.

(WebCore::Traversal<ElementType>::nextSibling):
nextSibling() is defined on Node, not ContainerNode, so the overload
is not needed.

(WebCore::Traversal<ElementType>::previousSibling):
previousSibling() is defined on Node, not ContainerNode, so the overload
is not needed.

(WebCore::Traversal<Element>::previousTemplate): Deleted.
(WebCore::Traversal<ElementType>::previousTemplate): Deleted.
(WebCore::Traversal<ElementType>::nextSiblingTemplate): Deleted.
(WebCore::Traversal<ElementType>::previousSiblingTemplate): Deleted.
No need to have those functions templated anymore.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173609 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/ElementTraversal.h

index 3708d4c..7f36665 100644 (file)
@@ -1,3 +1,39 @@
+2014-09-14  Chris Dumez  <cdumez@apple.com>
+
+        Remove unnecessary overloads taking a ContainerNode in Element Traversal
+        https://bugs.webkit.org/show_bug.cgi?id=136767
+
+        Reviewed by Darin Adler.
+
+        Remove unnecessary overloads taking a ContainerNode in Element Traversal.
+        Several of those don't bring any performance improvements as the needed
+        methods are defined on Node (not ContainerNode).
+
+        No new tests, no behavior change.
+
+        * dom/ElementTraversal.h:
+        (WebCore::Traversal<Element>::previous):
+        NodeTraversal::previous() takes a const Node* in argument so the
+        ContainerNode overload is not needed.
+
+        (WebCore::Traversal<ElementType>::previous):
+        Unnecessary now that Traversal<Element>::previous() takes a const Node*
+        in argument.
+
+        (WebCore::Traversal<ElementType>::nextSibling):
+        nextSibling() is defined on Node, not ContainerNode, so the overload
+        is not needed.
+
+        (WebCore::Traversal<ElementType>::previousSibling):
+        previousSibling() is defined on Node, not ContainerNode, so the overload
+        is not needed.
+
+        (WebCore::Traversal<Element>::previousTemplate): Deleted.
+        (WebCore::Traversal<ElementType>::previousTemplate): Deleted.
+        (WebCore::Traversal<ElementType>::nextSiblingTemplate): Deleted.
+        (WebCore::Traversal<ElementType>::previousSiblingTemplate): Deleted.
+        No need to have those functions templated anymore.
+
 2014-09-14  Daniel Bates  <dabates@apple.com>
 
         [iOS] Attempt to fix the iOS build after <http://trac.webkit.org/changeset/173606>
index 59b817c..a03b96d 100644 (file)
@@ -52,14 +52,10 @@ public:
     static ElementType* next(const ContainerNode*, const Node* stayWithin);
     static ElementType* previous(const Node*);
     static ElementType* previous(const Node*, const Node* stayWithin);
-    static ElementType* previous(const ContainerNode*);
-    static ElementType* previous(const ContainerNode*, const Node* stayWithin);
 
     // Next or previous ElementType sibling if there is one.
     static ElementType* nextSibling(const Node*);
-    static ElementType* nextSibling(const ContainerNode*);
     static ElementType* previousSibling(const Node*);
-    static ElementType* previousSibling(const ContainerNode*);
 
     // Like next, but skips children.
     static ElementType* nextSkippingChildren(const Node*);
@@ -72,10 +68,6 @@ private:
     template <typename CurrentType> static ElementType* lastWithinTemplate(CurrentType*);
     template <typename CurrentType> static ElementType* nextTemplate(CurrentType*);
     template <typename CurrentType> static ElementType* nextTemplate(CurrentType*, const Node* stayWithin);
-    template <typename CurrentType> static ElementType* previousTemplate(CurrentType*);
-    template <typename CurrentType> static ElementType* previousTemplate(CurrentType*, const Node* stayWithin);
-    template <typename CurrentType> static ElementType* nextSiblingTemplate(CurrentType*);
-    template <typename CurrentType> static ElementType* previousSiblingTemplate(CurrentType*);
 };
 
 class ElementTraversal : public Traversal<Element> {
@@ -129,8 +121,7 @@ inline Element* Traversal<Element>::nextTemplate(CurrentType* current, const Nod
 }
 
 template <>
-template <typename CurrentType>
-inline Element* Traversal<Element>::previousTemplate(CurrentType* current)
+inline Element* Traversal<Element>::previous(const Node* current)
 {
     Node* node = NodeTraversal::previous(current);
     while (node && !node->isElementNode())
@@ -139,8 +130,7 @@ inline Element* Traversal<Element>::previousTemplate(CurrentType* current)
 }
 
 template <>
-template <typename CurrentType>
-inline Element* Traversal<Element>::previousTemplate(CurrentType* current, const Node* stayWithin)
+inline Element* Traversal<Element>::previous(const Node* current, const Node* stayWithin)
 {
     Node* node = NodeTraversal::previous(current, stayWithin);
     while (node && !node->isElementNode())
@@ -210,8 +200,7 @@ inline ElementType* Traversal<ElementType>::nextTemplate(CurrentType* current, c
 }
 
 template <typename ElementType>
-template <typename CurrentType>
-inline ElementType* Traversal<ElementType>::previousTemplate(CurrentType* current)
+inline ElementType* Traversal<ElementType>::previous(const Node* current)
 {
     Element* element = Traversal<Element>::previous(current);
     while (element && !isElementOfType<const ElementType>(*element))
@@ -220,8 +209,7 @@ inline ElementType* Traversal<ElementType>::previousTemplate(CurrentType* curren
 }
 
 template <typename ElementType>
-template <typename CurrentType>
-inline ElementType* Traversal<ElementType>::previousTemplate(CurrentType* current, const Node* stayWithin)
+inline ElementType* Traversal<ElementType>::previous(const Node* current, const Node* stayWithin)
 {
     Element* element = Traversal<Element>::previous(current, stayWithin);
     while (element && !isElementOfType<const ElementType>(*element))
@@ -230,8 +218,7 @@ inline ElementType* Traversal<ElementType>::previousTemplate(CurrentType* curren
 }
 
 template <typename ElementType>
-template <typename CurrentType>
-inline ElementType* Traversal<ElementType>::nextSiblingTemplate(CurrentType* current)
+inline ElementType* Traversal<ElementType>::nextSibling(const Node* current)
 {
     Node* node = current->nextSibling();
     while (node && !isElementOfType<const ElementType>(*node))
@@ -240,8 +227,7 @@ inline ElementType* Traversal<ElementType>::nextSiblingTemplate(CurrentType* cur
 }
 
 template <typename ElementType>
-template <typename CurrentType>
-inline ElementType* Traversal<ElementType>::previousSiblingTemplate(CurrentType* current)
+inline ElementType* Traversal<ElementType>::previousSibling(const Node* current)
 {
     Node* node = current->previousSibling();
     while (node && !isElementOfType<const ElementType>(*node))
@@ -296,25 +282,6 @@ inline ElementType* Traversal<ElementType>::next(const ContainerNode* current, c
 template <typename ElementType>
 inline ElementType* Traversal<ElementType>::next(const Node* current, const Node* stayWithin) { return nextTemplate(current, stayWithin); }
 
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::previous(const ContainerNode* current) { return previousTemplate(current); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::previous(const Node* current) { return previousTemplate(current); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::previous(const ContainerNode* current, const Node* stayWithin) { return previousTemplate(current, stayWithin); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::previous(const Node* current, const Node* stayWithin) { return previousTemplate(current, stayWithin); }
-
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::nextSibling(const ContainerNode* current) { return nextSiblingTemplate(current); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::nextSibling(const Node* current) { return nextSiblingTemplate(current); }
-
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::previousSibling(const ContainerNode* current) { return previousSiblingTemplate(current); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::previousSibling(const Node* current) { return previousSiblingTemplate(current); }
-
 // FIXME: These should go somewhere else.
 inline Element* ElementTraversal::previousIncludingPseudo(const Node* current, const Node* stayWithin)
 {