OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/TextPainter.h" | 6 #include "core/paint/TextPainter.h" |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 if (mode & TextModeFill && textStyle.fillColor != context->fillColor()) | 93 if (mode & TextModeFill && textStyle.fillColor != context->fillColor()) |
94 context->setFillColor(textStyle.fillColor); | 94 context->setFillColor(textStyle.fillColor); |
95 | 95 |
96 if (mode & TextModeStroke) { | 96 if (mode & TextModeStroke) { |
97 if (textStyle.strokeColor != context->strokeColor()) | 97 if (textStyle.strokeColor != context->strokeColor()) |
98 context->setStrokeColor(textStyle.strokeColor); | 98 context->setStrokeColor(textStyle.strokeColor); |
99 if (textStyle.strokeWidth != context->strokeThickness()) | 99 if (textStyle.strokeWidth != context->strokeThickness()) |
100 context->setStrokeThickness(textStyle.strokeWidth); | 100 context->setStrokeThickness(textStyle.strokeWidth); |
101 } | 101 } |
102 | 102 |
103 // Text shadows are disabled when printing. http://crbug.com/258321 | 103 if (textStyle.shadow) { |
104 if (textStyle.shadow && !context->printing()) { | |
105 if (!stateSaver.saved()) | 104 if (!stateSaver.saved()) |
106 stateSaver.save(); | 105 stateSaver.save(); |
107 context->setDrawLooper(textStyle.shadow->createDrawLooper(DrawLooperBuil
der::ShadowIgnoresAlpha, textStyle.currentColor, horizontal)); | 106 context->setDrawLooper(textStyle.shadow->createDrawLooper(DrawLooperBuil
der::ShadowIgnoresAlpha, textStyle.currentColor, horizontal)); |
108 } | 107 } |
109 } | 108 } |
110 | 109 |
111 static Color textColorForWhiteBackground(Color textColor) | 110 static Color textColorForWhiteBackground(Color textColor) |
112 { | 111 { |
113 int distanceFromWhite = differenceSquared(textColor, Color::white); | 112 int distanceFromWhite = differenceSquared(textColor, Color::white); |
114 // semi-arbitrarily chose 65025 (255^2) value here after a few tests; | 113 // semi-arbitrarily chose 65025 (255^2) value here after a few tests; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 DEFINE_STATIC_LOCAL(TextRun, placeholderTextRun, (&ideographicFullStopCharac
ter, 1)); | 217 DEFINE_STATIC_LOCAL(TextRun, placeholderTextRun, (&ideographicFullStopCharac
ter, 1)); |
219 FloatPoint emphasisMarkTextOrigin(m_textBounds.x().toFloat(), m_textBounds.y
().toFloat() + m_font.fontMetrics().ascent() + m_emphasisMarkOffset); | 218 FloatPoint emphasisMarkTextOrigin(m_textBounds.x().toFloat(), m_textBounds.y
().toFloat() + m_font.fontMetrics().ascent() + m_emphasisMarkOffset); |
220 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); | 219 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); |
221 textRunPaintInfo.bounds = m_textBounds; | 220 textRunPaintInfo.bounds = m_textBounds; |
222 m_graphicsContext->concatCTM(rotation(m_textBounds, Clockwise)); | 221 m_graphicsContext->concatCTM(rotation(m_textBounds, Clockwise)); |
223 m_graphicsContext->drawEmphasisMarks(m_combinedText->originalFont(), textRun
PaintInfo, m_emphasisMark, emphasisMarkTextOrigin); | 222 m_graphicsContext->drawEmphasisMarks(m_combinedText->originalFont(), textRun
PaintInfo, m_emphasisMark, emphasisMarkTextOrigin); |
224 m_graphicsContext->concatCTM(rotation(m_textBounds, Counterclockwise)); | 223 m_graphicsContext->concatCTM(rotation(m_textBounds, Counterclockwise)); |
225 } | 224 } |
226 | 225 |
227 } // namespace blink | 226 } // namespace blink |
OLD | NEW |