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/rendering/TextPainter.h" | 6 #include "core/rendering/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/rendering/InlineTextBox.h" | 10 #include "core/rendering/InlineTextBox.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 if (textStyle.strokeColor != context->strokeColor()) | 89 if (textStyle.strokeColor != context->strokeColor()) |
90 context->setStrokeColor(textStyle.strokeColor); | 90 context->setStrokeColor(textStyle.strokeColor); |
91 if (textStyle.strokeWidth != context->strokeThickness()) | 91 if (textStyle.strokeWidth != context->strokeThickness()) |
92 context->setStrokeThickness(textStyle.strokeWidth); | 92 context->setStrokeThickness(textStyle.strokeWidth); |
93 } | 93 } |
94 | 94 |
95 // Text shadows are disabled when printing. http://crbug.com/258321 | 95 // Text shadows are disabled when printing. http://crbug.com/258321 |
96 if (textStyle.shadow && !context->printing()) { | 96 if (textStyle.shadow && !context->printing()) { |
97 if (!stateSaver.saved()) | 97 if (!stateSaver.saved()) |
98 stateSaver.save(); | 98 stateSaver.save(); |
99 context->clearShadow(); | |
Stephen White
2014/10/23 19:08:48
Same here.
sugoi1
2014/10/23 20:25:14
Done.
| |
99 context->setDrawLooper(textStyle.shadow->createDrawLooper(DrawLooperBuil der::ShadowIgnoresAlpha, horizontal)); | 100 context->setDrawLooper(textStyle.shadow->createDrawLooper(DrawLooperBuil der::ShadowIgnoresAlpha, horizontal)); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 static Color textColorForWhiteBackground(Color textColor) | 104 static Color textColorForWhiteBackground(Color textColor) |
104 { | 105 { |
105 int distanceFromWhite = differenceSquared(textColor, Color::white); | 106 int distanceFromWhite = differenceSquared(textColor, Color::white); |
106 // semi-arbitrarily chose 65025 (255^2) value here after a few tests; | 107 // semi-arbitrarily chose 65025 (255^2) value here after a few tests; |
107 return distanceFromWhite > 65025 ? textColor : textColor.dark(); | 108 return distanceFromWhite > 65025 ? textColor : textColor.dark(); |
108 } | 109 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 DEFINE_STATIC_LOCAL(TextRun, placeholderTextRun, (&ideographicFullStop, 1)); | 210 DEFINE_STATIC_LOCAL(TextRun, placeholderTextRun, (&ideographicFullStop, 1)); |
210 FloatPoint emphasisMarkTextOrigin(m_textBounds.x(), m_textBounds.y() + m_fon t.fontMetrics().ascent() + m_emphasisMarkOffset); | 211 FloatPoint emphasisMarkTextOrigin(m_textBounds.x(), m_textBounds.y() + m_fon t.fontMetrics().ascent() + m_emphasisMarkOffset); |
211 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); | 212 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); |
212 textRunPaintInfo.bounds = m_textBounds; | 213 textRunPaintInfo.bounds = m_textBounds; |
213 m_graphicsContext->concatCTM(InlineTextBox::rotation(m_textBounds, InlineTex tBox::Clockwise)); | 214 m_graphicsContext->concatCTM(InlineTextBox::rotation(m_textBounds, InlineTex tBox::Clockwise)); |
214 m_graphicsContext->drawEmphasisMarks(m_combinedText->originalFont(), textRun PaintInfo, m_emphasisMark, emphasisMarkTextOrigin); | 215 m_graphicsContext->drawEmphasisMarks(m_combinedText->originalFont(), textRun PaintInfo, m_emphasisMark, emphasisMarkTextOrigin); |
215 m_graphicsContext->concatCTM(InlineTextBox::rotation(m_textBounds, InlineTex tBox::Counterclockwise)); | 216 m_graphicsContext->concatCTM(InlineTextBox::rotation(m_textBounds, InlineTex tBox::Counterclockwise)); |
216 } | 217 } |
217 | 218 |
218 } // namespace blink | 219 } // namespace blink |
OLD | NEW |