Diff
Modified: trunk/Source/WebCore/ChangeLog (165804 => 165805)
--- trunk/Source/WebCore/ChangeLog 2014-03-18 08:51:55 UTC (rev 165804)
+++ trunk/Source/WebCore/ChangeLog 2014-03-18 09:42:58 UTC (rev 165805)
@@ -1,3 +1,35 @@
+2014-03-18 Andreas Kling <[email protected]>
+
+ Rename ElementDescendantIterator to TypedElementDescendantIterator.
+ Romper-stubbed by Antti "Latte Lung" Koivisto.
+
+ * GNUmakefile.list.am:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/ElementDescendantIterator.h: Removed.
+ * dom/ElementIterator.h:
+ * dom/TypedElementDescendantIterator.h: Added.
+ (WebCore::TypedElementDescendantIterator<ElementType>::TypedElementDescendantIterator):
+ (WebCore::TypedElementDescendantIterator<ElementType>::operator):
+ (WebCore::TypedElementDescendantConstIterator<ElementType>::TypedElementDescendantConstIterator):
+ (WebCore::TypedElementDescendantConstIterator<ElementType>::operator):
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::TypedElementDescendantIteratorAdapter):
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::begin):
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::end):
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::beginAt):
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::from):
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::first):
+ (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::last):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::TypedElementDescendantConstIteratorAdapter):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::begin):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::end):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::beginAt):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::from):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::first):
+ (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::last):
+ (WebCore::descendantsOfType):
+
2014-03-18 Ion Rosca <[email protected]>
Add blend mode property to dumped information in GraphicsLayer.
Modified: trunk/Source/WebCore/GNUmakefile.list.am (165804 => 165805)
--- trunk/Source/WebCore/GNUmakefile.list.am 2014-03-18 08:51:55 UTC (rev 165804)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2014-03-18 09:42:58 UTC (rev 165805)
@@ -2848,7 +2848,6 @@
Source/WebCore/dom/ElementChildIterator.h \
Source/WebCore/dom/ElementData.cpp \
Source/WebCore/dom/ElementData.h \
- Source/WebCore/dom/ElementDescendantIterator.h \
Source/WebCore/dom/ElementIterator.h \
Source/WebCore/dom/ElementIteratorAssertions.h \
Source/WebCore/dom/ElementRareData.cpp \
@@ -3037,6 +3036,7 @@
Source/WebCore/dom/TreeScopeAdopter.h \
Source/WebCore/dom/TreeWalker.cpp \
Source/WebCore/dom/TreeWalker.h \
+ Source/WebCore/dom/TypedElementDescendantIterator.h \
Source/WebCore/dom/UIEvent.cpp \
Source/WebCore/dom/UIEvent.h \
Source/WebCore/dom/UIEventWithKeyState.cpp \
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (165804 => 165805)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-03-18 08:51:55 UTC (rev 165804)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-03-18 09:42:58 UTC (rev 165805)
@@ -20021,7 +20021,7 @@
<ClInclude Include="..\dom\ElementAncestorIterator.h" />
<ClInclude Include="..\dom\ElementChildIterator.h" />
<ClInclude Include="..\dom\ElementData.h" />
- <ClInclude Include="..\dom\ElementDescendantIterator.h" />
+ <ClInclude Include="..\dom\TypedElementDescendantIterator.h" />
<ClInclude Include="..\dom\ElementIterator.h" />
<ClInclude Include="..\dom\ElementIteratorAssertions.h" />
<ClInclude Include="..\dom\ElementTraversal.h" />
@@ -20885,4 +20885,4 @@
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (165804 => 165805)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2014-03-18 08:51:55 UTC (rev 165804)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2014-03-18 09:42:58 UTC (rev 165805)
@@ -14493,7 +14493,7 @@
<ClInclude Include="..\dom\ElementData.h">
<Filter>dom</Filter>
</ClInclude>
- <ClInclude Include="..\dom\ElementDescendantIterator.h">
+ <ClInclude Include="..\dom\TypedElementDescendantIterator.h">
<Filter>dom</Filter>
</ClInclude>
<ClInclude Include="..\dom\ElementIterator.h">
@@ -15014,4 +15014,4 @@
<Filter>platform\win</Filter>
</MASM>
</ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (165804 => 165805)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-03-18 08:51:55 UTC (rev 165804)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-03-18 09:42:58 UTC (rev 165805)
@@ -6006,7 +6006,7 @@
E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; };
E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */ = {isa = PBXBuildFile; fileRef = E462A4A0113E71BE004A4220 /* IntPointHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
- E46A2B1C17CA65B9000DBCD8 /* ElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* ElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
E47127CA163438A100ED6F5A /* StyleInvalidationAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */; };
E47127CB163438AE00ED6F5A /* StyleInvalidationAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */; };
@@ -13357,7 +13357,7 @@
E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WidgetIOS.mm; path = ios/WidgetIOS.mm; sourceTree = "<group>"; };
E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemMemoryIOS.cpp; path = ios/SystemMemoryIOS.cpp; sourceTree = "<group>"; };
E462A4A0113E71BE004A4220 /* IntPointHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntPointHash.h; sourceTree = "<group>"; };
- E46A2B1B17CA65B9000DBCD8 /* ElementDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDescendantIterator.h; sourceTree = "<group>"; };
+ E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedElementDescendantIterator.h; sourceTree = "<group>"; };
E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementChildIterator.h; sourceTree = "<group>"; };
E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomEvent.cpp; sourceTree = "<group>"; };
E4778B7E115A581A00B5D372 /* JSCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomEvent.h; sourceTree = "<group>"; };
@@ -22122,7 +22122,7 @@
E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */,
B5B7A16F17C1080600E4AA0A /* ElementData.cpp */,
B5B7A16E17C1048000E4AA0A /* ElementData.h */,
- E46A2B1B17CA65B9000DBCD8 /* ElementDescendantIterator.h */,
+ E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */,
E4AE7C1517D1BB950009FB31 /* ElementIterator.h */,
E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */,
4FAB48641643A66D00F70C07 /* ElementRareData.cpp */,
@@ -23640,7 +23640,7 @@
E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */,
E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */,
B5B7A17117C10AC000E4AA0A /* ElementData.h in Headers */,
- E46A2B1C17CA65B9000DBCD8 /* ElementDescendantIterator.h in Headers */,
+ E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */,
E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */,
E401C27517CE53EC00C41A35 /* ElementIteratorAssertions.h in Headers */,
63F5D4F70E8C4B7100C0BD04 /* ElementRareData.h in Headers */,
Deleted: trunk/Source/WebCore/dom/ElementDescendantIterator.h (165804 => 165805)
--- trunk/Source/WebCore/dom/ElementDescendantIterator.h 2014-03-18 08:51:55 UTC (rev 165804)
+++ trunk/Source/WebCore/dom/ElementDescendantIterator.h 2014-03-18 09:42:58 UTC (rev 165805)
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ElementDescendantIterator_h
-#define ElementDescendantIterator_h
-
-#include "ElementIterator.h"
-
-namespace WebCore {
-
-template <typename ElementType>
-class ElementDescendantIterator : public ElementIterator<ElementType> {
-public:
- ElementDescendantIterator(const ContainerNode& root);
- ElementDescendantIterator(const ContainerNode& root, ElementType* current);
- ElementDescendantIterator& operator++();
-};
-
-template <typename ElementType>
-class ElementDescendantConstIterator : public ElementConstIterator<ElementType> {
-public:
- ElementDescendantConstIterator(const ContainerNode& root);
- ElementDescendantConstIterator(const ContainerNode& root, const ElementType* current);
- ElementDescendantConstIterator& operator++();
-};
-
-template <typename ElementType>
-class ElementDescendantIteratorAdapter {
-public:
- ElementDescendantIteratorAdapter(ContainerNode& root);
- ElementDescendantIterator<ElementType> begin();
- ElementDescendantIterator<ElementType> end();
- ElementDescendantIterator<ElementType> beginAt(ElementType&);
- ElementDescendantIterator<ElementType> from(Element&);
-
- ElementType* first();
- ElementType* last();
-
-private:
- ContainerNode& m_root;
-};
-
-template <typename ElementType>
-class ElementDescendantConstIteratorAdapter {
-public:
- ElementDescendantConstIteratorAdapter(const ContainerNode& root);
- ElementDescendantConstIterator<ElementType> begin() const;
- ElementDescendantConstIterator<ElementType> end() const;
- ElementDescendantConstIterator<ElementType> beginAt(const ElementType&) const;
- ElementDescendantConstIterator<ElementType> from(const Element&) const;
-
- const ElementType* first() const;
- const ElementType* last() const;
-
-private:
- const ContainerNode& m_root;
-};
-
-template <typename ElementType> ElementDescendantIteratorAdapter<ElementType> descendantsOfType(ContainerNode&);
-template <typename ElementType> ElementDescendantConstIteratorAdapter<ElementType> descendantsOfType(const ContainerNode&);
-
-// ElementDescendantIterator
-
-template <typename ElementType>
-inline ElementDescendantIterator<ElementType>::ElementDescendantIterator(const ContainerNode& root)
- : ElementIterator<ElementType>(&root)
-{
-}
-
-template <typename ElementType>
-inline ElementDescendantIterator<ElementType>::ElementDescendantIterator(const ContainerNode& root, ElementType* current)
- : ElementIterator<ElementType>(&root, current)
-{
-}
-
-template <typename ElementType>
-inline ElementDescendantIterator<ElementType>& ElementDescendantIterator<ElementType>::operator++()
-{
- return static_cast<ElementDescendantIterator<ElementType>&>(ElementIterator<ElementType>::traverseNext());
-}
-
-// ElementDescendantConstIterator
-
-template <typename ElementType>
-inline ElementDescendantConstIterator<ElementType>::ElementDescendantConstIterator(const ContainerNode& root)
- : ElementConstIterator<ElementType>(&root)
-
-{
-}
-
-template <typename ElementType>
-inline ElementDescendantConstIterator<ElementType>::ElementDescendantConstIterator(const ContainerNode& root, const ElementType* current)
- : ElementConstIterator<ElementType>(&root, current)
-{
-}
-
-template <typename ElementType>
-inline ElementDescendantConstIterator<ElementType>& ElementDescendantConstIterator<ElementType>::operator++()
-{
- return static_cast<ElementDescendantConstIterator<ElementType>&>(ElementConstIterator<ElementType>::traverseNext());
-}
-
-// ElementDescendantIteratorAdapter
-
-template <typename ElementType>
-inline ElementDescendantIteratorAdapter<ElementType>::ElementDescendantIteratorAdapter(ContainerNode& root)
- : m_root(root)
-{
-}
-
-template <typename ElementType>
-inline ElementDescendantIterator<ElementType> ElementDescendantIteratorAdapter<ElementType>::begin()
-{
- return ElementDescendantIterator<ElementType>(m_root, Traversal<ElementType>::firstWithin(&m_root));
-}
-
-template <typename ElementType>
-inline ElementDescendantIterator<ElementType> ElementDescendantIteratorAdapter<ElementType>::end()
-{
- return ElementDescendantIterator<ElementType>(m_root);
-}
-
-template <typename ElementType>
-inline ElementDescendantIterator<ElementType> ElementDescendantIteratorAdapter<ElementType>::beginAt(ElementType& descendant)
-{
- ASSERT(descendant.isDescendantOf(&m_root));
- return ElementDescendantIterator<ElementType>(m_root, &descendant);
-}
-
-template <typename ElementType>
-inline ElementDescendantIterator<ElementType> ElementDescendantIteratorAdapter<ElementType>::from(Element& descendant)
-{
- ASSERT(descendant.isDescendantOf(&m_root));
- if (isElementOfType<const ElementType>(descendant))
- return ElementDescendantIterator<ElementType>(m_root, static_cast<ElementType*>(&descendant));
- ElementType* next = Traversal<ElementType>::next(&m_root, &descendant);
- return ElementDescendantIterator<ElementType>(m_root, next);
-}
-
-template <typename ElementType>
-inline ElementType* ElementDescendantIteratorAdapter<ElementType>::first()
-{
- return Traversal<ElementType>::firstWithin(&m_root);
-}
-
-template <typename ElementType>
-inline ElementType* ElementDescendantIteratorAdapter<ElementType>::last()
-{
- return Traversal<ElementType>::lastWithin(&m_root);
-}
-
-// ElementDescendantConstIteratorAdapter
-
-template <typename ElementType>
-inline ElementDescendantConstIteratorAdapter<ElementType>::ElementDescendantConstIteratorAdapter(const ContainerNode& root)
- : m_root(root)
-{
-}
-
-template <typename ElementType>
-inline ElementDescendantConstIterator<ElementType> ElementDescendantConstIteratorAdapter<ElementType>::begin() const
-{
- return ElementDescendantConstIterator<ElementType>(m_root, Traversal<ElementType>::firstWithin(&m_root));
-}
-
-template <typename ElementType>
-inline ElementDescendantConstIterator<ElementType> ElementDescendantConstIteratorAdapter<ElementType>::end() const
-{
- return ElementDescendantConstIterator<ElementType>(m_root);
-}
-
-template <typename ElementType>
-inline ElementDescendantConstIterator<ElementType> ElementDescendantConstIteratorAdapter<ElementType>::beginAt(const ElementType& descendant) const
-{
- ASSERT(descendant.isDescendantOf(&m_root));
- return ElementDescendantConstIterator<ElementType>(m_root, &descendant);
-}
-
-template <typename ElementType>
-inline ElementDescendantConstIterator<ElementType> ElementDescendantConstIteratorAdapter<ElementType>::from(const Element& descendant) const
-{
- ASSERT(descendant.isDescendantOf(&m_root));
- if (isElementOfType<const ElementType>(descendant))
- return ElementDescendantConstIterator<ElementType>(m_root, static_cast<const ElementType*>(&descendant));
- const ElementType* next = Traversal<ElementType>::next(&m_root, &descendant);
- return ElementDescendantConstIterator<ElementType>(m_root, next);
-}
-
-template <typename ElementType>
-inline const ElementType* ElementDescendantConstIteratorAdapter<ElementType>::first() const
-{
- return Traversal<ElementType>::firstWithin(&m_root);
-}
-
-template <typename ElementType>
-inline const ElementType* ElementDescendantConstIteratorAdapter<ElementType>::last() const
-{
- return Traversal<ElementType>::lastWithin(&m_root);
-}
-
-// Standalone functions
-
-template <typename ElementType>
-inline ElementDescendantIteratorAdapter<ElementType> descendantsOfType(ContainerNode& root)
-{
- return ElementDescendantIteratorAdapter<ElementType>(root);
-}
-
-template <typename ElementType>
-inline ElementDescendantConstIteratorAdapter<ElementType> descendantsOfType(const ContainerNode& root)
-{
- return ElementDescendantConstIteratorAdapter<ElementType>(root);
-}
-
-}
-
-#endif
Modified: trunk/Source/WebCore/dom/ElementIterator.h (165804 => 165805)
--- trunk/Source/WebCore/dom/ElementIterator.h 2014-03-18 08:51:55 UTC (rev 165804)
+++ trunk/Source/WebCore/dom/ElementIterator.h 2014-03-18 09:42:58 UTC (rev 165805)
@@ -372,6 +372,6 @@
#include "ElementAncestorIterator.h"
#include "ElementChildIterator.h"
-#include "ElementDescendantIterator.h"
+#include "TypedElementDescendantIterator.h"
#endif
Added: trunk/Source/WebCore/dom/TypedElementDescendantIterator.h (0 => 165805)
--- trunk/Source/WebCore/dom/TypedElementDescendantIterator.h (rev 0)
+++ trunk/Source/WebCore/dom/TypedElementDescendantIterator.h 2014-03-18 09:42:58 UTC (rev 165805)
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TypedElementDescendantIterator_h
+#define TypedElementDescendantIterator_h
+
+#include "ElementIterator.h"
+
+namespace WebCore {
+
+template <typename ElementType>
+class TypedElementDescendantIterator : public ElementIterator<ElementType> {
+public:
+ TypedElementDescendantIterator(const ContainerNode& root);
+ TypedElementDescendantIterator(const ContainerNode& root, ElementType* current);
+ TypedElementDescendantIterator& operator++();
+};
+
+template <typename ElementType>
+class TypedElementDescendantConstIterator : public ElementConstIterator<ElementType> {
+public:
+ TypedElementDescendantConstIterator(const ContainerNode& root);
+ TypedElementDescendantConstIterator(const ContainerNode& root, const ElementType* current);
+ TypedElementDescendantConstIterator& operator++();
+};
+
+template <typename ElementType>
+class TypedElementDescendantIteratorAdapter {
+public:
+ TypedElementDescendantIteratorAdapter(ContainerNode& root);
+ TypedElementDescendantIterator<ElementType> begin();
+ TypedElementDescendantIterator<ElementType> end();
+ TypedElementDescendantIterator<ElementType> beginAt(ElementType&);
+ TypedElementDescendantIterator<ElementType> from(Element&);
+
+ ElementType* first();
+ ElementType* last();
+
+private:
+ ContainerNode& m_root;
+};
+
+template <typename ElementType>
+class TypedElementDescendantConstIteratorAdapter {
+public:
+ TypedElementDescendantConstIteratorAdapter(const ContainerNode& root);
+ TypedElementDescendantConstIterator<ElementType> begin() const;
+ TypedElementDescendantConstIterator<ElementType> end() const;
+ TypedElementDescendantConstIterator<ElementType> beginAt(const ElementType&) const;
+ TypedElementDescendantConstIterator<ElementType> from(const Element&) const;
+
+ const ElementType* first() const;
+ const ElementType* last() const;
+
+private:
+ const ContainerNode& m_root;
+};
+
+template <typename ElementType> TypedElementDescendantIteratorAdapter<ElementType> descendantsOfType(ContainerNode&);
+template <typename ElementType> TypedElementDescendantConstIteratorAdapter<ElementType> descendantsOfType(const ContainerNode&);
+
+// TypedElementDescendantIterator
+
+template <typename ElementType>
+inline TypedElementDescendantIterator<ElementType>::TypedElementDescendantIterator(const ContainerNode& root)
+ : ElementIterator<ElementType>(&root)
+{
+}
+
+template <typename ElementType>
+inline TypedElementDescendantIterator<ElementType>::TypedElementDescendantIterator(const ContainerNode& root, ElementType* current)
+ : ElementIterator<ElementType>(&root, current)
+{
+}
+
+template <typename ElementType>
+inline TypedElementDescendantIterator<ElementType>& TypedElementDescendantIterator<ElementType>::operator++()
+{
+ return static_cast<TypedElementDescendantIterator<ElementType>&>(ElementIterator<ElementType>::traverseNext());
+}
+
+// TypedElementDescendantConstIterator
+
+template <typename ElementType>
+inline TypedElementDescendantConstIterator<ElementType>::TypedElementDescendantConstIterator(const ContainerNode& root)
+ : ElementConstIterator<ElementType>(&root)
+
+{
+}
+
+template <typename ElementType>
+inline TypedElementDescendantConstIterator<ElementType>::TypedElementDescendantConstIterator(const ContainerNode& root, const ElementType* current)
+ : ElementConstIterator<ElementType>(&root, current)
+{
+}
+
+template <typename ElementType>
+inline TypedElementDescendantConstIterator<ElementType>& TypedElementDescendantConstIterator<ElementType>::operator++()
+{
+ return static_cast<TypedElementDescendantConstIterator<ElementType>&>(ElementConstIterator<ElementType>::traverseNext());
+}
+
+// TypedElementDescendantIteratorAdapter
+
+template <typename ElementType>
+inline TypedElementDescendantIteratorAdapter<ElementType>::TypedElementDescendantIteratorAdapter(ContainerNode& root)
+ : m_root(root)
+{
+}
+
+template <typename ElementType>
+inline TypedElementDescendantIterator<ElementType> TypedElementDescendantIteratorAdapter<ElementType>::begin()
+{
+ return TypedElementDescendantIterator<ElementType>(m_root, Traversal<ElementType>::firstWithin(&m_root));
+}
+
+template <typename ElementType>
+inline TypedElementDescendantIterator<ElementType> TypedElementDescendantIteratorAdapter<ElementType>::end()
+{
+ return TypedElementDescendantIterator<ElementType>(m_root);
+}
+
+template <typename ElementType>
+inline TypedElementDescendantIterator<ElementType> TypedElementDescendantIteratorAdapter<ElementType>::beginAt(ElementType& descendant)
+{
+ ASSERT(descendant.isDescendantOf(&m_root));
+ return TypedElementDescendantIterator<ElementType>(m_root, &descendant);
+}
+
+template <typename ElementType>
+inline TypedElementDescendantIterator<ElementType> TypedElementDescendantIteratorAdapter<ElementType>::from(Element& descendant)
+{
+ ASSERT(descendant.isDescendantOf(&m_root));
+ if (isElementOfType<const ElementType>(descendant))
+ return TypedElementDescendantIterator<ElementType>(m_root, static_cast<ElementType*>(&descendant));
+ ElementType* next = Traversal<ElementType>::next(&m_root, &descendant);
+ return TypedElementDescendantIterator<ElementType>(m_root, next);
+}
+
+template <typename ElementType>
+inline ElementType* TypedElementDescendantIteratorAdapter<ElementType>::first()
+{
+ return Traversal<ElementType>::firstWithin(&m_root);
+}
+
+template <typename ElementType>
+inline ElementType* TypedElementDescendantIteratorAdapter<ElementType>::last()
+{
+ return Traversal<ElementType>::lastWithin(&m_root);
+}
+
+// TypedElementDescendantConstIteratorAdapter
+
+template <typename ElementType>
+inline TypedElementDescendantConstIteratorAdapter<ElementType>::TypedElementDescendantConstIteratorAdapter(const ContainerNode& root)
+ : m_root(root)
+{
+}
+
+template <typename ElementType>
+inline TypedElementDescendantConstIterator<ElementType> TypedElementDescendantConstIteratorAdapter<ElementType>::begin() const
+{
+ return TypedElementDescendantConstIterator<ElementType>(m_root, Traversal<ElementType>::firstWithin(&m_root));
+}
+
+template <typename ElementType>
+inline TypedElementDescendantConstIterator<ElementType> TypedElementDescendantConstIteratorAdapter<ElementType>::end() const
+{
+ return TypedElementDescendantConstIterator<ElementType>(m_root);
+}
+
+template <typename ElementType>
+inline TypedElementDescendantConstIterator<ElementType> TypedElementDescendantConstIteratorAdapter<ElementType>::beginAt(const ElementType& descendant) const
+{
+ ASSERT(descendant.isDescendantOf(&m_root));
+ return TypedElementDescendantConstIterator<ElementType>(m_root, &descendant);
+}
+
+template <typename ElementType>
+inline TypedElementDescendantConstIterator<ElementType> TypedElementDescendantConstIteratorAdapter<ElementType>::from(const Element& descendant) const
+{
+ ASSERT(descendant.isDescendantOf(&m_root));
+ if (isElementOfType<const ElementType>(descendant))
+ return TypedElementDescendantConstIterator<ElementType>(m_root, static_cast<const ElementType*>(&descendant));
+ const ElementType* next = Traversal<ElementType>::next(&m_root, &descendant);
+ return TypedElementDescendantConstIterator<ElementType>(m_root, next);
+}
+
+template <typename ElementType>
+inline const ElementType* TypedElementDescendantConstIteratorAdapter<ElementType>::first() const
+{
+ return Traversal<ElementType>::firstWithin(&m_root);
+}
+
+template <typename ElementType>
+inline const ElementType* TypedElementDescendantConstIteratorAdapter<ElementType>::last() const
+{
+ return Traversal<ElementType>::lastWithin(&m_root);
+}
+
+// Standalone functions
+
+template <typename ElementType>
+inline TypedElementDescendantIteratorAdapter<ElementType> descendantsOfType(ContainerNode& root)
+{
+ return TypedElementDescendantIteratorAdapter<ElementType>(root);
+}
+
+template <typename ElementType>
+inline TypedElementDescendantConstIteratorAdapter<ElementType> descendantsOfType(const ContainerNode& root)
+{
+ return TypedElementDescendantConstIteratorAdapter<ElementType>(root);
+}
+
+}
+
+#endif