Title: [173609] trunk/Source/WebCore
Revision
173609
Author
cdu...@apple.com
Date
2014-09-14 19:23:01 -0700 (Sun, 14 Sep 2014)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173608 => 173609)


--- trunk/Source/WebCore/ChangeLog	2014-09-15 01:51:56 UTC (rev 173608)
+++ trunk/Source/WebCore/ChangeLog	2014-09-15 02:23:01 UTC (rev 173609)
@@ -1,3 +1,39 @@
+2014-09-14  Chris Dumez  <cdu...@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  <daba...@apple.com>
 
         [iOS] Attempt to fix the iOS build after <http://trac.webkit.org/changeset/173606>

Modified: trunk/Source/WebCore/dom/ElementTraversal.h (173608 => 173609)


--- trunk/Source/WebCore/dom/ElementTraversal.h	2014-09-15 01:51:56 UTC (rev 173608)
+++ trunk/Source/WebCore/dom/ElementTraversal.h	2014-09-15 02:23:01 UTC (rev 173609)
@@ -52,14 +52,10 @@
     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 @@
     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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 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)
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to