OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Appl
e Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 |
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 6 * Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 8 * (http://www.torchmobile.com/) |
7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 9 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
8 * | 10 * |
9 * This library is free software; you can redistribute it and/or | 11 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 12 * modify it under the terms of the GNU Library General Public |
11 * License as published by the Free Software Foundation; either | 13 * License as published by the Free Software Foundation; either |
12 * version 2 of the License, or (at your option) any later version. | 14 * version 2 of the License, or (at your option) any later version. |
13 * | 15 * |
14 * This library is distributed in the hope that it will be useful, | 16 * This library is distributed in the hope that it will be useful, |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 165 |
164 // Pre-order traversal including the pseudo-elements. | 166 // Pre-order traversal including the pseudo-elements. |
165 static ElementType* previousIncludingPseudo(const Node&, | 167 static ElementType* previousIncludingPseudo(const Node&, |
166 const Node* stayWithin = 0); | 168 const Node* stayWithin = 0); |
167 static ElementType* nextIncludingPseudo(const Node&, | 169 static ElementType* nextIncludingPseudo(const Node&, |
168 const Node* stayWithin = 0); | 170 const Node* stayWithin = 0); |
169 static ElementType* nextIncludingPseudoSkippingChildren( | 171 static ElementType* nextIncludingPseudoSkippingChildren( |
170 const Node&, | 172 const Node&, |
171 const Node* stayWithin = 0); | 173 const Node* stayWithin = 0); |
172 | 174 |
173 // Utility function to traverse only the element and pseudo-element siblings o
f a node. | 175 // Utility function to traverse only the element and pseudo-element siblings |
| 176 // of a node. |
174 static ElementType* pseudoAwarePreviousSibling(const Node&); | 177 static ElementType* pseudoAwarePreviousSibling(const Node&); |
175 | 178 |
176 // Previous / Next sibling. | 179 // Previous / Next sibling. |
177 static ElementType* previousSibling(const Node&); | 180 static ElementType* previousSibling(const Node&); |
178 template <class MatchFunc> | 181 template <class MatchFunc> |
179 static ElementType* previousSibling(const Node&, MatchFunc); | 182 static ElementType* previousSibling(const Node&, MatchFunc); |
180 static ElementType* nextSibling(const Node&); | 183 static ElementType* nextSibling(const Node&); |
181 template <class MatchFunc> | 184 template <class MatchFunc> |
182 static ElementType* nextSibling(const Node&, MatchFunc); | 185 static ElementType* nextSibling(const Node&, MatchFunc); |
183 | 186 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 Traversal<ElementType>::startsAt(const ElementType* start) { | 242 Traversal<ElementType>::startsAt(const ElementType* start) { |
240 return TraversalRange<TraversalNextIterator<Traversal<ElementType>>>(start); | 243 return TraversalRange<TraversalNextIterator<Traversal<ElementType>>>(start); |
241 }; | 244 }; |
242 | 245 |
243 template <class ElementType> | 246 template <class ElementType> |
244 inline TraversalRange<TraversalNextIterator<Traversal<ElementType>>> | 247 inline TraversalRange<TraversalNextIterator<Traversal<ElementType>>> |
245 Traversal<ElementType>::startsAfter(const Node& start) { | 248 Traversal<ElementType>::startsAfter(const Node& start) { |
246 return startsAt(Traversal<ElementType>::next(start)); | 249 return startsAt(Traversal<ElementType>::next(start)); |
247 }; | 250 }; |
248 | 251 |
249 // Specialized for pure Element to exploit the fact that Elements parent is alwa
ys either another Element or the root. | 252 // Specialized for pure Element to exploit the fact that Elements parent is |
| 253 // always either another Element or the root. |
250 template <> | 254 template <> |
251 template <class NodeType> | 255 template <class NodeType> |
252 inline Element* Traversal<Element>::firstWithinTemplate(NodeType& current) { | 256 inline Element* Traversal<Element>::firstWithinTemplate(NodeType& current) { |
253 return firstChildTemplate(current); | 257 return firstChildTemplate(current); |
254 } | 258 } |
255 | 259 |
256 template <> | 260 template <> |
257 template <class NodeType> | 261 template <class NodeType> |
258 inline Element* Traversal<Element>::nextTemplate(NodeType& current) { | 262 inline Element* Traversal<Element>::nextTemplate(NodeType& current) { |
259 Node* node = NodeTraversal::next(current); | 263 Node* node = NodeTraversal::next(current); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 MatchFunc isMatch) { | 539 MatchFunc isMatch) { |
536 ElementType* element = Traversal<ElementType>::nextSibling(current); | 540 ElementType* element = Traversal<ElementType>::nextSibling(current); |
537 while (element && !isMatch(*element)) | 541 while (element && !isMatch(*element)) |
538 element = Traversal<ElementType>::nextSibling(*element); | 542 element = Traversal<ElementType>::nextSibling(*element); |
539 return element; | 543 return element; |
540 } | 544 } |
541 | 545 |
542 } // namespace blink | 546 } // namespace blink |
543 | 547 |
544 #endif | 548 #endif |
OLD | NEW |