| 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 Appl
e Inc. All rights reserved. |
| 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 static ElementType* next(const ContainerNode& current) { return nextTemplate
(current); } | 58 static ElementType* next(const ContainerNode& current) { return nextTemplate
(current); } |
| 59 static ElementType* next(const Node& current) { return nextTemplate(current)
; } | 59 static ElementType* next(const Node& current) { return nextTemplate(current)
; } |
| 60 static ElementType* next(const ContainerNode& current, const Node* stayWithi
n) { return nextTemplate(current, stayWithin); } | 60 static ElementType* next(const ContainerNode& current, const Node* stayWithi
n) { return nextTemplate(current, stayWithin); } |
| 61 static ElementType* next(const Node& current, const Node* stayWithin) { retu
rn nextTemplate(current, stayWithin); } | 61 static ElementType* next(const Node& current, const Node* stayWithin) { retu
rn nextTemplate(current, stayWithin); } |
| 62 static ElementType* previous(const ContainerNode& current) { return previous
Template(current); } | 62 static ElementType* previous(const ContainerNode& current) { return previous
Template(current); } |
| 63 static ElementType* previous(const Node& current) { return previousTemplate(
current); } | 63 static ElementType* previous(const Node& current) { return previousTemplate(
current); } |
| 64 static ElementType* previous(const ContainerNode& current, const Node* stayW
ithin) { return previousTemplate(current, stayWithin); } | 64 static ElementType* previous(const ContainerNode& current, const Node* stayW
ithin) { return previousTemplate(current, stayWithin); } |
| 65 static ElementType* previous(const Node& current, const Node* stayWithin) {
return previousTemplate(current, stayWithin); } | 65 static ElementType* previous(const Node& current, const Node* stayWithin) {
return previousTemplate(current, stayWithin); } |
| 66 | 66 |
| 67 // Like next, but skips children. | 67 // Like next, but skips children. |
| 68 static ElementType* nextSkippingChildren(const ContainerNode& current) { ret
urn nextSkippingChildrenTemplate(current); } | 68 static ElementType* nextSkippingChildren(const Node&); |
| 69 static ElementType* nextSkippingChildren(const Node& current) { return nextS
kippingChildrenTemplate(current); } | 69 static ElementType* nextSkippingChildren(const Node&, const Node* stayWithin
); |
| 70 static ElementType* nextSkippingChildren(const ContainerNode& current, const
Node* stayWithin) { return nextSkippingChildrenTemplate(current, stayWithin); } | |
| 71 static ElementType* nextSkippingChildren(const Node& current, const Node* st
ayWithin) { return nextSkippingChildrenTemplate(current, stayWithin); } | |
| 72 | 70 |
| 73 // Pre-order traversal including the pseudo-elements. | 71 // Pre-order traversal including the pseudo-elements. |
| 74 static ElementType* previousIncludingPseudo(const Node&, const Node* stayWit
hin = 0); | 72 static ElementType* previousIncludingPseudo(const Node&, const Node* stayWit
hin = 0); |
| 75 static ElementType* nextIncludingPseudo(const Node&, const Node* stayWithin
= 0); | 73 static ElementType* nextIncludingPseudo(const Node&, const Node* stayWithin
= 0); |
| 76 static ElementType* nextIncludingPseudoSkippingChildren(const Node&, const N
ode* stayWithin = 0); | 74 static ElementType* nextIncludingPseudoSkippingChildren(const Node&, const N
ode* stayWithin = 0); |
| 77 | 75 |
| 78 // Utility function to traverse only the element and pseudo-element siblings
of a node. | 76 // Utility function to traverse only the element and pseudo-element siblings
of a node. |
| 79 static ElementType* pseudoAwarePreviousSibling(const Node&); | 77 static ElementType* pseudoAwarePreviousSibling(const Node&); |
| 80 | 78 |
| 81 // Previous / Next sibling. | 79 // Previous / Next sibling. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 template <class NodeType> | 92 template <class NodeType> |
| 95 static ElementType* lastWithinTemplate(NodeType&); | 93 static ElementType* lastWithinTemplate(NodeType&); |
| 96 template <class NodeType> | 94 template <class NodeType> |
| 97 static ElementType* nextTemplate(NodeType&); | 95 static ElementType* nextTemplate(NodeType&); |
| 98 template <class NodeType> | 96 template <class NodeType> |
| 99 static ElementType* nextTemplate(NodeType&, const Node* stayWithin); | 97 static ElementType* nextTemplate(NodeType&, const Node* stayWithin); |
| 100 template <class NodeType> | 98 template <class NodeType> |
| 101 static ElementType* previousTemplate(NodeType&); | 99 static ElementType* previousTemplate(NodeType&); |
| 102 template <class NodeType> | 100 template <class NodeType> |
| 103 static ElementType* previousTemplate(NodeType&, const Node* stayWithin); | 101 static ElementType* previousTemplate(NodeType&, const Node* stayWithin); |
| 104 template <class NodeType> | |
| 105 static ElementType* nextSkippingChildrenTemplate(NodeType&); | |
| 106 template <class NodeType> | |
| 107 static ElementType* nextSkippingChildrenTemplate(NodeType&, const Node* stay
Within); | |
| 108 }; | 102 }; |
| 109 | 103 |
| 110 typedef Traversal<Element> ElementTraversal; | 104 typedef Traversal<Element> ElementTraversal; |
| 111 | 105 |
| 112 // Specialized for pure Element to exploit the fact that Elements parent is alwa
ys either another Element or the root. | 106 // Specialized for pure Element to exploit the fact that Elements parent is alwa
ys either another Element or the root. |
| 113 template <> | 107 template <> |
| 114 template <class NodeType> | 108 template <class NodeType> |
| 115 inline Element* Traversal<Element>::firstWithinTemplate(NodeType& current) | 109 inline Element* Traversal<Element>::firstWithinTemplate(NodeType& current) |
| 116 { | 110 { |
| 117 return firstChildTemplate(current); | 111 return firstChildTemplate(current); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 template <class NodeType> | 254 template <class NodeType> |
| 261 inline ElementType* Traversal<ElementType>::previousTemplate(NodeType& current,
const Node* stayWithin) | 255 inline ElementType* Traversal<ElementType>::previousTemplate(NodeType& current,
const Node* stayWithin) |
| 262 { | 256 { |
| 263 Node* node = NodeTraversal::previous(current, stayWithin); | 257 Node* node = NodeTraversal::previous(current, stayWithin); |
| 264 while (node && !isElementOfType<const ElementType>(*node)) | 258 while (node && !isElementOfType<const ElementType>(*node)) |
| 265 node = NodeTraversal::previous(*node, stayWithin); | 259 node = NodeTraversal::previous(*node, stayWithin); |
| 266 return toElement<ElementType>(node); | 260 return toElement<ElementType>(node); |
| 267 } | 261 } |
| 268 | 262 |
| 269 template <class ElementType> | 263 template <class ElementType> |
| 270 template <class NodeType> | 264 inline ElementType* Traversal<ElementType>::nextSkippingChildren(const Node& cur
rent) |
| 271 inline ElementType* Traversal<ElementType>::nextSkippingChildrenTemplate(NodeTyp
e& current) | |
| 272 { | 265 { |
| 273 Node* node = NodeTraversal::nextSkippingChildren(current); | 266 Node* node = NodeTraversal::nextSkippingChildren(current); |
| 274 while (node && !isElementOfType<const ElementType>(*node)) | 267 while (node && !isElementOfType<const ElementType>(*node)) |
| 275 node = NodeTraversal::nextSkippingChildren(*node); | 268 node = NodeTraversal::nextSkippingChildren(*node); |
| 276 return toElement<ElementType>(node); | 269 return toElement<ElementType>(node); |
| 277 } | 270 } |
| 278 | 271 |
| 279 template <class ElementType> | 272 template <class ElementType> |
| 280 template <class NodeType> | 273 inline ElementType* Traversal<ElementType>::nextSkippingChildren(const Node& cur
rent, const Node* stayWithin) |
| 281 inline ElementType* Traversal<ElementType>::nextSkippingChildrenTemplate(NodeTyp
e& current, const Node* stayWithin) | |
| 282 { | 274 { |
| 283 Node* node = NodeTraversal::nextSkippingChildren(current, stayWithin); | 275 Node* node = NodeTraversal::nextSkippingChildren(current, stayWithin); |
| 284 while (node && !isElementOfType<const ElementType>(*node)) | 276 while (node && !isElementOfType<const ElementType>(*node)) |
| 285 node = NodeTraversal::nextSkippingChildren(*node, stayWithin); | 277 node = NodeTraversal::nextSkippingChildren(*node, stayWithin); |
| 286 return toElement<ElementType>(node); | 278 return toElement<ElementType>(node); |
| 287 } | 279 } |
| 288 | 280 |
| 289 template <class ElementType> | 281 template <class ElementType> |
| 290 inline ElementType* Traversal<ElementType>::previousIncludingPseudo(const Node&
current, const Node* stayWithin) | 282 inline ElementType* Traversal<ElementType>::previousIncludingPseudo(const Node&
current, const Node* stayWithin) |
| 291 { | 283 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 { | 328 { |
| 337 Node* node = current.nextSibling(); | 329 Node* node = current.nextSibling(); |
| 338 while (node && !isElementOfType<const ElementType>(*node)) | 330 while (node && !isElementOfType<const ElementType>(*node)) |
| 339 node = node->nextSibling(); | 331 node = node->nextSibling(); |
| 340 return toElement<ElementType>(node); | 332 return toElement<ElementType>(node); |
| 341 } | 333 } |
| 342 | 334 |
| 343 } // namespace blink | 335 } // namespace blink |
| 344 | 336 |
| 345 #endif | 337 #endif |
| OLD | NEW |