| 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 "core/paint/TextPainter.h" | 5 #include "core/paint/TextPainter.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/CSSValueKeywords.h" | 8 #include "core/CSSValueKeywords.h" |
| 9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 lineLayoutText(), lineLayoutText().styleRef(), createPaintInfo(false /*
usesTextAsClip */, false /* isPrinting */)); | 77 lineLayoutText(), lineLayoutText().styleRef(), createPaintInfo(false /*
usesTextAsClip */, false /* isPrinting */)); |
| 78 EXPECT_EQ(Color(255, 0, 0), textStyle.fillColor); | 78 EXPECT_EQ(Color(255, 0, 0), textStyle.fillColor); |
| 79 EXPECT_EQ(Color(0, 255, 0), textStyle.strokeColor); | 79 EXPECT_EQ(Color(0, 255, 0), textStyle.strokeColor); |
| 80 EXPECT_EQ(Color(0, 0, 255), textStyle.emphasisMarkColor); | 80 EXPECT_EQ(Color(0, 0, 255), textStyle.emphasisMarkColor); |
| 81 EXPECT_EQ(4, textStyle.strokeWidth); | 81 EXPECT_EQ(4, textStyle.strokeWidth); |
| 82 ASSERT_NE(nullptr, textStyle.shadow); | 82 ASSERT_NE(nullptr, textStyle.shadow); |
| 83 EXPECT_EQ(1u, textStyle.shadow->shadows().size()); | 83 EXPECT_EQ(1u, textStyle.shadow->shadows().size()); |
| 84 EXPECT_EQ(1, textStyle.shadow->shadows()[0].x()); | 84 EXPECT_EQ(1, textStyle.shadow->shadows()[0].x()); |
| 85 EXPECT_EQ(2, textStyle.shadow->shadows()[0].y()); | 85 EXPECT_EQ(2, textStyle.shadow->shadows()[0].y()); |
| 86 EXPECT_EQ(3, textStyle.shadow->shadows()[0].blur()); | 86 EXPECT_EQ(3, textStyle.shadow->shadows()[0].blur()); |
| 87 EXPECT_EQ(Color(255, 255, 0), textStyle.shadow->shadows()[0].color().color()
); | 87 EXPECT_EQ(Color(255, 255, 0), textStyle.shadow->shadows()[0].color().getColo
r()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 TEST_F(TextPainterTest, TextPaintingStyle_UsesTextAsClip) | 90 TEST_F(TextPainterTest, TextPaintingStyle_UsesTextAsClip) |
| 91 { | 91 { |
| 92 document().body()->setInlineStyleProperty(CSSPropertyWebkitTextFillColor, CS
SValueRed); | 92 document().body()->setInlineStyleProperty(CSSPropertyWebkitTextFillColor, CS
SValueRed); |
| 93 document().body()->setInlineStyleProperty(CSSPropertyWebkitTextStrokeColor,
CSSValueLime); | 93 document().body()->setInlineStyleProperty(CSSPropertyWebkitTextStrokeColor,
CSSValueLime); |
| 94 document().body()->setInlineStyleProperty(CSSPropertyWebkitTextEmphasisColor
, CSSValueBlue); | 94 document().body()->setInlineStyleProperty(CSSPropertyWebkitTextEmphasisColor
, CSSValueBlue); |
| 95 document().body()->setInlineStyleProperty(CSSPropertyWebkitTextStrokeWidth,
4, CSSPrimitiveValue::UnitType::Pixels); | 95 document().body()->setInlineStyleProperty(CSSPropertyWebkitTextStrokeWidth,
4, CSSPrimitiveValue::UnitType::Pixels); |
| 96 document().body()->setInlineStyleProperty(CSSPropertyTextShadow, "1px 2px 3p
x yellow"); | 96 document().body()->setInlineStyleProperty(CSSPropertyTextShadow, "1px 2px 3p
x yellow"); |
| 97 document().view()->updateAllLifecyclePhases(); | 97 document().view()->updateAllLifecyclePhases(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 TextPainter::Style textStyle = TextPainter::textPaintingStyle( | 135 TextPainter::Style textStyle = TextPainter::textPaintingStyle( |
| 136 lineLayoutText(), lineLayoutText().styleRef(), createPaintInfo(false /*
usesTextAsClip */, true /* isPrinting */)); | 136 lineLayoutText(), lineLayoutText().styleRef(), createPaintInfo(false /*
usesTextAsClip */, true /* isPrinting */)); |
| 137 EXPECT_EQ(Color(255, 220, 220).dark(), textStyle.fillColor); | 137 EXPECT_EQ(Color(255, 220, 220).dark(), textStyle.fillColor); |
| 138 EXPECT_EQ(Color(220, 255, 220).dark(), textStyle.strokeColor); | 138 EXPECT_EQ(Color(220, 255, 220).dark(), textStyle.strokeColor); |
| 139 EXPECT_EQ(Color(220, 220, 255).dark(), textStyle.emphasisMarkColor); | 139 EXPECT_EQ(Color(220, 220, 255).dark(), textStyle.emphasisMarkColor); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace | 142 } // namespace |
| 143 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |