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

Side by Side Diff: third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp

Issue 2027653004: Adjust color for printing list-item markers as we do for text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fixes Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/ListMarkerPainter.h" 5 #include "core/paint/ListMarkerPainter.h"
6 6
7 #include "core/layout/LayoutListItem.h" 7 #include "core/layout/LayoutListItem.h"
8 #include "core/layout/LayoutListMarker.h" 8 #include "core/layout/LayoutListMarker.h"
9 #include "core/layout/ListMarkerText.h" 9 #include "core/layout/ListMarkerText.h"
10 #include "core/layout/api/SelectionState.h" 10 #include "core/layout/api/SelectionState.h"
11 #include "core/paint/BoxPainter.h"
11 #include "core/paint/LayoutObjectDrawingRecorder.h" 12 #include "core/paint/LayoutObjectDrawingRecorder.h"
12 #include "core/paint/PaintInfo.h" 13 #include "core/paint/PaintInfo.h"
14 #include "core/paint/TextPainter.h"
13 #include "platform/geometry/LayoutPoint.h" 15 #include "platform/geometry/LayoutPoint.h"
14 #include "platform/graphics/GraphicsContextStateSaver.h" 16 #include "platform/graphics/GraphicsContextStateSaver.h"
15 17
16 namespace blink { 18 namespace blink {
17 19
18 static inline void paintSymbol(GraphicsContext& context, const Color& color, 20 static inline void paintSymbol(GraphicsContext& context, const Color& color,
19 const IntRect& marker, EListStyleType listStyle) 21 const IntRect& marker, EListStyleType listStyle)
20 { 22 {
21 context.setStrokeColor(color); 23 context.setStrokeColor(color);
22 context.setStrokeStyle(SolidStroke); 24 context.setStrokeStyle(SolidStroke);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 selRect.moveBy(boxOrigin); 75 selRect.moveBy(boxOrigin);
74 context.fillRect(pixelSnappedIntRect(selRect), m_layoutListMarker.li stItem()->selectionBackgroundColor()); 76 context.fillRect(pixelSnappedIntRect(selRect), m_layoutListMarker.li stItem()->selectionBackgroundColor());
75 } 77 }
76 return; 78 return;
77 } 79 }
78 80
79 LayoutListMarker::ListStyleCategory styleCategory = m_layoutListMarker.getLi stStyleCategory(); 81 LayoutListMarker::ListStyleCategory styleCategory = m_layoutListMarker.getLi stStyleCategory();
80 if (styleCategory == LayoutListMarker::ListStyleCategory::None) 82 if (styleCategory == LayoutListMarker::ListStyleCategory::None)
81 return; 83 return;
82 84
83 const Color color(m_layoutListMarker.resolveColor(CSSPropertyColor)); 85 Color color(m_layoutListMarker.resolveColor(CSSPropertyColor));
86
87 if (BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(m_layoutListMarker .styleRef(), m_layoutListMarker.listItem()->document()))
fs 2016/06/01 08:50:10 (I guess this could just be m_layoutListMarker.doc
rune 2016/06/01 09:43:31 They are currently always anonymous, so LayoutObje
fs 2016/06/01 10:22:59 Yes.
88 color = TextPainter::textColorForWhiteBackground(color);
89
84 // Apply the color to the list marker text. 90 // Apply the color to the list marker text.
85 context.setFillColor(color); 91 context.setFillColor(color);
86 92
87 const EListStyleType listStyle = m_layoutListMarker.style()->listStyleType() ; 93 const EListStyleType listStyle = m_layoutListMarker.style()->listStyleType() ;
88 if (styleCategory == LayoutListMarker::ListStyleCategory::Symbol) { 94 if (styleCategory == LayoutListMarker::ListStyleCategory::Symbol) {
89 paintSymbol(context, color, marker, listStyle); 95 paintSymbol(context, color, marker, listStyle);
90 return; 96 return;
91 } 97 }
92 98
93 if (m_layoutListMarker.text().isEmpty()) 99 if (m_layoutListMarker.text().isEmpty())
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (m_layoutListMarker.style()->isLeftToRightDirection()) { 139 if (m_layoutListMarker.style()->isLeftToRightDirection()) {
134 context.drawText(font, textRunPaintInfo, textOrigin); 140 context.drawText(font, textRunPaintInfo, textOrigin);
135 context.drawText(font, suffixRunInfo, textOrigin + IntSize(font.width(te xtRun), 0)); 141 context.drawText(font, suffixRunInfo, textOrigin + IntSize(font.width(te xtRun), 0));
136 } else { 142 } else {
137 context.drawText(font, suffixRunInfo, textOrigin); 143 context.drawText(font, suffixRunInfo, textOrigin);
138 context.drawText(font, textRunPaintInfo, textOrigin + IntSize(font.width (suffixRun), 0)); 144 context.drawText(font, textRunPaintInfo, textOrigin + IntSize(font.width (suffixRun), 0));
139 } 145 }
140 } 146 }
141 147
142 } // namespace blink 148 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698