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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return next; | 67 return next; |
68 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod
e()) { | 68 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod
e()) { |
69 if (parent == stayWithin) | 69 if (parent == stayWithin) |
70 return 0; | 70 return 0; |
71 if (Node* next = parent->pseudoAwareNextSibling()) | 71 if (Node* next = parent->pseudoAwareNextSibling()) |
72 return next; | 72 return next; |
73 } | 73 } |
74 return 0; | 74 return 0; |
75 } | 75 } |
76 | 76 |
| 77 Node* nextAncestorSibling(const Node& current) |
| 78 { |
| 79 ASSERT(!current.nextSibling()); |
| 80 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod
e()) { |
| 81 if (parent->nextSibling()) |
| 82 return parent->nextSibling(); |
| 83 } |
| 84 return 0; |
| 85 } |
| 86 |
| 87 Node* nextAncestorSibling(const Node& current, const Node* stayWithin) |
| 88 { |
| 89 ASSERT(!current.nextSibling()); |
| 90 ASSERT(current != stayWithin); |
| 91 for (Node* parent = current.parentNode(); parent; parent = parent->parentNod
e()) { |
| 92 if (parent == stayWithin) |
| 93 return 0; |
| 94 if (parent->nextSibling()) |
| 95 return parent->nextSibling(); |
| 96 } |
| 97 return 0; |
| 98 } |
| 99 |
77 Node* previous(const Node& current, const Node* stayWithin) | 100 Node* previous(const Node& current, const Node* stayWithin) |
78 { | 101 { |
79 if (current == stayWithin) | 102 if (current == stayWithin) |
80 return 0; | 103 return 0; |
81 if (current.previousSibling()) { | 104 if (current.previousSibling()) { |
82 Node* previous = current.previousSibling(); | 105 Node* previous = current.previousSibling(); |
83 while (previous->lastChild()) | 106 while (previous->lastChild()) |
84 previous = previous->lastChild(); | 107 previous = previous->lastChild(); |
85 return previous; | 108 return previous; |
86 } | 109 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 return current.lastChild(); | 155 return current.lastChild(); |
133 if (current == stayWithin) | 156 if (current == stayWithin) |
134 return 0; | 157 return 0; |
135 if (current.previousSibling()) | 158 if (current.previousSibling()) |
136 return current.previousSibling(); | 159 return current.previousSibling(); |
137 return previousAncestorSiblingPostOrder(current, stayWithin); | 160 return previousAncestorSiblingPostOrder(current, stayWithin); |
138 } | 161 } |
139 | 162 |
140 } | 163 } |
141 } | 164 } |
OLD | NEW |