| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 static ElementType* firstWithin(const ContainerNode& current) { return first
WithinTemplate(current); } | 52 static ElementType* firstWithin(const ContainerNode& current) { return first
WithinTemplate(current); } |
| 53 static ElementType* firstWithin(const Node& current) { return firstWithinTem
plate(current); } | 53 static ElementType* firstWithin(const Node& current) { return firstWithinTem
plate(current); } |
| 54 static ElementType* lastWithin(const ContainerNode& current) { return lastWi
thinTemplate(current); } | 54 static ElementType* lastWithin(const ContainerNode& current) { return lastWi
thinTemplate(current); } |
| 55 static ElementType* lastWithin(const Node& current) { return lastWithinTempl
ate(current); } | 55 static ElementType* lastWithin(const Node& current) { return lastWithinTempl
ate(current); } |
| 56 | 56 |
| 57 // Pre-order traversal skipping non-element nodes. | 57 // Pre-order traversal skipping non-element nodes. |
| 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 Node&); |
| 63 static ElementType* previous(const Node& current) { return previousTemplate(
current); } | 63 static ElementType* previous(const Node&, const Node* 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); } | |
| 66 | 64 |
| 67 // Like next, but skips children. | 65 // Like next, but skips children. |
| 68 static ElementType* nextSkippingChildren(const Node&); | 66 static ElementType* nextSkippingChildren(const Node&); |
| 69 static ElementType* nextSkippingChildren(const Node&, const Node* stayWithin
); | 67 static ElementType* nextSkippingChildren(const Node&, const Node* stayWithin
); |
| 70 | 68 |
| 71 // Pre-order traversal including the pseudo-elements. | 69 // Pre-order traversal including the pseudo-elements. |
| 72 static ElementType* previousIncludingPseudo(const Node&, const Node* stayWit
hin = 0); | 70 static ElementType* previousIncludingPseudo(const Node&, const Node* stayWit
hin = 0); |
| 73 static ElementType* nextIncludingPseudo(const Node&, const Node* stayWithin
= 0); | 71 static ElementType* nextIncludingPseudo(const Node&, const Node* stayWithin
= 0); |
| 74 static ElementType* nextIncludingPseudoSkippingChildren(const Node&, const N
ode* stayWithin = 0); | 72 static ElementType* nextIncludingPseudoSkippingChildren(const Node&, const N
ode* stayWithin = 0); |
| 75 | 73 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 template <class NodeType> | 86 template <class NodeType> |
| 89 static ElementType* firstAncestorOrSelfTemplate(NodeType&); | 87 static ElementType* firstAncestorOrSelfTemplate(NodeType&); |
| 90 template <class NodeType> | 88 template <class NodeType> |
| 91 static ElementType* firstWithinTemplate(NodeType&); | 89 static ElementType* firstWithinTemplate(NodeType&); |
| 92 template <class NodeType> | 90 template <class NodeType> |
| 93 static ElementType* lastWithinTemplate(NodeType&); | 91 static ElementType* lastWithinTemplate(NodeType&); |
| 94 template <class NodeType> | 92 template <class NodeType> |
| 95 static ElementType* nextTemplate(NodeType&); | 93 static ElementType* nextTemplate(NodeType&); |
| 96 template <class NodeType> | 94 template <class NodeType> |
| 97 static ElementType* nextTemplate(NodeType&, const Node* stayWithin); | 95 static ElementType* nextTemplate(NodeType&, const Node* stayWithin); |
| 98 template <class NodeType> | |
| 99 static ElementType* previousTemplate(NodeType&); | |
| 100 template <class NodeType> | |
| 101 static ElementType* previousTemplate(NodeType&, const Node* stayWithin); | |
| 102 }; | 96 }; |
| 103 | 97 |
| 104 typedef Traversal<Element> ElementTraversal; | 98 typedef Traversal<Element> ElementTraversal; |
| 105 | 99 |
| 106 // Specialized for pure Element to exploit the fact that Elements parent is alwa
ys either another Element or the root. | 100 // Specialized for pure Element to exploit the fact that Elements parent is alwa
ys either another Element or the root. |
| 107 template <> | 101 template <> |
| 108 template <class NodeType> | 102 template <class NodeType> |
| 109 inline Element* Traversal<Element>::firstWithinTemplate(NodeType& current) | 103 inline Element* Traversal<Element>::firstWithinTemplate(NodeType& current) |
| 110 { | 104 { |
| 111 return firstChildTemplate(current); | 105 return firstChildTemplate(current); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 template <class NodeType> | 198 template <class NodeType> |
| 205 inline ElementType* Traversal<ElementType>::nextTemplate(NodeType& current, cons
t Node* stayWithin) | 199 inline ElementType* Traversal<ElementType>::nextTemplate(NodeType& current, cons
t Node* stayWithin) |
| 206 { | 200 { |
| 207 Node* node = NodeTraversal::next(current, stayWithin); | 201 Node* node = NodeTraversal::next(current, stayWithin); |
| 208 while (node && !isElementOfType<const ElementType>(*node)) | 202 while (node && !isElementOfType<const ElementType>(*node)) |
| 209 node = NodeTraversal::next(*node, stayWithin); | 203 node = NodeTraversal::next(*node, stayWithin); |
| 210 return toElement<ElementType>(node); | 204 return toElement<ElementType>(node); |
| 211 } | 205 } |
| 212 | 206 |
| 213 template <class ElementType> | 207 template <class ElementType> |
| 214 template <class NodeType> | 208 inline ElementType* Traversal<ElementType>::previous(const Node& current) |
| 215 inline ElementType* Traversal<ElementType>::previousTemplate(NodeType& current) | |
| 216 { | 209 { |
| 217 Node* node = NodeTraversal::previous(current); | 210 Node* node = NodeTraversal::previous(current); |
| 218 while (node && !isElementOfType<const ElementType>(*node)) | 211 while (node && !isElementOfType<const ElementType>(*node)) |
| 219 node = NodeTraversal::previous(*node); | 212 node = NodeTraversal::previous(*node); |
| 220 return toElement<ElementType>(node); | 213 return toElement<ElementType>(node); |
| 221 } | 214 } |
| 222 | 215 |
| 223 template <class ElementType> | 216 template <class ElementType> |
| 224 template <class NodeType> | 217 inline ElementType* Traversal<ElementType>::previous(const Node& current, const
Node* stayWithin) |
| 225 inline ElementType* Traversal<ElementType>::previousTemplate(NodeType& current,
const Node* stayWithin) | |
| 226 { | 218 { |
| 227 Node* node = NodeTraversal::previous(current, stayWithin); | 219 Node* node = NodeTraversal::previous(current, stayWithin); |
| 228 while (node && !isElementOfType<const ElementType>(*node)) | 220 while (node && !isElementOfType<const ElementType>(*node)) |
| 229 node = NodeTraversal::previous(*node, stayWithin); | 221 node = NodeTraversal::previous(*node, stayWithin); |
| 230 return toElement<ElementType>(node); | 222 return toElement<ElementType>(node); |
| 231 } | 223 } |
| 232 | 224 |
| 233 template <class ElementType> | 225 template <class ElementType> |
| 234 inline ElementType* Traversal<ElementType>::nextSkippingChildren(const Node& cur
rent) | 226 inline ElementType* Traversal<ElementType>::nextSkippingChildren(const Node& cur
rent) |
| 235 { | 227 { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 { | 290 { |
| 299 Node* node = current.nextSibling(); | 291 Node* node = current.nextSibling(); |
| 300 while (node && !isElementOfType<const ElementType>(*node)) | 292 while (node && !isElementOfType<const ElementType>(*node)) |
| 301 node = node->nextSibling(); | 293 node = node->nextSibling(); |
| 302 return toElement<ElementType>(node); | 294 return toElement<ElementType>(node); |
| 303 } | 295 } |
| 304 | 296 |
| 305 } // namespace blink | 297 } // namespace blink |
| 306 | 298 |
| 307 #endif | 299 #endif |
| OLD | NEW |