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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #define TRACE_DISPLAY_ITEMS(i, expected, actual) | 71 #define TRACE_DISPLAY_ITEMS(i, expected, actual) |
72 #endif | 72 #endif |
73 | 73 |
74 #define EXPECT_DISPLAY_LIST(actual, expectedSize, ...) \ | 74 #define EXPECT_DISPLAY_LIST(actual, expectedSize, ...) \ |
75 do { \ | 75 do { \ |
76 EXPECT_EQ((size_t)expectedSize, actual.size()); \ | 76 EXPECT_EQ((size_t)expectedSize, actual.size()); \ |
77 if (expectedSize != actual.size()) \ | 77 if (expectedSize != actual.size()) \ |
78 break; \ | 78 break; \ |
79 const TestDisplayItem expected[] = { __VA_ARGS__ }; \ | 79 const TestDisplayItem expected[] = { __VA_ARGS__ }; \ |
80 for (size_t index = 0; index < std::min<size_t>(actual.size(), expectedS
ize); index++) { \ | 80 for (size_t index = 0; index < std::min<size_t>(actual.size(), expectedS
ize); index++) { \ |
81 TRACE_DISPLAY_ITEMS(index, expected[index], actual[index]); \ | 81 TRACE_DISPLAY_ITEMS(index, expected[index], *actual.elementAt(index)
); \ |
82 EXPECT_EQ(expected[index].client(), actual[index].client()); \ | 82 EXPECT_EQ(expected[index].client(), actual.elementAt(index)->client(
)); \ |
83 EXPECT_EQ(expected[index].type(), actual[index].type()); \ | 83 EXPECT_EQ(expected[index].type(), actual.elementAt(index)->type());
\ |
84 } \ | 84 } \ |
85 } while (false); | 85 } while (false); |
86 | 86 |
87 TEST_F(DisplayItemListPaintTest, FullDocumentPaintingWithCaret) | 87 TEST_F(DisplayItemListPaintTest, FullDocumentPaintingWithCaret) |
88 { | 88 { |
89 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); | 89 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); |
90 document().page()->focusController().setActive(true); | 90 document().page()->focusController().setActive(true); |
91 document().page()->focusController().setFocused(true); | 91 document().page()->focusController().setFocused(true); |
92 LayoutView& layoutView = *document().layoutView(); | 92 LayoutView& layoutView = *document().layoutView(); |
93 DeprecatedPaintLayer& rootLayer = *layoutView.layer(); | 93 DeprecatedPaintLayer& rootLayer = *layoutView.layer(); |
(...skipping 56 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 |