Move ElementTraversal to ElementTraversal.h
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Aug 2013 11:21:29 +0000 (11:21 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Aug 2013 11:21:29 +0000 (11:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119678

Rubber-stamped by Andreas Kling.

Move ElementTraversal namespace from NodeTraversal.h to a correctly named file.

* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AccessibilityRenderObject.cpp:
* css/StyleInvalidationAnalysis.cpp:
* dom/Document.cpp:
* dom/DocumentOrderedMap.cpp:
* dom/Element.cpp:
* dom/ElementTraversal.h: Added.
(WebCore::ElementTraversal::firstElementWithinTemplate):
(WebCore::ElementTraversal::firstWithin):
(WebCore::ElementTraversal::traverseNextElementTemplate):
(WebCore::ElementTraversal::next):
(WebCore::ElementTraversal::traverseNextElementSkippingChildrenTemplate):
(WebCore::ElementTraversal::nextSkippingChildren):
(WebCore::ElementTraversal::previousIncludingPseudo):
(WebCore::ElementTraversal::nextIncludingPseudo):
(WebCore::ElementTraversal::nextIncludingPseudoSkippingChildren):
(WebCore::ElementTraversal::pseudoAwarePreviousSibling):
* dom/Node.cpp:
* dom/NodeTraversal.h:
* dom/SelectorQuery.cpp:
* dom/TreeScope.cpp:
* dom/VisitedLinkState.cpp:
* editing/FrameSelection.cpp:
* editing/markup.cpp:
* html/HTMLCollection.cpp:
* html/HTMLFieldSetElement.cpp:
* html/HTMLFormElement.cpp:
* html/HTMLLabelElement.cpp:
* html/HTMLLegendElement.cpp:
* html/HTMLMapElement.cpp:
* html/HTMLObjectElement.cpp:
* html/HTMLSelectElement.cpp:
* html/shadow/ContentDistributor.cpp:
* page/FocusController.cpp:
* rendering/RenderCounter.cpp:
* rendering/RenderListItem.cpp:
* svg/SVGSVGElement.cpp:
* svg/SVGStyledElement.cpp:
* svg/SVGUseElement.cpp:
* svg/animation/SMILTimeContainer.cpp:
* svg/graphics/SVGImage.cpp:

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

35 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/css/StyleInvalidationAnalysis.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/DocumentOrderedMap.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/ElementTraversal.h [new file with mode: 0644]
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/NodeTraversal.h
Source/WebCore/dom/SelectorQuery.cpp
Source/WebCore/dom/TreeScope.cpp
Source/WebCore/dom/VisitedLinkState.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/html/HTMLCollection.cpp
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLLabelElement.cpp
Source/WebCore/html/HTMLLegendElement.cpp
Source/WebCore/html/HTMLMapElement.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/shadow/ContentDistributor.cpp
Source/WebCore/page/FocusController.cpp
Source/WebCore/rendering/RenderCounter.cpp
Source/WebCore/rendering/RenderListItem.cpp
Source/WebCore/svg/SVGSVGElement.cpp
Source/WebCore/svg/SVGStyledElement.cpp
Source/WebCore/svg/SVGUseElement.cpp
Source/WebCore/svg/animation/SMILTimeContainer.cpp
Source/WebCore/svg/graphics/SVGImage.cpp

index 7f3a98e..4752e3e 100644 (file)
@@ -1,5 +1,59 @@
 2013-08-12  Antti Koivisto  <antti@apple.com>
 
+        Move ElementTraversal to ElementTraversal.h
+        https://bugs.webkit.org/show_bug.cgi?id=119678
+
+        Rubber-stamped by Andreas Kling.
+
+        Move ElementTraversal namespace from NodeTraversal.h to a correctly named file.
+
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * accessibility/AccessibilityRenderObject.cpp:
+        * css/StyleInvalidationAnalysis.cpp:
+        * dom/Document.cpp:
+        * dom/DocumentOrderedMap.cpp:
+        * dom/Element.cpp:
+        * dom/ElementTraversal.h: Added.
+        (WebCore::ElementTraversal::firstElementWithinTemplate):
+        (WebCore::ElementTraversal::firstWithin):
+        (WebCore::ElementTraversal::traverseNextElementTemplate):
+        (WebCore::ElementTraversal::next):
+        (WebCore::ElementTraversal::traverseNextElementSkippingChildrenTemplate):
+        (WebCore::ElementTraversal::nextSkippingChildren):
+        (WebCore::ElementTraversal::previousIncludingPseudo):
+        (WebCore::ElementTraversal::nextIncludingPseudo):
+        (WebCore::ElementTraversal::nextIncludingPseudoSkippingChildren):
+        (WebCore::ElementTraversal::pseudoAwarePreviousSibling):
+        * dom/Node.cpp:
+        * dom/NodeTraversal.h:
+        * dom/SelectorQuery.cpp:
+        * dom/TreeScope.cpp:
+        * dom/VisitedLinkState.cpp:
+        * editing/FrameSelection.cpp:
+        * editing/markup.cpp:
+        * html/HTMLCollection.cpp:
+        * html/HTMLFieldSetElement.cpp:
+        * html/HTMLFormElement.cpp:
+        * html/HTMLLabelElement.cpp:
+        * html/HTMLLegendElement.cpp:
+        * html/HTMLMapElement.cpp:
+        * html/HTMLObjectElement.cpp:
+        * html/HTMLSelectElement.cpp:
+        * html/shadow/ContentDistributor.cpp:
+        * page/FocusController.cpp:
+        * rendering/RenderCounter.cpp:
+        * rendering/RenderListItem.cpp:
+        * svg/SVGSVGElement.cpp:
+        * svg/SVGStyledElement.cpp:
+        * svg/SVGUseElement.cpp:
+        * svg/animation/SMILTimeContainer.cpp:
+        * svg/graphics/SVGImage.cpp:
+
+2013-08-12  Antti Koivisto  <antti@apple.com>
+
         Move some Document recalcStyle code to StyleResolveTree
         https://bugs.webkit.org/show_bug.cgi?id=119676
 
index e9c124d..fc7a632 100644 (file)
@@ -2907,6 +2907,7 @@ webcore_sources += \
        Source/WebCore/dom/ElementRareData.h \
        Source/WebCore/dom/ElementShadow.cpp \
        Source/WebCore/dom/ElementShadow.h \
+       Source/WebCore/dom/ElementTraversal.h \
        Source/WebCore/dom/Entity.h \
        Source/WebCore/dom/EntityReference.cpp \
        Source/WebCore/dom/EntityReference.h \
index 6a5cba5..ad01a51 100644 (file)
@@ -1609,6 +1609,7 @@ HEADERS += \
     dom/DatasetDOMStringMap.h \
     dom/Element.h \
     dom/ElementShadow.h \
+    dom/ElementTravesal.h \
     dom/Entity.h \
     dom/EntityReference.h \
     dom/Event.h \
index 0e777ac..5a488b0 100644 (file)
     <ClInclude Include="..\dom\DOMStringMap.h" />
     <ClInclude Include="..\dom\DOMTimeStamp.h" />
     <ClInclude Include="..\dom\Element.h" />
+    <ClInclude Include="..\dom\ElementTraversal.h" />
     <ClInclude Include="..\dom\Entity.h" />
     <ClInclude Include="..\dom\EntityReference.h" />
     <ClInclude Include="..\dom\ErrorEvent.h" />
index e5a339b..e7c4463 100644 (file)
                E4D58EB517B4DBDC00CBDCA8 /* StyleResolveForDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */; };
                E4D58EB817B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */; };
                E4D58EB917B4ED8900CBDCA8 /* StyleFontSizeFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EB717B4ED8900CBDCA8 /* StyleFontSizeFunctions.h */; };
+               E4D58EBB17B8F12800CBDCA8 /* ElementTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */; };
                E4D687770ED7AE3D006EA978 /* PurgeableBufferMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */; };
                E4D687790ED7AE4F006EA978 /* PurgeableBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */; };
                E4DEAA1717A93DC3000E0430 /* StyleResolveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4DEAA1517A93DC3000E0430 /* StyleResolveTree.cpp */; };
                E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleResolveForDocument.h; sourceTree = "<group>"; };
                E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleFontSizeFunctions.cpp; sourceTree = "<group>"; };
                E4D58EB717B4ED8900CBDCA8 /* StyleFontSizeFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleFontSizeFunctions.h; sourceTree = "<group>"; };
+               E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementTraversal.h; sourceTree = "<group>"; };
                E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PurgeableBufferMac.cpp; sourceTree = "<group>"; };
                E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgeableBuffer.h; sourceTree = "<group>"; };
                E4DEAA1517A93DC3000E0430 /* StyleResolveTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleResolveTree.cpp; sourceTree = "<group>"; };
                                637B7ADE0E8767B800E32194 /* ElementRareData.h */,
                                57CF4C8414F7597A00ECFF14 /* ElementShadow.cpp */,
                                57CF4C8514F7597A00ECFF14 /* ElementShadow.h */,
+                               E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */,
                                A8EA7EBA0A1945D000A8EF5F /* Entity.h */,
                                93EEC1EB09C2877700C515D1 /* Entity.idl */,
                                A8EA7EB90A1945D000A8EF5F /* EntityReference.cpp */,
                                656D373C0ADBA5DE00A4554D /* FrameLoader.h in Headers */,
                                656D373E0ADBA5DE00A4554D /* FrameLoaderClient.h in Headers */,
                                D000EBA311BDAFD400C47726 /* FrameLoaderStateMachine.h in Headers */,
+                               E4D58EBB17B8F12800CBDCA8 /* ElementTraversal.h in Headers */,
                                93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */,
                                658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */,
                                628D214E12131EF40055DCFC /* FrameNetworkingContext.h in Headers */,
index ebbc190..3ebcee5 100644 (file)
@@ -37,6 +37,7 @@
 #include "AccessibilityTable.h"
 #include "CachedImage.h"
 #include "Chrome.h"
+#include "ElementTraversal.h"
 #include "EventNames.h"
 #include "FloatRect.h"
 #include "Frame.h"
@@ -62,7 +63,6 @@
 #include "LocalizedStrings.h"
 #include "MathMLNames.h"
 #include "NodeList.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "ProgressTracker.h"
 #include "RenderButton.h"
index a4b9860..5a4e3d6 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "CSSSelectorList.h"
 #include "Document.h"
-#include "NodeTraversal.h"
+#include "ElementTraversal.h"
 #include "StyleRuleImport.h"
 #include "StyleSheetContents.h"
 #include "StyledElement.h"
index 03c3609..4c94eb2 100644 (file)
@@ -60,6 +60,7 @@
 #include "Editor.h"
 #include "Element.h"
 #include "ElementShadow.h"
+#include "ElementTraversal.h"
 #include "EntityReference.h"
 #include "Event.h"
 #include "EventFactory.h"
 #include "NodeFilter.h"
 #include "NodeIterator.h"
 #include "NodeRareData.h"
-#include "NodeTraversal.h"
 #include "NodeWithIndex.h"
 #include "Page.h"
 #include "PageConsole.h"
index 783c99b..a9f460a 100644 (file)
 #include "DocumentOrderedMap.h"
 
 #include "Element.h"
+#include "ElementTraversal.h"
 #include "HTMLLabelElement.h"
 #include "HTMLMapElement.h"
 #include "HTMLNameCollection.h"
 #include "HTMLNames.h"
-#include "NodeTraversal.h"
 #include "TreeScope.h"
 
 namespace WebCore {
index fad4965..1b5ca35 100644 (file)
@@ -42,6 +42,7 @@
 #include "DocumentFragment.h"
 #include "DocumentSharedObjectPool.h"
 #include "ElementRareData.h"
+#include "ElementTraversal.h"
 #include "EventDispatcher.h"
 #include "ExceptionCode.h"
 #include "FlowThreadController.h"
@@ -69,7 +70,6 @@
 #include "NodeList.h"
 #include "NodeRenderStyle.h"
 #include "NodeRenderingContext.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "PointerLockController.h"
 #include "PseudoElement.h"
diff --git a/Source/WebCore/dom/ElementTraversal.h b/Source/WebCore/dom/ElementTraversal.h
new file mode 100644 (file)
index 0000000..4b9cf07
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ElementTraversal_h
+#define ElementTraversal_h
+
+#include "Element.h"
+#include "NodeTraversal.h"
+
+namespace WebCore {
+namespace ElementTraversal {
+
+// First element child of the node.
+Element* firstWithin(const Node*);
+Element* firstWithin(const ContainerNode*);
+
+// Pre-order traversal skipping non-element nodes.
+Element* next(const Node*);
+Element* next(const Node*, const Node* stayWithin);
+Element* next(const ContainerNode*);
+Element* next(const ContainerNode*, const Node* stayWithin);
+
+// Like next, but skips children.
+Element* nextSkippingChildren(const Node*);
+Element* nextSkippingChildren(const Node*, const Node* stayWithin);
+Element* nextSkippingChildren(const ContainerNode*);
+Element* nextSkippingChildren(const ContainerNode*, const Node* stayWithin);
+
+// Pre-order traversal including the pseudo-elements.
+Element* previousIncludingPseudo(const Node*, const Node* = 0);
+Element* nextIncludingPseudo(const Node*, const Node* = 0);
+Element* nextIncludingPseudoSkippingChildren(const Node*, const Node* = 0);
+
+// Utility function to traverse only the element and pseudo-element siblings of a node.
+Element* pseudoAwarePreviousSibling(const Node*);
+
+}
+
+namespace ElementTraversal {
+template <class NodeType>
+inline Element* firstElementWithinTemplate(NodeType* current)
+{
+    // Except for the root containers, only elements can have element children.
+    Node* node = current->firstChild();
+    while (node && !node->isElementNode())
+        node = node->nextSibling();
+    return toElement(node);
+}
+inline Element* firstWithin(const ContainerNode* current) { return firstElementWithinTemplate(current); }
+inline Element* firstWithin(const Node* current) { return firstElementWithinTemplate(current); }
+
+template <class NodeType>
+inline Element* traverseNextElementTemplate(NodeType* current)
+{
+    Node* node = NodeTraversal::next(current);
+    while (node && !node->isElementNode())
+        node = NodeTraversal::nextSkippingChildren(node);
+    return toElement(node);
+}
+inline Element* next(const ContainerNode* current) { return traverseNextElementTemplate(current); }
+inline Element* next(const Node* current) { return traverseNextElementTemplate(current); }
+
+template <class NodeType>
+inline Element* traverseNextElementTemplate(NodeType* current, const Node* stayWithin)
+{
+    Node* node = NodeTraversal::next(current, stayWithin);
+    while (node && !node->isElementNode())
+        node = NodeTraversal::nextSkippingChildren(node, stayWithin);
+    return toElement(node);
+}
+inline Element* next(const ContainerNode* current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
+inline Element* next(const Node* current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
+
+template <class NodeType>
+inline Element* traverseNextElementSkippingChildrenTemplate(NodeType* current)
+{
+    Node* node = NodeTraversal::nextSkippingChildren(current);
+    while (node && !node->isElementNode())
+        node = NodeTraversal::nextSkippingChildren(node);
+    return toElement(node);
+}
+inline Element* nextSkippingChildren(const ContainerNode* current) { return traverseNextElementSkippingChildrenTemplate(current); }
+inline Element* nextSkippingChildren(const Node* current) { return traverseNextElementSkippingChildrenTemplate(current); }
+
+template <class NodeType>
+inline Element* traverseNextElementSkippingChildrenTemplate(NodeType* current, const Node* stayWithin)
+{
+    Node* node = NodeTraversal::nextSkippingChildren(current, stayWithin);
+    while (node && !node->isElementNode())
+        node = NodeTraversal::nextSkippingChildren(node, stayWithin);
+    return toElement(node);
+}
+inline Element* nextSkippingChildren(const ContainerNode* current, const Node* stayWithin) { return traverseNextElementSkippingChildrenTemplate(current, stayWithin); }
+inline Element* nextSkippingChildren(const Node* current, const Node* stayWithin) { return traverseNextElementSkippingChildrenTemplate(current, stayWithin); }
+
+inline Element* previousIncludingPseudo(const Node* current, const Node* stayWithin)
+{
+    Node* node = NodeTraversal::previousIncludingPseudo(current, stayWithin);
+    while (node && !node->isElementNode())
+        node = NodeTraversal::previousIncludingPseudo(node, stayWithin);
+    return toElement(node);
+}
+
+inline Element* nextIncludingPseudo(const Node* current, const Node* stayWithin)
+{
+    Node* node = NodeTraversal::nextIncludingPseudo(current, stayWithin);
+    while (node && !node->isElementNode())
+        node = NodeTraversal::nextIncludingPseudo(node, stayWithin);
+    return toElement(node);
+}
+
+inline Element* nextIncludingPseudoSkippingChildren(const Node* current, const Node* stayWithin)
+{
+    Node* node = NodeTraversal::nextIncludingPseudoSkippingChildren(current, stayWithin);
+    while (node && !node->isElementNode())
+        node = NodeTraversal::nextIncludingPseudoSkippingChildren(node, stayWithin);
+    return toElement(node);
+}
+
+inline Element* pseudoAwarePreviousSibling(const Node* current)
+{
+    Node* node = current->pseudoAwarePreviousSibling();
+    while (node && !node->isElementNode())
+        node = node->pseudoAwarePreviousSibling();
+    return toElement(node);
+}
+
+}
+}
+
+#endif
index 8f91afa..98dda03 100644 (file)
@@ -50,6 +50,7 @@
 #include "Element.h"
 #include "ElementRareData.h"
 #include "ElementShadow.h"
+#include "ElementTraversal.h"
 #include "Event.h"
 #include "EventContext.h"
 #include "EventDispatchMediator.h"
@@ -80,7 +81,6 @@
 #include "NamedNodeMap.h"
 #include "NodeRareData.h"
 #include "NodeRenderingContext.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "PlatformMouseEvent.h"
 #include "PlatformWheelEvent.h"
index 2ad4922..1a4bea1 100644 (file)
 #ifndef NodeTraversal_h
 #define NodeTraversal_h
 
-#include "Element.h"
+#include "Node.h"
 
 namespace WebCore {
-
-namespace ElementTraversal {
-
-// First element child of the node.
-Element* firstWithin(const Node*);
-Element* firstWithin(const ContainerNode*);
-
-// Pre-order traversal skipping non-element nodes.
-Element* next(const Node*);
-Element* next(const Node*, const Node* stayWithin);
-Element* next(const ContainerNode*);
-Element* next(const ContainerNode*, const Node* stayWithin);
-
-// Like next, but skips children.
-Element* nextSkippingChildren(const Node*);
-Element* nextSkippingChildren(const Node*, const Node* stayWithin);
-Element* nextSkippingChildren(const ContainerNode*);
-Element* nextSkippingChildren(const ContainerNode*, const Node* stayWithin);
-
-// Pre-order traversal including the pseudo-elements.
-Element* previousIncludingPseudo(const Node*, const Node* = 0);
-Element* nextIncludingPseudo(const Node*, const Node* = 0);
-Element* nextIncludingPseudoSkippingChildren(const Node*, const Node* = 0);
-
-// Utility function to traverse only the element and pseudo-element siblings of a node.
-Element* pseudoAwarePreviousSibling(const Node*);
-
-}
-
 namespace NodeTraversal {
 
 // Does a pre-order traversal of the tree to find the next node after this one.
@@ -94,97 +65,6 @@ Node* nextIncludingPseudoSkippingChildren(const Node*, const Node* = 0);
 
 }
 
-namespace ElementTraversal {
-template <class NodeType>
-inline Element* firstElementWithinTemplate(NodeType* current)
-{
-    // Except for the root containers, only elements can have element children.
-    Node* node = current->firstChild();
-    while (node && !node->isElementNode())
-        node = node->nextSibling();
-    return toElement(node);
-}
-inline Element* firstWithin(const ContainerNode* current) { return firstElementWithinTemplate(current); }
-inline Element* firstWithin(const Node* current) { return firstElementWithinTemplate(current); }
-
-template <class NodeType>
-inline Element* traverseNextElementTemplate(NodeType* current)
-{
-    Node* node = NodeTraversal::next(current);
-    while (node && !node->isElementNode())
-        node = NodeTraversal::nextSkippingChildren(node);
-    return toElement(node);
-}
-inline Element* next(const ContainerNode* current) { return traverseNextElementTemplate(current); }
-inline Element* next(const Node* current) { return traverseNextElementTemplate(current); }
-
-template <class NodeType>
-inline Element* traverseNextElementTemplate(NodeType* current, const Node* stayWithin)
-{
-    Node* node = NodeTraversal::next(current, stayWithin);
-    while (node && !node->isElementNode())
-        node = NodeTraversal::nextSkippingChildren(node, stayWithin);
-    return toElement(node);
-}
-inline Element* next(const ContainerNode* current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
-inline Element* next(const Node* current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
-
-template <class NodeType>
-inline Element* traverseNextElementSkippingChildrenTemplate(NodeType* current)
-{
-    Node* node = NodeTraversal::nextSkippingChildren(current);
-    while (node && !node->isElementNode())
-        node = NodeTraversal::nextSkippingChildren(node);
-    return toElement(node);
-}
-inline Element* nextSkippingChildren(const ContainerNode* current) { return traverseNextElementSkippingChildrenTemplate(current); }
-inline Element* nextSkippingChildren(const Node* current) { return traverseNextElementSkippingChildrenTemplate(current); }
-
-template <class NodeType>
-inline Element* traverseNextElementSkippingChildrenTemplate(NodeType* current, const Node* stayWithin)
-{
-    Node* node = NodeTraversal::nextSkippingChildren(current, stayWithin);
-    while (node && !node->isElementNode())
-        node = NodeTraversal::nextSkippingChildren(node, stayWithin);
-    return toElement(node);
-}
-inline Element* nextSkippingChildren(const ContainerNode* current, const Node* stayWithin) { return traverseNextElementSkippingChildrenTemplate(current, stayWithin); }
-inline Element* nextSkippingChildren(const Node* current, const Node* stayWithin) { return traverseNextElementSkippingChildrenTemplate(current, stayWithin); }
-
-inline Element* previousIncludingPseudo(const Node* current, const Node* stayWithin)
-{
-    Node* node = NodeTraversal::previousIncludingPseudo(current, stayWithin);
-    while (node && !node->isElementNode())
-        node = NodeTraversal::previousIncludingPseudo(node, stayWithin);
-    return toElement(node);
-}
-
-inline Element* nextIncludingPseudo(const Node* current, const Node* stayWithin)
-{
-    Node* node = NodeTraversal::nextIncludingPseudo(current, stayWithin);
-    while (node && !node->isElementNode())
-        node = NodeTraversal::nextIncludingPseudo(node, stayWithin);
-    return toElement(node);
-}
-
-inline Element* nextIncludingPseudoSkippingChildren(const Node* current, const Node* stayWithin)
-{
-    Node* node = NodeTraversal::nextIncludingPseudoSkippingChildren(current, stayWithin);
-    while (node && !node->isElementNode())
-        node = NodeTraversal::nextIncludingPseudoSkippingChildren(node, stayWithin);
-    return toElement(node);
-}
-
-inline Element* pseudoAwarePreviousSibling(const Node* current)
-{
-    Node* node = current->pseudoAwarePreviousSibling();
-    while (node && !node->isElementNode())
-        node = node->pseudoAwarePreviousSibling();
-    return toElement(node);
-}
-
-}
-
 namespace NodeTraversal {
 
 Node* nextAncestorSibling(const Node*);
@@ -239,7 +119,6 @@ inline Node* nextSkippingChildren(const Node* current, const Node* stayWithin) {
 inline Node* nextSkippingChildren(const ContainerNode* current, const Node* stayWithin) { return traverseNextSkippingChildrenTemplate(current, stayWithin); }
 
 }
-
 }
 
 #endif
index cc1f4e6..76cf7db 100644 (file)
@@ -29,7 +29,7 @@
 #include "CSSParser.h"
 #include "CSSSelectorList.h"
 #include "Document.h"
-#include "NodeTraversal.h"
+#include "ElementTraversal.h"
 #include "SelectorChecker.h"
 #include "SelectorCheckerFastPath.h"
 #include "StaticNodeList.h"
index ef07381..3892254 100644 (file)
@@ -32,6 +32,7 @@
 #include "DOMWindow.h"
 #include "Document.h"
 #include "Element.h"
+#include "ElementTraversal.h"
 #include "FocusController.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -42,7 +43,6 @@
 #include "HTMLNames.h"
 #include "HitTestResult.h"
 #include "IdTargetObserverRegistry.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "RenderView.h"
 #include "RuntimeEnabledFeatures.h"
index 4865df4..7d4792c 100644 (file)
 #include "config.h"
 #include "VisitedLinkState.h"
 
+#include "ElementTraversal.h"
 #include "Frame.h"
 #include "HTMLAnchorElement.h"
 #include "HTMLNames.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "PageGroup.h"
 #include "PlatformStrategies.h"
index 19b296b..012bff1 100644 (file)
@@ -32,6 +32,7 @@
 #include "Editor.h"
 #include "EditorClient.h"
 #include "Element.h"
+#include "ElementTraversal.h"
 #include "EventHandler.h"
 #include "ExceptionCode.h"
 #include "FloatQuad.h"
@@ -48,7 +49,6 @@
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
 #include "InlineTextBox.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "Range.h"
 #include "RenderText.h"
index 8d1ab3d..f5004e4 100644 (file)
@@ -41,6 +41,7 @@
 #endif
 #include "DocumentFragment.h"
 #include "Editor.h"
+#include "ElementTraversal.h"
 #include "ExceptionCode.h"
 #include "ExceptionCodePlaceholder.h"
 #include "Frame.h"
@@ -52,7 +53,6 @@
 #include "HTMLTextFormControlElement.h"
 #include "KURL.h"
 #include "MarkupAccumulator.h"
-#include "NodeTraversal.h"
 #include "Range.h"
 #include "RenderBlock.h"
 #include "RenderObject.h"
index ee4c193..899b057 100644 (file)
@@ -24,6 +24,7 @@
 #include "HTMLCollection.h"
 
 #include "ClassNodeList.h"
+#include "ElementTraversal.h"
 #include "HTMLDocument.h"
 #include "HTMLElement.h"
 #include "HTMLNameCollection.h"
@@ -32,7 +33,6 @@
 #include "HTMLOptionElement.h"
 #include "NodeList.h"
 #include "NodeRareData.h"
-#include "NodeTraversal.h"
 
 namespace WebCore {
 
index 717905f..ad132db 100644 (file)
 #include "config.h"
 #include "HTMLFieldSetElement.h"
 
+#include "ElementTraversal.h"
 #include "HTMLCollection.h"
 #include "HTMLLegendElement.h"
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
-#include "NodeTraversal.h"
 #include "RenderFieldset.h"
 #include <wtf/StdLibExtras.h>
 
index 763493b..f26ca38 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "Attribute.h"
 #include "Document.h"
+#include "ElementTraversal.h"
 #include "Event.h"
 #include "EventNames.h"
 #include "FormController.h"
@@ -41,7 +42,6 @@
 #include "HTMLNames.h"
 #include "HTMLTableElement.h"
 #include "NodeRenderingContext.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "RenderTextControl.h"
 #include "ScriptController.h"
index 34b9d32..2769666 100644 (file)
 #include "HTMLLabelElement.h"
 
 #include "Document.h"
+#include "ElementTraversal.h"
 #include "Event.h"
 #include "EventNames.h"
 #include "FormAssociatedElement.h"
 #include "HTMLNames.h"
-#include "NodeTraversal.h"
 
 namespace WebCore {
 
index a4e1d44..03b14e7 100644 (file)
 #include "config.h"
 #include "HTMLLegendElement.h"
 
+#include "ElementTraversal.h"
 #include "HTMLFieldSetElement.h"
 #include "HTMLFormControlElement.h"
 #include "HTMLNames.h"
-#include "NodeTraversal.h"
 
 namespace WebCore {
 
index 66fd73e..59befb9 100644 (file)
 
 #include "Attribute.h"
 #include "Document.h"
+#include "ElementTraversal.h"
 #include "HTMLAreaElement.h"
 #include "HTMLCollection.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
 #include "HitTestResult.h"
 #include "IntSize.h"
-#include "NodeTraversal.h"
 #include "RenderObject.h"
 
 using namespace std;
index 819e705..d6c30a3 100644 (file)
@@ -29,6 +29,7 @@
 #include "CachedImage.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
+#include "ElementTraversal.h"
 #include "EventNames.h"
 #include "ExceptionCode.h"
 #include "FormDataList.h"
@@ -42,7 +43,6 @@
 #include "HTMLParserIdioms.h"
 #include "MIMETypeRegistry.h"
 #include "NodeList.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "PluginViewBase.h"
 #include "RenderEmbeddedObject.h"
index 9bd7eab..a78e8e8 100644 (file)
@@ -32,6 +32,7 @@
 #include "Attribute.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
+#include "ElementTraversal.h"
 #include "EventHandler.h"
 #include "EventNames.h"
 #include "ExceptionCodePlaceholder.h"
@@ -47,7 +48,6 @@
 #include "LocalizedStrings.h"
 #include "MouseEvent.h"
 #include "NodeRenderingContext.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "PlatformMouseEvent.h"
 #include "RenderListBox.h"
index e226f2c..5546272 100644 (file)
@@ -28,8 +28,8 @@
 #include "ContentDistributor.h"
 
 #include "ElementShadow.h"
+#include "ElementTraversal.h"
 #include "HTMLContentElement.h"
-#include "NodeTraversal.h"
 #include "ShadowRoot.h"
 
 
index cef2195..27e3858 100644 (file)
@@ -34,6 +34,7 @@
 #include "EditorClient.h"
 #include "Element.h"
 #include "ElementShadow.h"
+#include "ElementTraversal.h"
 #include "Event.h"
 #include "EventHandler.h"
 #include "EventNames.h"
@@ -50,7 +51,6 @@
 #include "HitTestResult.h"
 #include "KeyboardEvent.h"
 #include "NodeRenderingTraversal.h"
-#include "NodeTraversal.h"
 #include "Page.h"
 #include "Range.h"
 #include "RenderObject.h"
index d72199e..ca059e6 100644 (file)
@@ -25,9 +25,9 @@
 #include "CounterNode.h"
 #include "Document.h"
 #include "Element.h"
+#include "ElementTraversal.h"
 #include "HTMLNames.h"
 #include "HTMLOListElement.h"
-#include "NodeTraversal.h"
 #include "RenderListItem.h"
 #include "RenderListMarker.h"
 #include "RenderStyle.h"
index 7d8f4c8..bbab226 100644 (file)
@@ -24,9 +24,9 @@
 #include "config.h"
 #include "RenderListItem.h"
 
+#include "ElementTraversal.h"
 #include "HTMLNames.h"
 #include "HTMLOListElement.h"
-#include "NodeTraversal.h"
 #include "RenderListMarker.h"
 #include "RenderView.h"
 #include "StyleInheritedData.h"
index 9e3383f..e185453 100644 (file)
@@ -28,6 +28,7 @@
 #include "Attribute.h"
 #include "CSSHelper.h"
 #include "Document.h"
+#include "ElementTraversal.h"
 #include "EventListener.h"
 #include "EventNames.h"
 #include "FloatConversion.h"
@@ -37,7 +38,6 @@
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "HTMLNames.h"
-#include "NodeTraversal.h"
 #include "RenderObject.h"
 #include "RenderPart.h"
 #include "RenderSVGResource.h"
index fd80363..000ac94 100644 (file)
@@ -26,9 +26,9 @@
 #include "Attr.h"
 #include "CSSParser.h"
 #include "Document.h"
+#include "ElementTraversal.h"
 #include "EventNames.h"
 #include "HTMLNames.h"
-#include "NodeTraversal.h"
 #include "RenderObject.h"
 #include "RenderSVGResource.h"
 #include "RenderSVGResourceClipper.h"
index 315953b..b6fd0d2 100644 (file)
 #include "CachedSVGDocument.h"
 #include "Document.h"
 #include "ElementShadow.h"
+#include "ElementTraversal.h"
 #include "Event.h"
 #include "EventListener.h"
 #include "HTMLNames.h"
 #include "NodeRenderStyle.h"
-#include "NodeTraversal.h"
 #include "RegisteredEventListener.h"
 #include "RenderSVGResource.h"
 #include "RenderSVGTransformableContainer.h"
index 0cdd5c8..e63bd48 100644 (file)
@@ -28,7 +28,7 @@
 
 #if ENABLE(SVG)
 #include "Document.h"
-#include "NodeTraversal.h"
+#include "ElementTraversal.h"
 #include "SVGNames.h"
 #include "SVGSMILElement.h"
 #include "SVGSVGElement.h"
index 98aa2dc..eb8dccd 100644 (file)
 
 #include "Chrome.h"
 #include "DocumentLoader.h"
+#include "ElementTraversal.h"
 #include "FrameView.h"
 #include "ImageBuffer.h"
 #include "ImageObserver.h"
 #include "IntRect.h"
-#include "NodeTraversal.h"
 #include "RenderSVGRoot.h"
 #include "RenderStyle.h"
 #include "SVGDocument.h"