| 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 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple 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 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 Element* nextSkippingChildren(const ContainerNode&, const Node* stayWithin); | 49 Element* nextSkippingChildren(const ContainerNode&, const Node* stayWithin); |
| 50 | 50 |
| 51 // Pre-order traversal including the pseudo-elements. | 51 // Pre-order traversal including the pseudo-elements. |
| 52 Element* previousIncludingPseudo(const Node&, const Node* stayWithin = 0); | 52 Element* previousIncludingPseudo(const Node&, const Node* stayWithin = 0); |
| 53 Element* nextIncludingPseudo(const Node&, const Node* stayWithin = 0); | 53 Element* nextIncludingPseudo(const Node&, const Node* stayWithin = 0); |
| 54 Element* nextIncludingPseudoSkippingChildren(const Node&, const Node* stayWithin
= 0); | 54 Element* nextIncludingPseudoSkippingChildren(const Node&, const Node* stayWithin
= 0); |
| 55 | 55 |
| 56 // Utility function to traverse only the element and pseudo-element siblings of
a node. | 56 // Utility function to traverse only the element and pseudo-element siblings of
a node. |
| 57 Element* pseudoAwarePreviousSibling(const Node&); | 57 Element* pseudoAwarePreviousSibling(const Node&); |
| 58 | 58 |
| 59 // Next sibling. | 59 // Previous / Next sibling. |
| 60 Element* previousSibling(const Node&); |
| 60 Element* nextSibling(const Node&); | 61 Element* nextSibling(const Node&); |
| 61 | 62 |
| 62 template <class NodeType> | 63 template <class NodeType> |
| 63 inline Element* firstElementWithinTemplate(NodeType& current) | 64 inline Element* firstElementWithinTemplate(NodeType& current) |
| 64 { | 65 { |
| 65 // Except for the root containers, only elements can have element children. | 66 // Except for the root containers, only elements can have element children. |
| 66 Node* node = current.firstChild(); | 67 Node* node = current.firstChild(); |
| 67 while (node && !node->isElementNode()) | 68 while (node && !node->isElementNode()) |
| 68 node = node->nextSibling(); | 69 node = node->nextSibling(); |
| 69 return toElement(node); | 70 return toElement(node); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 141 } |
| 141 | 142 |
| 142 inline Element* pseudoAwarePreviousSibling(const Node& current) | 143 inline Element* pseudoAwarePreviousSibling(const Node& current) |
| 143 { | 144 { |
| 144 Node* node = current.pseudoAwarePreviousSibling(); | 145 Node* node = current.pseudoAwarePreviousSibling(); |
| 145 while (node && !node->isElementNode()) | 146 while (node && !node->isElementNode()) |
| 146 node = node->pseudoAwarePreviousSibling(); | 147 node = node->pseudoAwarePreviousSibling(); |
| 147 return toElement(node); | 148 return toElement(node); |
| 148 } | 149 } |
| 149 | 150 |
| 151 inline Element* previousSibling(const Node& current) |
| 152 { |
| 153 Node* node = current.previousSibling(); |
| 154 while (node && !node->isElementNode()) |
| 155 node = node->previousSibling(); |
| 156 return toElement(node); |
| 157 } |
| 158 |
| 150 inline Element* nextSibling(const Node& current) | 159 inline Element* nextSibling(const Node& current) |
| 151 { | 160 { |
| 152 Node* node = current.nextSibling(); | 161 Node* node = current.nextSibling(); |
| 153 while (node && !node->isElementNode()) | 162 while (node && !node->isElementNode()) |
| 154 node = node->nextSibling(); | 163 node = node->nextSibling(); |
| 155 return toElement(node); | 164 return toElement(node); |
| 156 } | 165 } |
| 157 | 166 |
| 158 } | 167 } |
| 159 | 168 |
| 160 } | 169 } |
| 161 | 170 |
| 162 #endif | 171 #endif |
| OLD | NEW |