Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(); | |
| 57 if (style()->listStyleType() != NoneListStyle | 58 if (style()->listStyleType() != NoneListStyle |
| 58 || (style()->listStyleImage() && !style()->listStyleImage()->errorOccurr ed())) { | 59 || (currentImage && !currentImage->errorOccurred())) { |
|
wkorman
2015/10/14 01:55:30
codereview UI isn't showing your comment in-line h
| |
| 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(); |
|
eae
2015/10/12 06:02:01
Can this cause style()->listStyleImage() to change
| |
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |