| 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 14 matching lines...) Expand all Loading... |
| 25 : m_layoutText(nullptr) | 25 : m_layoutText(nullptr) |
| 26 , m_paintController(PaintController::create()) | 26 , m_paintController(PaintController::create()) |
| 27 , m_context(*m_paintController) | 27 , m_context(*m_paintController) |
| 28 { } | 28 { } |
| 29 | 29 |
| 30 protected: | 30 protected: |
| 31 LayoutText* layoutText() { return m_layoutText; } | 31 LayoutText* layoutText() { return m_layoutText; } |
| 32 | 32 |
| 33 PaintInfo createPaintInfo(bool usesTextAsClip, bool isPrinting) | 33 PaintInfo createPaintInfo(bool usesTextAsClip, bool isPrinting) |
| 34 { | 34 { |
| 35 return PaintInfo(m_context, IntRect(), usesTextAsClip ? PaintPhaseTextCl
ip : PaintPhaseSelfBlockBackground, isPrinting ? GlobalPaintPrinting : GlobalPai
ntNormalPhase, 0); | 35 return PaintInfo(m_context, IntRect(), usesTextAsClip ? PaintPhaseTextCl
ip : PaintPhaseSelfBlockBackgroundOnly, isPrinting ? GlobalPaintPrinting : Globa
lPaintNormalPhase, 0); |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 void SetUp() override | 39 void SetUp() override |
| 40 { | 40 { |
| 41 RenderingTest::SetUp(); | 41 RenderingTest::SetUp(); |
| 42 setBodyInnerHTML("Hello world"); | 42 setBodyInnerHTML("Hello world"); |
| 43 m_layoutText = toLayoutText(document().body()->firstChild()->layoutObjec
t()); | 43 m_layoutText = toLayoutText(document().body()->firstChild()->layoutObjec
t()); |
| 44 ASSERT_TRUE(m_layoutText); | 44 ASSERT_TRUE(m_layoutText); |
| 45 ASSERT_EQ("Hello world", m_layoutText->text()); | 45 ASSERT_EQ("Hello world", m_layoutText->text()); |
| (...skipping 88 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 *layoutText(), layoutText()->styleRef(), createPaintInfo(false /* usesTe
xtAsClip */, true /* isPrinting */)); | 136 *layoutText(), layoutText()->styleRef(), createPaintInfo(false /* usesTe
xtAsClip */, 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 |