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 "platform/graphics/paint/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.h" |
7 | 7 |
8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
9 #include "core/layout/LayoutText.h" | 9 #include "core/layout/LayoutText.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 DisplayItemListPaintTest() | 28 DisplayItemListPaintTest() |
29 : m_layoutView(nullptr) | 29 : m_layoutView(nullptr) |
30 , m_originalSlimmingPaintEnabled(RuntimeEnabledFeatures::slimmingPaintEn
abled()) { } | 30 , m_originalSlimmingPaintEnabled(RuntimeEnabledFeatures::slimmingPaintEn
abled()) { } |
31 | 31 |
32 protected: | 32 protected: |
33 LayoutView& layoutView() { return *m_layoutView; } | 33 LayoutView& layoutView() { return *m_layoutView; } |
34 DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graph
icsLayerBacking()->displayItemList(); } | 34 DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graph
icsLayerBacking()->displayItemList(); } |
35 const DisplayItems& newPaintListBeforeUpdate() { return rootDisplayItemList(
).m_newDisplayItems; } | 35 const DisplayItems& newPaintListBeforeUpdate() { return rootDisplayItemList(
).m_newDisplayItems; } |
36 | 36 |
37 private: | 37 private: |
38 virtual void SetUp() override | 38 void SetUp() override |
39 { | 39 { |
40 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); | 40 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); |
41 | 41 |
42 RenderingTest::SetUp(); | 42 RenderingTest::SetUp(); |
43 enableCompositing(); | 43 enableCompositing(); |
44 | 44 |
45 m_layoutView = document().view()->layoutView(); | 45 m_layoutView = document().view()->layoutView(); |
46 ASSERT_TRUE(m_layoutView); | 46 ASSERT_TRUE(m_layoutView); |
47 } | 47 } |
48 | 48 |
49 virtual void TearDown() override | 49 void TearDown() override |
50 { | 50 { |
51 RuntimeEnabledFeatures::setSlimmingPaintEnabled(m_originalSlimmingPaintE
nabled); | 51 RuntimeEnabledFeatures::setSlimmingPaintEnabled(m_originalSlimmingPaintE
nabled); |
52 } | 52 } |
53 | 53 |
54 LayoutView* m_layoutView; | 54 LayoutView* m_layoutView; |
55 bool m_originalSlimmingPaintEnabled; | 55 bool m_originalSlimmingPaintEnabled; |
56 }; | 56 }; |
57 | 57 |
58 class TestDisplayItem : public DisplayItem { | 58 class TestDisplayItem : public DisplayItem { |
59 public: | 59 public: |
60 TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : Display
Item(client, type) { } | 60 TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : Display
Item(client, type) { } |
61 | 61 |
62 virtual void replay(GraphicsContext&) override final { ASSERT_NOT_REACHED();
} | 62 void replay(GraphicsContext&) final { ASSERT_NOT_REACHED(); } |
63 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override
final { ASSERT_NOT_REACHED(); } | 63 void appendToWebDisplayItemList(WebDisplayItemList*) const final { ASSERT_NO
T_REACHED(); } |
64 }; | 64 }; |
65 | 65 |
66 #ifndef NDEBUG | 66 #ifndef NDEBUG |
67 #define TRACE_DISPLAY_ITEMS(i, expected, actual) \ | 67 #define TRACE_DISPLAY_ITEMS(i, expected, actual) \ |
68 String trace = String::format("%d: ", (int)i) + "Expected: " + (expected).as
DebugString() + " Actual: " + (actual).asDebugString(); \ | 68 String trace = String::format("%d: ", (int)i) + "Expected: " + (expected).as
DebugString() + " Actual: " + (actual).asDebugString(); \ |
69 SCOPED_TRACE(trace.utf8().data()); | 69 SCOPED_TRACE(trace.utf8().data()); |
70 #else | 70 #else |
71 #define TRACE_DISPLAY_ITEMS(i, expected, actual) | 71 #define TRACE_DISPLAY_ITEMS(i, expected, actual) |
72 #endif | 72 #endif |
73 | 73 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); | 150 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); |
151 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); | 151 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); |
152 | 152 |
153 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, | 153 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, |
154 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | 154 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
155 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), | 155 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), |
156 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); | 156 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); |
157 } | 157 } |
158 | 158 |
159 } // namespace blink | 159 } // namespace blink |
OLD | NEW |