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

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

Issue 644073002: Avoid layout when list color changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void RenderListItem::styleDidChange(StyleDifference diff, const RenderStyle* old Style) 56 void RenderListItem::styleDidChange(StyleDifference diff, const RenderStyle* old Style)
57 { 57 {
58 RenderBlockFlow::styleDidChange(diff, oldStyle); 58 RenderBlockFlow::styleDidChange(diff, oldStyle);
59 59
60 if (style()->listStyleType() != NoneListStyle 60 if (style()->listStyleType() != NoneListStyle
61 || (style()->listStyleImage() && !style()->listStyleImage()->errorOccurr ed())) { 61 || (style()->listStyleImage() && !style()->listStyleImage()->errorOccurr ed())) {
62 RefPtr<RenderStyle> newStyle = RenderStyle::create(); 62 RefPtr<RenderStyle> newStyle = RenderStyle::create();
63 // The marker always inherits from the list item, regardless of where it might end 63 // The marker always inherits from the list item, regardless of where it might end
64 // up (e.g., in some deeply nested line box). See CSS3 spec. 64 // up (e.g., in some deeply nested line box). See CSS3 spec.
65 newStyle->inheritFrom(style()); 65 newStyle->inheritFrom(style());
66 if (!m_marker) 66 if (m_marker) {
67 // Reuse the current margins otherwise resetting the margins to init ial values
mstensho (USE GERRIT) 2014/10/14 19:06:03 I don't think RenderListItem should have to know t
Xianzhu 2014/10/14 19:33:59 Good catch! Though set{margin-left, margin-right}
68 // would trigger unnecessary layout.
69 newStyle->setMarginLeft(m_marker->style()->marginLeft());
70 newStyle->setMarginRight(m_marker->style()->marginRight());
71 } else {
67 m_marker = RenderListMarker::createAnonymous(this); 72 m_marker = RenderListMarker::createAnonymous(this);
73 }
74
68 m_marker->setStyle(newStyle.release()); 75 m_marker->setStyle(newStyle.release());
69 } else if (m_marker) { 76 } else if (m_marker) {
70 m_marker->destroy(); 77 m_marker->destroy();
71 m_marker = nullptr; 78 m_marker = nullptr;
72 } 79 }
73 } 80 }
74 81
75 void RenderListItem::willBeDestroyed() 82 void RenderListItem::willBeDestroyed()
76 { 83 {
77 if (m_marker) { 84 if (m_marker) {
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // assume that all the following ones have too. 529 // assume that all the following ones have too.
523 // This gives us the opportunity to stop here and avoid 530 // This gives us the opportunity to stop here and avoid
524 // marking the same nodes again. 531 // marking the same nodes again.
525 break; 532 break;
526 } 533 }
527 item->updateValue(); 534 item->updateValue();
528 } 535 }
529 } 536 }
530 537
531 } // namespace blink 538 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698