Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: Source/core/layout/LayoutListItem.cpp

Issue 1086873002: Rename NodeRenderingTraversal to LayoutTreeBuilderTraversal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // Returns the next list item with respect to the DOM order. 114 // Returns the next list item with respect to the DOM order.
115 static LayoutListItem* nextListItem(const Node* listNode, const LayoutListItem* item = 0) 115 static LayoutListItem* nextListItem(const Node* listNode, const LayoutListItem* item = 0)
116 { 116 {
117 if (!listNode) 117 if (!listNode)
118 return 0; 118 return 0;
119 119
120 const Node* current = item ? item->node() : listNode; 120 const Node* current = item ? item->node() : listNode;
121 ASSERT(current); 121 ASSERT(current);
122 ASSERT(!current->document().childNeedsDistributionRecalc()); 122 ASSERT(!current->document().childNeedsDistributionRecalc());
123 current = NodeRenderingTraversal::next(*current, listNode); 123 current = LayoutTreeBuilderTraversal::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 = LayoutTreeBuilderTraversal::nextSkippingChildren(*current, listNode);
129 continue; 129 continue;
130 } 130 }
131 131
132 LayoutObject* renderer = current->layoutObject(); 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 = LayoutTreeBuilderTraversal::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 = LayoutTreeBuilderTraversal::previous(*current, listNode); cur rent && current != listNode; current = LayoutTreeBuilderTraversal::previous(*cur rent, listNode)) {
150 LayoutObject* renderer = current->layoutObject(); 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.
161 if (otherList) 161 if (otherList)
162 current = NodeRenderingTraversal::next(*otherList, listNode); 162 current = LayoutTreeBuilderTraversal::next(*otherList, listNode);
163 } 163 }
164 return 0; 164 return 0;
165 } 165 }
166 166
167 void LayoutListItem::updateItemValuesForOrderedList(const HTMLOListElement* list Node) 167 void LayoutListItem::updateItemValuesForOrderedList(const HTMLOListElement* list Node)
168 { 168 {
169 ASSERT(listNode); 169 ASSERT(listNode);
170 170
171 for (LayoutListItem* listItem = nextListItem(listNode); listItem; listItem = nextListItem(listNode, listItem)) 171 for (LayoutListItem* listItem = nextListItem(listNode); listItem; listItem = nextListItem(listNode, listItem))
172 listItem->updateValue(); 172 listItem->updateValue();
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // assume that all the following ones have too. 528 // assume that all the following ones have too.
529 // This gives us the opportunity to stop here and avoid 529 // This gives us the opportunity to stop here and avoid
530 // marking the same nodes again. 530 // marking the same nodes again.
531 break; 531 break;
532 } 532 }
533 item->updateValue(); 533 item->updateValue();
534 } 534 }
535 } 535 }
536 536
537 } // namespace blink 537 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698