Changeset 154926 in webkit
- Timestamp:
- Aug 31, 2013, 6:04:33 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 7 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r154924 r154926 1 2013-08-31 Antti Koivisto <antti@apple.com> 2 3 Add common base for element iterators 4 https://bugs.webkit.org/show_bug.cgi?id=120557 5 6 Reviewed by Andreas Kling. 7 8 Add ElementIterator and use it as the base for child and descendant iterators. The only difference is the definition of operator++. 9 10 Also renamed DescendantIteratorAssertions to ElementIteratorAssertions. 11 12 * GNUmakefile.list.am: 13 * Target.pri: 14 * WebCore.vcxproj/WebCore.vcxproj: 15 * WebCore.xcodeproj/project.pbxproj: 16 * dom/ChildIterator.h: 17 (WebCore::::ChildIterator): 18 (WebCore::::operator): 19 (WebCore::::ChildConstIterator): 20 (WebCore::::begin): 21 (WebCore::::end): 22 * dom/DescendantIterator.h: 23 (WebCore::::DescendantIterator): 24 (WebCore::::operator): 25 (WebCore::::DescendantConstIterator): 26 * dom/DescendantIteratorAssertions.h: Removed. 27 * dom/ElementIterator.h: Added. 28 (WebCore::::ElementIterator): 29 (WebCore::::traverseNext): 30 (WebCore::::traversePrevious): 31 (WebCore::::traverseNextSibling): 32 (WebCore::::traversePreviousSibling): 33 (WebCore::::operator): 34 (WebCore::=): 35 (WebCore::::ElementConstIterator): 36 * dom/ElementIteratorAssertions.h: Copied from Source/WebCore/dom/DescendantIteratorAssertions.h. 37 (WebCore::ElementIteratorAssertions::ElementIteratorAssertions): 38 (WebCore::ElementIteratorAssertions::domTreeHasMutated): 39 (WebCore::ElementIteratorAssertions::dropEventDispatchAssertion): 40 1 41 2013-08-30 Brent Fulgham <bfulgham@apple.com> 2 42 -
trunk/Source/WebCore/GNUmakefile.list.am
r154908 r154926 2822 2822 Source/WebCore/dom/default/PlatformMessagePortChannel.h \ 2823 2823 Source/WebCore/dom/DescendantIterator.h \ 2824 Source/WebCore/dom/DescendantIteratorAssertions.h \2825 2824 Source/WebCore/dom/DeviceMotionClient.h \ 2826 2825 Source/WebCore/dom/DeviceMotionController.cpp \ … … 2875 2874 Source/WebCore/dom/ElementData.cpp \ 2876 2875 Source/WebCore/dom/ElementData.h \ 2876 Source/WebCore/dom/ElementIterator.h \ 2877 Source/WebCore/dom/ElementIteratorAssertions.h \ 2877 2878 Source/WebCore/dom/ElementRareData.cpp \ 2878 2879 Source/WebCore/dom/ElementRareData.h \ -
trunk/Source/WebCore/Target.pri
r154908 r154926 1590 1590 dom/default/PlatformMessagePortChannel.h \ 1591 1591 dom/DescendantIterator.h \ 1592 dom/DescendantIteratorAssertions.h \1593 1592 dom/DeviceMotionClient.h \ 1594 1593 dom/DeviceMotionController.h \ … … 1615 1614 dom/Element.h \ 1616 1615 dom/ElementData.h \ 1616 dom/ElementIterator.h \ 1617 dom/ElementIteratorAssertions.h \ 1617 1618 dom/ElementTraversal.h \ 1618 1619 dom/Entity.h \ -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r154908 r154926 20239 20239 <ClInclude Include="..\dom\DecodedDataDocumentParser.h" /> 20240 20240 <ClInclude Include="..\dom\DescendantIterator.h" /> 20241 <ClInclude Include="..\dom\DescendantIteratorAssertions.h" />20242 20241 <ClInclude Include="..\dom\DeviceMotionClient.h" /> 20243 20242 <ClInclude Include="..\dom\DeviceMotionController.h" /> … … 20267 20266 <ClInclude Include="..\dom\Element.h" /> 20268 20267 <ClInclude Include="..\dom\ElementData.h" /> 20268 <ClInclude Include="..\dom\ElementIterator.h" /> 20269 <ClInclude Include="..\dom\ElementIteratorAssertions.h" /> 20269 20270 <ClInclude Include="..\dom\ElementTraversal.h" /> 20270 20271 <ClInclude Include="..\dom\Entity.h" /> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r154908 r154926 5446 5446 E1FF57A30F01255B00891EBB /* ThreadGlobalData.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF57A20F01255B00891EBB /* ThreadGlobalData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5447 5447 E1FF57A60F01256B00891EBB /* ThreadGlobalData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */; }; 5448 E401C27517CE53EC00C41A35 /* DescendantIteratorAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = E401C27417CE53EC00C41A35 /* DescendantIteratorAssertions.h */; };5448 E401C27517CE53EC00C41A35 /* ElementIteratorAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */; }; 5449 5449 E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5450 5450 E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */; }; … … 5506 5506 E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5507 5507 E49BDA0B131FD3E5003C56F0 /* CSSValuePool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49BDA0A131FD3E5003C56F0 /* CSSValuePool.cpp */; }; 5508 E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1517D1BB950009FB31 /* ElementIterator.h */; }; 5508 5509 E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */; }; 5509 5510 E4AFD00B0DAF335400F5F55C /* SMILTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0050DAF335400F5F55C /* SMILTime.cpp */; }; … … 12224 12225 E1FF57A20F01255B00891EBB /* ThreadGlobalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadGlobalData.h; sourceTree = "<group>"; }; 12225 12226 E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadGlobalData.cpp; sourceTree = "<group>"; }; 12226 E401C27417CE53EC00C41A35 /* DescendantIteratorAssertions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DescendantIteratorAssertions.h; sourceTree = "<group>"; };12227 E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementIteratorAssertions.h; sourceTree = "<group>"; }; 12227 12228 E406F3FB1198307D009D59D6 /* ColorData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorData.cpp; sourceTree = "<group>"; }; 12228 12229 E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPropertyNames.cpp; sourceTree = "<group>"; }; … … 12279 12280 E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSValuePool.h; sourceTree = "<group>"; }; 12280 12281 E49BDA0A131FD3E5003C56F0 /* CSSValuePool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValuePool.cpp; sourceTree = "<group>"; }; 12282 E4AE7C1517D1BB950009FB31 /* ElementIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementIterator.h; sourceTree = "<group>"; }; 12281 12283 E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnitBezier.h; sourceTree = "<group>"; }; 12282 12284 E4AFD0050DAF335400F5F55C /* SMILTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SMILTime.cpp; sourceTree = "<group>"; }; … … 20161 20163 A8C2289F11D5722E00D5A7D3 /* DecodedDataDocumentParser.h */, 20162 20164 E46A2B1B17CA65B9000DBCD8 /* DescendantIterator.h */, 20163 E401C27417CE53EC00C41A35 /* DescendantIteratorAssertions.h */,20164 20165 31FB1A4F120A5D0600DC02A0 /* DeviceMotionClient.h */, 20165 20166 31FB1A50120A5D0600DC02A0 /* DeviceMotionController.cpp */, … … 20229 20230 4FAB48641643A66D00F70C07 /* ElementRareData.cpp */, 20230 20231 637B7ADE0E8767B800E32194 /* ElementRareData.h */, 20232 E4AE7C1517D1BB950009FB31 /* ElementIterator.h */, 20233 E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */, 20231 20234 E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */, 20232 20235 A8EA7EBA0A1945D000A8EF5F /* Entity.h */, … … 21001 21004 93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */, 21002 21005 BC5EB5E10E81BE8700B25965 /* BorderData.h in Headers */, 21003 E401C27517CE53EC00C41A35 /* DescendantIteratorAssertions.h in Headers */,21006 E401C27517CE53EC00C41A35 /* ElementIteratorAssertions.h in Headers */, 21004 21007 BC5EB5DB0E81B7EA00B25965 /* BorderValue.h in Headers */, 21005 21008 BCEA4855097D93020094C9E4 /* break_lines.h in Headers */, … … 23533 23536 650FBF2B0D9AF047008FC292 /* SVGHKernElement.h in Headers */, 23534 23537 B25599A40D00D8BA00BB825C /* SVGImage.h in Headers */, 23538 E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */, 23535 23539 08F859D51463F9CD0067D933 /* SVGImageCache.h in Headers */, 23536 23540 AAC08CEF15F933D600F1E188 /* SVGImageChromeClient.h in Headers */, -
trunk/Source/WebCore/dom/ChildIterator.h
r154769 r154926 27 27 #define ChildIterator_h 28 28 29 #include "ElementTraversal.h" 30 31 #if !ASSERT_DISABLED 32 #include "DescendantIteratorAssertions.h" 33 #endif 29 #include "ElementIterator.h" 34 30 35 31 namespace WebCore { 36 32 37 33 template <typename ElementType> 38 class ChildIterator {34 class ChildIterator : public ElementIterator<ElementType> { 39 35 public: 40 ChildIterator( );41 ChildIterator( ElementType* current);36 ChildIterator(const ContainerNode* root); 37 ChildIterator(const ContainerNode* root, ElementType* current); 42 38 ChildIterator& operator++(); 43 ElementType& operator*();44 ElementType* operator->();45 bool operator!=(const ChildIterator& other) const;46 47 private:48 ElementType* m_current;49 50 #if !ASSERT_DISABLED51 DescendantIteratorAssertions m_assertions;52 #endif53 39 }; 54 40 55 41 template <typename ElementType> 56 class ChildConstIterator {42 class ChildConstIterator : public ElementConstIterator<ElementType> { 57 43 public: 58 ChildConstIterator( );59 ChildConstIterator(const ElementType* current);44 ChildConstIterator(const ContainerNode* root); 45 ChildConstIterator(const ContainerNode* root, const ElementType* current); 60 46 ChildConstIterator& operator++(); 61 const ElementType& operator*() const;62 const ElementType* operator->() const;63 bool operator!=(const ChildConstIterator& other) const;64 65 private:66 const ElementType* m_current;67 68 #if !ASSERT_DISABLED69 DescendantIteratorAssertions m_assertions;70 #endif71 47 }; 72 48 … … 101 77 102 78 template <typename ElementType> 103 inline ChildIterator<ElementType>::ChildIterator( )104 : m_current(nullptr)79 inline ChildIterator<ElementType>::ChildIterator(const ContainerNode* root) 80 : ElementIterator<ElementType>(root) 105 81 { 106 82 } 107 83 108 84 template <typename ElementType> 109 inline ChildIterator<ElementType>::ChildIterator(ElementType* current) 110 : m_current(current) 111 #if !ASSERT_DISABLED 112 , m_assertions(current) 113 #endif 85 inline ChildIterator<ElementType>::ChildIterator(const ContainerNode* root, ElementType* current) 86 : ElementIterator<ElementType>(root, current) 114 87 { 115 88 } … … 118 91 inline ChildIterator<ElementType>& ChildIterator<ElementType>::operator++() 119 92 { 120 ASSERT(m_current); 121 ASSERT(!m_assertions.domTreeHasMutated()); 122 m_current = Traversal<ElementType>::nextSibling(m_current); 123 #if !ASSERT_DISABLED 124 // Drop the assertion when the iterator reaches the end. 125 if (!m_current) 126 m_assertions.dropEventDispatchAssertion(); 127 #endif 128 return *this; 129 } 130 131 template <typename ElementType> 132 inline ElementType& ChildIterator<ElementType>::operator*() 133 { 134 ASSERT(m_current); 135 ASSERT(!m_assertions.domTreeHasMutated()); 136 return *m_current; 137 } 138 139 template <typename ElementType> 140 inline ElementType* ChildIterator<ElementType>::operator->() 141 { 142 ASSERT(m_current); 143 ASSERT(!m_assertions.domTreeHasMutated()); 144 return m_current; 145 } 146 147 template <typename ElementType> 148 inline bool ChildIterator<ElementType>::operator!=(const ChildIterator& other) const 149 { 150 ASSERT(!m_assertions.domTreeHasMutated()); 151 return m_current != other.m_current; 93 return static_cast<ChildIterator<ElementType>&>(ElementIterator<ElementType>::traverseNextSibling()); 152 94 } 153 95 … … 155 97 156 98 template <typename ElementType> 157 inline ChildConstIterator<ElementType>::ChildConstIterator( )158 : m_current(nullptr)99 inline ChildConstIterator<ElementType>::ChildConstIterator(const ContainerNode* root) 100 : ElementConstIterator<ElementType>(root) 159 101 { 160 102 } 161 103 162 104 template <typename ElementType> 163 inline ChildConstIterator<ElementType>::ChildConstIterator(const ElementType* current) 164 : m_current(current) 165 #if !ASSERT_DISABLED 166 , m_assertions(current) 167 #endif 105 inline ChildConstIterator<ElementType>::ChildConstIterator(const ContainerNode* root, const ElementType* current) 106 : ElementConstIterator<ElementType>(root, current) 168 107 { 169 108 } … … 172 111 inline ChildConstIterator<ElementType>& ChildConstIterator<ElementType>::operator++() 173 112 { 174 ASSERT(m_current); 175 ASSERT(!m_assertions.domTreeHasMutated()); 176 m_current = Traversal<ElementType>::nextSibling(m_current); 177 #if !ASSERT_DISABLED 178 // Drop the assertion when the iterator reaches the end. 179 if (!m_current) 180 m_assertions.dropEventDispatchAssertion(); 181 #endif 182 return *this; 183 } 184 185 template <typename ElementType> 186 inline const ElementType& ChildConstIterator<ElementType>::operator*() const 187 { 188 ASSERT(m_current); 189 ASSERT(!m_assertions.domTreeHasMutated()); 190 return *m_current; 191 } 192 193 template <typename ElementType> 194 inline const ElementType* ChildConstIterator<ElementType>::operator->() const 195 { 196 ASSERT(m_current); 197 ASSERT(!m_assertions.domTreeHasMutated()); 198 return m_current; 199 } 200 201 template <typename ElementType> 202 inline bool ChildConstIterator<ElementType>::operator!=(const ChildConstIterator& other) const 203 { 204 ASSERT(!m_assertions.domTreeHasMutated()); 205 return m_current != other.m_current; 113 return static_cast<ChildConstIterator<ElementType>&>(ElementConstIterator<ElementType>::traverseNextSibling()); 206 114 } 207 115 … … 217 125 inline ChildIterator<ElementType> ChildIteratorAdapter<ElementType>::begin() 218 126 { 219 return ChildIterator<ElementType>( Traversal<ElementType>::firstChild(m_root));127 return ChildIterator<ElementType>(m_root, Traversal<ElementType>::firstChild(m_root)); 220 128 } 221 129 … … 223 131 inline ChildIterator<ElementType> ChildIteratorAdapter<ElementType>::end() 224 132 { 225 return ChildIterator<ElementType>( );133 return ChildIterator<ElementType>(m_root); 226 134 } 227 135 … … 237 145 inline ChildConstIterator<ElementType> ChildConstIteratorAdapter<ElementType>::begin() const 238 146 { 239 return ChildConstIterator<ElementType>( Traversal<ElementType>::firstChild(m_root));147 return ChildConstIterator<ElementType>(m_root, Traversal<ElementType>::firstChild(m_root)); 240 148 } 241 149 … … 243 151 inline ChildConstIterator<ElementType> ChildConstIteratorAdapter<ElementType>::end() const 244 152 { 245 return ChildConstIterator<ElementType>( );153 return ChildConstIterator<ElementType>(m_root); 246 154 } 247 155 -
trunk/Source/WebCore/dom/DescendantIterator.h
r154769 r154926 27 27 #define DescendantIterator_h 28 28 29 #include "ElementTraversal.h" 30 31 #if !ASSERT_DISABLED 32 #include "DescendantIteratorAssertions.h" 33 #endif 29 #include "ElementIterator.h" 34 30 35 31 namespace WebCore { 36 32 37 33 template <typename ElementType> 38 class DescendantIterator {34 class DescendantIterator : public ElementIterator<ElementType> { 39 35 public: 40 36 DescendantIterator(const ContainerNode* root); 41 37 DescendantIterator(const ContainerNode* root, ElementType* current); 42 38 DescendantIterator& operator++(); 43 ElementType& operator*();44 ElementType* operator->();45 bool operator!=(const DescendantIterator& other) const;46 47 private:48 const ContainerNode* m_root;49 ElementType* m_current;50 51 #if !ASSERT_DISABLED52 DescendantIteratorAssertions m_assertions;53 #endif54 39 }; 55 40 56 41 template <typename ElementType> 57 class DescendantConstIterator {42 class DescendantConstIterator : public ElementConstIterator<ElementType> { 58 43 public: 59 44 DescendantConstIterator(const ContainerNode* root); 60 45 DescendantConstIterator(const ContainerNode* root, const ElementType* current); 61 46 DescendantConstIterator& operator++(); 62 const ElementType& operator*() const;63 const ElementType* operator->() const;64 bool operator!=(const DescendantConstIterator& other) const;65 66 private:67 const ContainerNode* m_root;68 const ElementType* m_current;69 70 #if !ASSERT_DISABLED71 DescendantIteratorAssertions m_assertions;72 #endif73 47 }; 74 48 … … 104 78 template <typename ElementType> 105 79 inline DescendantIterator<ElementType>::DescendantIterator(const ContainerNode* root) 106 : m_root(root) 107 , m_current(nullptr) 80 : ElementIterator<ElementType>(root) 108 81 { 109 82 } … … 111 84 template <typename ElementType> 112 85 inline DescendantIterator<ElementType>::DescendantIterator(const ContainerNode* root, ElementType* current) 113 : m_root(root) 114 , m_current(current) 115 #if !ASSERT_DISABLED 116 , m_assertions(current) 117 #endif 86 : ElementIterator<ElementType>(root, current) 118 87 { 119 88 } … … 122 91 inline DescendantIterator<ElementType>& DescendantIterator<ElementType>::operator++() 123 92 { 124 ASSERT(m_current); 125 ASSERT(!m_assertions.domTreeHasMutated()); 126 m_current = Traversal<ElementType>::next(m_current, m_root); 127 #if !ASSERT_DISABLED 128 // Drop the assertion when the iterator reaches the end. 129 if (!m_current) 130 m_assertions.dropEventDispatchAssertion(); 131 #endif 132 return *this; 133 } 134 135 template <typename ElementType> 136 inline ElementType& DescendantIterator<ElementType>::operator*() 137 { 138 ASSERT(m_current); 139 ASSERT(!m_assertions.domTreeHasMutated()); 140 return *m_current; 141 } 142 143 template <typename ElementType> 144 inline ElementType* DescendantIterator<ElementType>::operator->() 145 { 146 ASSERT(m_current); 147 ASSERT(!m_assertions.domTreeHasMutated()); 148 return m_current; 149 } 150 151 template <typename ElementType> 152 inline bool DescendantIterator<ElementType>::operator!=(const DescendantIterator& other) const 153 { 154 ASSERT(m_root == other.m_root); 155 ASSERT(!m_assertions.domTreeHasMutated()); 156 return m_current != other.m_current; 93 return static_cast<DescendantIterator<ElementType>&>(ElementIterator<ElementType>::traverseNext()); 157 94 } 158 95 … … 161 98 template <typename ElementType> 162 99 inline DescendantConstIterator<ElementType>::DescendantConstIterator(const ContainerNode* root) 163 : m_root(root)164 , m_current(nullptr) 100 : ElementConstIterator<ElementType>(root) 101 165 102 { 166 103 } … … 168 105 template <typename ElementType> 169 106 inline DescendantConstIterator<ElementType>::DescendantConstIterator(const ContainerNode* root, const ElementType* current) 170 : m_root(root) 171 , m_current(current) 172 #if !ASSERT_DISABLED 173 , m_assertions(current) 174 #endif 107 : ElementConstIterator<ElementType>(root, current) 175 108 { 176 109 } … … 179 112 inline DescendantConstIterator<ElementType>& DescendantConstIterator<ElementType>::operator++() 180 113 { 181 ASSERT(m_current); 182 ASSERT(!m_assertions.domTreeHasMutated()); 183 m_current = Traversal<ElementType>::next(m_current, m_root); 184 #if !ASSERT_DISABLED 185 // Drop the assertion when the iterator reaches the end. 186 if (!m_current) 187 m_assertions.dropEventDispatchAssertion(); 188 #endif 189 return *this; 190 } 191 192 template <typename ElementType> 193 inline const ElementType& DescendantConstIterator<ElementType>::operator*() const 194 { 195 ASSERT(m_current); 196 ASSERT(!m_assertions.domTreeHasMutated()); 197 return *m_current; 198 } 199 200 template <typename ElementType> 201 inline const ElementType* DescendantConstIterator<ElementType>::operator->() const 202 { 203 ASSERT(m_current); 204 ASSERT(!m_assertions.domTreeHasMutated()); 205 return m_current; 206 } 207 208 template <typename ElementType> 209 inline bool DescendantConstIterator<ElementType>::operator!=(const DescendantConstIterator& other) const 210 { 211 ASSERT(m_root == other.m_root); 212 ASSERT(!m_assertions.domTreeHasMutated()); 213 return m_current != other.m_current; 114 return static_cast<DescendantConstIterator<ElementType>&>(ElementConstIterator<ElementType>::traverseNext()); 214 115 } 215 116 -
trunk/Source/WebCore/dom/ElementIteratorAssertions.h
r154925 r154926 24 24 */ 25 25 26 #ifndef DescendantIteratorAssertions_h27 #define DescendantIteratorAssertions_h26 #ifndef ElementIteratorAssertions_h 27 #define ElementIteratorAssertions_h 28 28 29 29 #include "Document.h" … … 32 32 namespace WebCore { 33 33 34 class DescendantIteratorAssertions {34 class ElementIteratorAssertions { 35 35 public: 36 DescendantIteratorAssertions();37 DescendantIteratorAssertions(const Element* first);36 ElementIteratorAssertions(); 37 ElementIteratorAssertions(const Element* first); 38 38 bool domTreeHasMutated() const; 39 39 void dropEventDispatchAssertion(); … … 45 45 }; 46 46 47 inline DescendantIteratorAssertions::DescendantIteratorAssertions()47 inline ElementIteratorAssertions::ElementIteratorAssertions() 48 48 : m_document(nullptr) 49 49 , m_initialDOMTreeVersion(0) … … 51 51 } 52 52 53 inline DescendantIteratorAssertions::DescendantIteratorAssertions(const Element* first)53 inline ElementIteratorAssertions::ElementIteratorAssertions(const Element* first) 54 54 : m_document(first ? &first->document() : nullptr) 55 55 , m_initialDOMTreeVersion(m_document ? m_document->domTreeVersion() : 0) … … 58 58 } 59 59 60 inline bool DescendantIteratorAssertions::domTreeHasMutated() const60 inline bool ElementIteratorAssertions::domTreeHasMutated() const 61 61 { 62 62 return m_initialDOMTreeVersion && m_document && m_document->domTreeVersion() != m_initialDOMTreeVersion; 63 63 } 64 64 65 inline void DescendantIteratorAssertions::dropEventDispatchAssertion()65 inline void ElementIteratorAssertions::dropEventDispatchAssertion() 66 66 { 67 67 m_noEventDispatchAssertion = nullptr;
Note:
See TracChangeset
for help on using the changeset viewer.