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

Side by Side Diff: Source/core/rendering/RenderListItem.cpp

Issue 69003004: Have NodeTraversal::previous*() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « Source/core/rendering/RenderCounter.cpp ('k') | Source/core/xml/XPathStep.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 current = ElementTraversal::nextIncludingPseudo(current, listNode); 143 current = ElementTraversal::nextIncludingPseudo(current, listNode);
144 } 144 }
145 145
146 return 0; 146 return 0;
147 } 147 }
148 148
149 // Returns the previous list item with respect to the DOM order. 149 // Returns the previous list item with respect to the DOM order.
150 static RenderListItem* previousListItem(const Node* listNode, const RenderListIt em* item) 150 static RenderListItem* previousListItem(const Node* listNode, const RenderListIt em* item)
151 { 151 {
152 Node* current = item->node(); 152 Node* current = item->node();
153 for (current = ElementTraversal::previousIncludingPseudo(current, listNode); current; current = ElementTraversal::previousIncludingPseudo(current, listNode) ) { 153 ASSERT(current);
154 for (current = ElementTraversal::previousIncludingPseudo(*current, listNode) ; current; current = ElementTraversal::previousIncludingPseudo(*current, listNod e)) {
154 RenderObject* renderer = current->renderer(); 155 RenderObject* renderer = current->renderer();
155 if (!renderer || (renderer && !renderer->isListItem())) 156 if (!renderer || (renderer && !renderer->isListItem()))
156 continue; 157 continue;
157 Node* otherList = enclosingList(toRenderListItem(renderer)); 158 Node* otherList = enclosingList(toRenderListItem(renderer));
158 // This item is part of our current list, so it's what we're looking for . 159 // This item is part of our current list, so it's what we're looking for .
159 if (listNode == otherList) 160 if (listNode == otherList)
160 return toRenderListItem(renderer); 161 return toRenderListItem(renderer);
161 // We found ourself inside another list; lets skip the rest of it. 162 // We found ourself inside another list; lets skip the rest of it.
162 // Use nextIncludingPseudo() here because the other list itself may actu ally 163 // Use nextIncludingPseudo() here because the other list itself may actu ally
163 // be a list item itself. We need to examine it, so we do this to counte ract 164 // be a list item itself. We need to examine it, so we do this to counte ract
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // assume that all the following ones have too. 516 // assume that all the following ones have too.
516 // This gives us the opportunity to stop here and avoid 517 // This gives us the opportunity to stop here and avoid
517 // marking the same nodes again. 518 // marking the same nodes again.
518 break; 519 break;
519 } 520 }
520 item->updateValue(); 521 item->updateValue();
521 } 522 }
522 } 523 }
523 524
524 } // namespace WebCore 525 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderCounter.cpp ('k') | Source/core/xml/XPathStep.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698