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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual void replay(GraphicsContext&) override final { ASSERT_NOT_REACHED();
} |
63 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override
final { ASSERT_NOT_REACHED(); } | 63 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override
final { ASSERT_NOT_REACHED(); } |
| 64 |
| 65 void appendByMoving(DisplayItems& destination) override |
| 66 { |
| 67 destination.emplaceBack<TestDisplayItem>( |
| 68 DisplayItemClientWrapperHelper(*this), type()); |
| 69 } |
64 }; | 70 }; |
65 | 71 |
66 #ifndef NDEBUG | 72 #ifndef NDEBUG |
67 #define TRACE_DISPLAY_ITEMS(i, expected, actual) \ | 73 #define TRACE_DISPLAY_ITEMS(i, expected, actual) \ |
68 String trace = String::format("%d: ", (int)i) + "Expected: " + (expected).as
DebugString() + " Actual: " + (actual).asDebugString(); \ | 74 String trace = String::format("%d: ", (int)i) + "Expected: " + (expected).as
DebugString() + " Actual: " + (actual).asDebugString(); \ |
69 SCOPED_TRACE(trace.utf8().data()); | 75 SCOPED_TRACE(trace.utf8().data()); |
70 #else | 76 #else |
71 #define TRACE_DISPLAY_ITEMS(i, expected, actual) | 77 #define TRACE_DISPLAY_ITEMS(i, expected, actual) |
72 #endif | 78 #endif |
73 | 79 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); | 156 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); |
151 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); | 157 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); |
152 | 158 |
153 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, | 159 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, |
154 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | 160 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
155 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), | 161 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), |
156 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); | 162 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); |
157 } | 163 } |
158 | 164 |
159 } // namespace blink | 165 } // namespace blink |
OLD | NEW |