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

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

Issue 1405693002: LayoutListItem: shorten refs, use nullptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutListItem.h ('k') | no next file » | 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 setInline(false); 47 setInline(false);
48 48
49 setConsumesSubtreeChangeNotification(); 49 setConsumesSubtreeChangeNotification();
50 registerSubtreeChangeListenerOnDescendants(true); 50 registerSubtreeChangeListenerOnDescendants(true);
51 } 51 }
52 52
53 void LayoutListItem::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle) 53 void LayoutListItem::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle)
54 { 54 {
55 LayoutBlockFlow::styleDidChange(diff, oldStyle); 55 LayoutBlockFlow::styleDidChange(diff, oldStyle);
56 56
57 StyleImage* currentImage = style()->listStyleImage();
eae 2015/10/14 10:52:18 const?
57 if (style()->listStyleType() != NoneListStyle 58 if (style()->listStyleType() != NoneListStyle
58 || (style()->listStyleImage() && !style()->listStyleImage()->errorOccurr ed())) { 59 || (currentImage && !currentImage->errorOccurred())) {
59 if (!m_marker) 60 if (!m_marker)
60 m_marker = LayoutListMarker::createAnonymous(this); 61 m_marker = LayoutListMarker::createAnonymous(this);
61 m_marker->listItemStyleDidChange(); 62 m_marker->listItemStyleDidChange();
62 notifyOfSubtreeChange(); 63 notifyOfSubtreeChange();
63 } else if (m_marker) { 64 } else if (m_marker) {
64 m_marker->destroy(); 65 m_marker->destroy();
65 m_marker = nullptr; 66 m_marker = nullptr;
66 } 67 }
67 68
68 StyleImage* oldImage = oldStyle ? oldStyle->listStyleImage() : nullptr; 69 StyleImage* oldImage = oldStyle ? oldStyle->listStyleImage() : nullptr;
69 if (oldImage != style()->listStyleImage()) { 70 if (oldImage != currentImage) {
70 if (oldImage) 71 if (oldImage)
71 oldImage->removeClient(this); 72 oldImage->removeClient(this);
72 if (style()->listStyleImage()) 73 if (currentImage)
73 style()->listStyleImage()->addClient(this); 74 currentImage->addClient(this);
74 } 75 }
75 } 76 }
76 77
77 void LayoutListItem::willBeDestroyed() 78 void LayoutListItem::willBeDestroyed()
78 { 79 {
79 if (m_marker) { 80 if (m_marker) {
80 m_marker->destroy(); 81 m_marker->destroy();
81 m_marker = nullptr; 82 m_marker = nullptr;
82 } 83 }
83 84
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 213
213 return itemCount; 214 return itemCount;
214 } 215 }
215 216
216 inline int LayoutListItem::calcValue() const 217 inline int LayoutListItem::calcValue() const
217 { 218 {
218 if (m_hasExplicitValue) 219 if (m_hasExplicitValue)
219 return m_explicitValue; 220 return m_explicitValue;
220 221
221 Node* list = enclosingList(this); 222 Node* list = enclosingList(this);
222 HTMLOListElement* oListElement = isHTMLOListElement(list) ? toHTMLOListEleme nt(list) : 0; 223 HTMLOListElement* oListElement = isHTMLOListElement(list) ? toHTMLOListEleme nt(list) : nullptr;
223 int valueStep = 1; 224 int valueStep = 1;
224 if (oListElement && oListElement->isReversed()) 225 if (oListElement && oListElement->isReversed())
225 valueStep = -1; 226 valueStep = -1;
226 227
227 // FIXME: This recurses to a possible depth of the length of the list. 228 // FIXME: This recurses to a possible depth of the length of the list.
228 // That's not good -- we need to change this to an iterative algorithm. 229 // That's not good -- we need to change this to an iterative algorithm.
229 if (LayoutListItem* previousItem = previousListItem(list, this)) 230 if (LayoutListItem* previousItem = previousListItem(list, this))
230 return previousItem->value() + valueStep; 231 return previousItem->value() + valueStep;
231 232
232 if (oListElement) 233 if (oListElement)
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 // assume that all the following ones have too. 509 // assume that all the following ones have too.
509 // This gives us the opportunity to stop here and avoid 510 // This gives us the opportunity to stop here and avoid
510 // marking the same nodes again. 511 // marking the same nodes again.
511 break; 512 break;
512 } 513 }
513 item->updateValue(); 514 item->updateValue();
514 } 515 }
515 } 516 }
516 517
517 } // namespace blink 518 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutListItem.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698