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 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 ASSERT(!current->document().childNeedsDistributionRecalc()); | 122 ASSERT(!current->document().childNeedsDistributionRecalc()); |
123 current = NodeRenderingTraversal::next(*current, listNode); | 123 current = NodeRenderingTraversal::next(*current, listNode); |
124 | 124 |
125 while (current) { | 125 while (current) { |
126 if (isList(*current)) { | 126 if (isList(*current)) { |
127 // We've found a nested, independent list: nothing to do here. | 127 // We've found a nested, independent list: nothing to do here. |
128 current = NodeRenderingTraversal::nextSkippingChildren(*current, lis
tNode); | 128 current = NodeRenderingTraversal::nextSkippingChildren(*current, lis
tNode); |
129 continue; | 129 continue; |
130 } | 130 } |
131 | 131 |
132 LayoutObject* renderer = current->renderer(); | 132 LayoutObject* renderer = current->layoutObject(); |
133 if (renderer && renderer->isListItem()) | 133 if (renderer && renderer->isListItem()) |
134 return toLayoutListItem(renderer); | 134 return toLayoutListItem(renderer); |
135 | 135 |
136 // FIXME: Can this be optimized to skip the children of the elements wit
hout a renderer? | 136 // FIXME: Can this be optimized to skip the children of the elements wit
hout a renderer? |
137 current = NodeRenderingTraversal::next(*current, listNode); | 137 current = NodeRenderingTraversal::next(*current, listNode); |
138 } | 138 } |
139 | 139 |
140 return 0; | 140 return 0; |
141 } | 141 } |
142 | 142 |
143 // Returns the previous list item with respect to the DOM order. | 143 // Returns the previous list item with respect to the DOM order. |
144 static LayoutListItem* previousListItem(const Node* listNode, const LayoutListIt
em* item) | 144 static LayoutListItem* previousListItem(const Node* listNode, const LayoutListIt
em* item) |
145 { | 145 { |
146 Node* current = item->node(); | 146 Node* current = item->node(); |
147 ASSERT(current); | 147 ASSERT(current); |
148 ASSERT(!current->document().childNeedsDistributionRecalc()); | 148 ASSERT(!current->document().childNeedsDistributionRecalc()); |
149 for (current = NodeRenderingTraversal::previous(*current, listNode); current
&& current != listNode; current = NodeRenderingTraversal::previous(*current, li
stNode)) { | 149 for (current = NodeRenderingTraversal::previous(*current, listNode); current
&& current != listNode; current = NodeRenderingTraversal::previous(*current, li
stNode)) { |
150 LayoutObject* renderer = current->renderer(); | 150 LayoutObject* renderer = current->layoutObject(); |
151 if (!renderer || (renderer && !renderer->isListItem())) | 151 if (!renderer || (renderer && !renderer->isListItem())) |
152 continue; | 152 continue; |
153 Node* otherList = enclosingList(toLayoutListItem(renderer)); | 153 Node* otherList = enclosingList(toLayoutListItem(renderer)); |
154 // This item is part of our current list, so it's what we're looking for
. | 154 // This item is part of our current list, so it's what we're looking for
. |
155 if (listNode == otherList) | 155 if (listNode == otherList) |
156 return toLayoutListItem(renderer); | 156 return toLayoutListItem(renderer); |
157 // We found ourself inside another list; lets skip the rest of it. | 157 // We found ourself inside another list; lets skip the rest of it. |
158 // Use nextIncludingPseudo() here because the other list itself may actu
ally | 158 // Use nextIncludingPseudo() here because the other list itself may actu
ally |
159 // be a list item itself. We need to examine it, so we do this to counte
ract | 159 // be a list item itself. We need to examine it, so we do this to counte
ract |
160 // the previousIncludingPseudo() that will be done by the loop. | 160 // the previousIncludingPseudo() that will be done by the loop. |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 // assume that all the following ones have too. | 514 // assume that all the following ones have too. |
515 // This gives us the opportunity to stop here and avoid | 515 // This gives us the opportunity to stop here and avoid |
516 // marking the same nodes again. | 516 // marking the same nodes again. |
517 break; | 517 break; |
518 } | 518 } |
519 item->updateValue(); | 519 item->updateValue(); |
520 } | 520 } |
521 } | 521 } |
522 | 522 |
523 } // namespace blink | 523 } // namespace blink |
OLD | NEW |