- Revision
- 173607
- Author
- cdu...@apple.com
- Date
- 2014-09-14 15:19:19 -0700 (Sun, 14 Sep 2014)
Log Message
Drop NodeTraversal::nextSkippingChildren() overload taking a ContainerNode
https://bugs.webkit.org/show_bug.cgi?id=136764
Reviewed by Darin Adler.
Drop NodeTraversal::nextSkippingChildren() overload taking a
ContainerNode argument. This one does not bring any performance
improvement because nextSibling() is defined on Node and
nextAncestorSibling() takes a Node in argument.
Also remove the overload in ElementTraversal as it no longer makes
sense after this change.
No new tests, no behavior change.
* dom/ElementTraversal.h:
(WebCore::Traversal<ElementType>::nextSkippingChildren):
(WebCore::Traversal<ElementType>::nextSkippingChildrenTemplate): Deleted.
* dom/NodeTraversal.h:
(WebCore::NodeTraversal::nextSkippingChildren):
(WebCore::NodeTraversal::next):
(WebCore::NodeTraversal::traverseNextSkippingChildrenTemplate): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (173606 => 173607)
--- trunk/Source/WebCore/ChangeLog 2014-09-14 21:18:27 UTC (rev 173606)
+++ trunk/Source/WebCore/ChangeLog 2014-09-14 22:19:19 UTC (rev 173607)
@@ -1,5 +1,30 @@
2014-09-14 Chris Dumez <cdu...@apple.com>
+ Drop NodeTraversal::nextSkippingChildren() overload taking a ContainerNode
+ https://bugs.webkit.org/show_bug.cgi?id=136764
+
+ Reviewed by Darin Adler.
+
+ Drop NodeTraversal::nextSkippingChildren() overload taking a
+ ContainerNode argument. This one does not bring any performance
+ improvement because nextSibling() is defined on Node and
+ nextAncestorSibling() takes a Node in argument.
+
+ Also remove the overload in ElementTraversal as it no longer makes
+ sense after this change.
+
+ No new tests, no behavior change.
+
+ * dom/ElementTraversal.h:
+ (WebCore::Traversal<ElementType>::nextSkippingChildren):
+ (WebCore::Traversal<ElementType>::nextSkippingChildrenTemplate): Deleted.
+ * dom/NodeTraversal.h:
+ (WebCore::NodeTraversal::nextSkippingChildren):
+ (WebCore::NodeTraversal::next):
+ (WebCore::NodeTraversal::traverseNextSkippingChildrenTemplate): Deleted.
+
+2014-09-14 Chris Dumez <cdu...@apple.com>
+
Rename Node::childNodeCount() to countChildNodes() and avoid inefficient uses
https://bugs.webkit.org/show_bug.cgi?id=136789
Modified: trunk/Source/WebCore/dom/ElementTraversal.h (173606 => 173607)
--- trunk/Source/WebCore/dom/ElementTraversal.h 2014-09-14 21:18:27 UTC (rev 173606)
+++ trunk/Source/WebCore/dom/ElementTraversal.h 2014-09-14 22:19:19 UTC (rev 173607)
@@ -64,8 +64,6 @@
// Like next, but skips children.
static ElementType* nextSkippingChildren(const Node*);
static ElementType* nextSkippingChildren(const Node*, const Node* stayWithin);
- static ElementType* nextSkippingChildren(const ContainerNode*);
- static ElementType* nextSkippingChildren(const ContainerNode*, const Node* stayWithin);
private:
template <typename CurrentType> static ElementType* firstChildTemplate(CurrentType*);
@@ -78,8 +76,6 @@
template <typename CurrentType> static ElementType* previousTemplate(CurrentType*, const Node* stayWithin);
template <typename CurrentType> static ElementType* nextSiblingTemplate(CurrentType*);
template <typename CurrentType> static ElementType* previousSiblingTemplate(CurrentType*);
- template <typename CurrentType> static ElementType* nextSkippingChildrenTemplate(CurrentType*);
- template <typename CurrentType> static ElementType* nextSkippingChildrenTemplate(CurrentType*, const Node* stayWithin);
};
class ElementTraversal : public Traversal<Element> {
@@ -254,8 +250,7 @@
}
template <typename ElementType>
-template <typename CurrentType>
-inline ElementType* Traversal<ElementType>::nextSkippingChildrenTemplate(CurrentType* current)
+inline ElementType* Traversal<ElementType>::nextSkippingChildren(const Node* current)
{
Node* node = NodeTraversal::nextSkippingChildren(current);
while (node && !isElementOfType<const ElementType>(*node))
@@ -264,8 +259,7 @@
}
template <typename ElementType>
-template <typename CurrentType>
-inline ElementType* Traversal<ElementType>::nextSkippingChildrenTemplate(CurrentType* current, const Node* stayWithin)
+inline ElementType* Traversal<ElementType>::nextSkippingChildren(const Node* current, const Node* stayWithin)
{
Node* node = NodeTraversal::nextSkippingChildren(current, stayWithin);
while (node && !isElementOfType<const ElementType>(*node))
@@ -321,15 +315,6 @@
template <typename ElementType>
inline ElementType* Traversal<ElementType>::previousSibling(const Node* current) { return previousSiblingTemplate(current); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::nextSkippingChildren(const ContainerNode* current) { return nextSkippingChildrenTemplate(current); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::nextSkippingChildren(const Node* current) { return nextSkippingChildrenTemplate(current); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::nextSkippingChildren(const ContainerNode* current, const Node* stayWithin) { return nextSkippingChildrenTemplate(current, stayWithin); }
-template <typename ElementType>
-inline ElementType* Traversal<ElementType>::nextSkippingChildren(const Node* current, const Node* stayWithin) { return nextSkippingChildrenTemplate(current, stayWithin); }
-
// FIXME: These should go somewhere else.
inline Element* ElementTraversal::previousIncludingPseudo(const Node* current, const Node* stayWithin)
{
Modified: trunk/Source/WebCore/dom/NodeTraversal.h (173606 => 173607)
--- trunk/Source/WebCore/dom/NodeTraversal.h 2014-09-14 21:18:27 UTC (rev 173606)
+++ trunk/Source/WebCore/dom/NodeTraversal.h 2014-09-14 22:19:19 UTC (rev 173607)
@@ -45,8 +45,6 @@
// Like next, but skips children and starts with the next sibling.
Node* nextSkippingChildren(const Node*);
Node* nextSkippingChildren(const Node*, const Node* stayWithin);
-Node* nextSkippingChildren(const ContainerNode*);
-Node* nextSkippingChildren(const ContainerNode*, const Node* stayWithin);
// Does a reverse pre-order traversal to find the node that comes before the current one in document order
Node* last(const ContainerNode*);
@@ -101,18 +99,14 @@
inline Node* next(const Node* current, const Node* stayWithin) { return traverseNextTemplate(current, stayWithin); }
inline Node* next(const ContainerNode* current, const Node* stayWithin) { return traverseNextTemplate(current, stayWithin); }
-template <class NodeType>
-inline Node* traverseNextSkippingChildrenTemplate(NodeType* current)
+inline Node* nextSkippingChildren(const Node* current)
{
if (current->nextSibling())
return current->nextSibling();
return nextAncestorSibling(current);
}
-inline Node* nextSkippingChildren(const Node* current) { return traverseNextSkippingChildrenTemplate(current); }
-inline Node* nextSkippingChildren(const ContainerNode* current) { return traverseNextSkippingChildrenTemplate(current); }
-template <class NodeType>
-inline Node* traverseNextSkippingChildrenTemplate(NodeType* current, const Node* stayWithin)
+inline Node* nextSkippingChildren(const Node* current, const Node* stayWithin)
{
if (current == stayWithin)
return 0;
@@ -120,11 +114,9 @@
return current->nextSibling();
return nextAncestorSibling(current, stayWithin);
}
-inline Node* nextSkippingChildren(const Node* current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
-inline Node* nextSkippingChildren(const ContainerNode* current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
-inline Node* next(const Text* current) { return traverseNextSkippingChildrenTemplate(current); }
-inline Node* next(const Text* current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
+inline Node* next(const Text* current) { return nextSkippingChildren(current); }
+inline Node* next(const Text* current, const Node* stayWithin) { return nextSkippingChildren(current, stayWithin); }
inline Node* previous(const Node* current, const Node* stayWithin)
{