Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: Source/core/paint/ViewDisplayListTest.cpp

Issue 860563003: Disable display item caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove beginNewPaints and m_doingNewPaints Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/LayerClipRecorderTest.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6
7 #include "core/paint/LayerClipRecorder.h" 7 #include "core/paint/LayerClipRecorder.h"
8 #include "core/paint/LayerPainter.h" 8 #include "core/paint/LayerPainter.h"
9 #include "core/paint/RenderDrawingRecorder.h" 9 #include "core/paint/RenderDrawingRecorder.h"
10 #include "core/rendering/RenderView.h" 10 #include "core/rendering/RenderView.h"
(...skipping 20 matching lines...) Expand all
31 { 31 {
32 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true); 32 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true);
33 33
34 RenderingTest::SetUp(); 34 RenderingTest::SetUp();
35 enableCompositing(); 35 enableCompositing();
36 36
37 m_renderView = document().view()->renderView(); 37 m_renderView = document().view()->renderView();
38 ASSERT_TRUE(m_renderView); 38 ASSERT_TRUE(m_renderView);
39 } 39 }
40 40
41 virtual void TearDown() override
42 {
43 RuntimeEnabledFeatures::setSlimmingPaintEnabled(false);
44 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(false);
45 }
46
41 RenderView* m_renderView; 47 RenderView* m_renderView;
42 }; 48 };
43 49
44 class TestDisplayItem : public DisplayItem { 50 class TestDisplayItem : public DisplayItem {
45 public: 51 public:
46 TestDisplayItem(const RenderObject* renderer, Type type) : DisplayItem(rende rer->displayItemClient(), type) { } 52 TestDisplayItem(const RenderObject* renderer, Type type) : DisplayItem(rende rer->displayItemClient(), type) { }
47 53
48 virtual void replay(GraphicsContext*) override final { ASSERT_NOT_REACHED(); } 54 virtual void replay(GraphicsContext*) override final { ASSERT_NOT_REACHED(); }
49 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override final { ASSERT_NOT_REACHED(); } 55 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override final { ASSERT_NOT_REACHED(); }
50 #ifndef NDEBUG 56 #ifndef NDEBUG
51 virtual const char* name() const override final { return "Test"; } 57 virtual const char* name() const override final { return "Test"; }
52 #endif 58 #endif
53 }; 59 };
54 60
55 #ifndef NDEBUG 61 #ifndef NDEBUG
56 #define TRACE_DISPLAY_ITEMS(expected, actual) \ 62 #define TRACE_DISPLAY_ITEMS(expected, actual) \
57 String trace = "Expected: " + (expected).asDebugString() + " Actual: " + (ac tual).asDebugString(); \ 63 String trace = "Expected: " + (expected).asDebugString() + " Actual: " + (ac tual).asDebugString(); \
58 SCOPED_TRACE(trace.utf8().data()); 64 SCOPED_TRACE(trace.utf8().data());
59 #else 65 #else
60 #define TRACE_DISPLAY_ITEMS(expected, actual) 66 #define TRACE_DISPLAY_ITEMS(expected, actual)
61 #endif 67 #endif
62 68
63 #define EXPECT_DISPLAY_LIST(actual, expectedSize, ...) { \ 69 #define EXPECT_DISPLAY_LIST(actual, expectedSize, ...) { \
64 EXPECT_EQ((size_t)expectedSize, actual.size()); \ 70 EXPECT_EQ((size_t)expectedSize, actual.size()); \
65 const TestDisplayItem expected[] = { __VA_ARGS__ }; \ 71 const TestDisplayItem expected[] = { __VA_ARGS__ }; \
66 for (size_t index = 0; index < expectedSize; index++) { \ 72 for (size_t index = 0; index < std::min<size_t>(actual.size(), expectedSize) ; index++) { \
67 TRACE_DISPLAY_ITEMS(expected[index], *actual[index]); \ 73 TRACE_DISPLAY_ITEMS(expected[index], *actual[index]); \
68 EXPECT_EQ(expected[index].client(), actual[index]->client()); \ 74 EXPECT_EQ(expected[index].client(), actual[index]->client()); \
69 EXPECT_EQ(expected[index].type(), actual[index]->type()); \ 75 EXPECT_EQ(expected[index].type(), actual[index]->type()); \
70 } \ 76 } \
71 } 77 }
72 78
73 void drawRect(GraphicsContext* context, RenderObject* renderer, PaintPhase phase , const FloatRect& bound) 79 void drawRect(GraphicsContext* context, RenderObject* renderer, PaintPhase phase , const FloatRect& bound)
74 { 80 {
75 RenderDrawingRecorder drawingRecorder(context, *renderer, phase, bound); 81 RenderDrawingRecorder drawingRecorder(context, *renderer, phase, bound);
76 if (drawingRecorder.canUseCachedDrawing()) 82 if (drawingRecorder.canUseCachedDrawing())
77 return; 83 return;
78 IntRect rect(0, 0, 10, 10); 84 IntRect rect(0, 0, 10, 10);
79 context->drawRect(rect); 85 context->drawRect(rect);
80 } 86 }
81 87
82 void drawClippedRect(GraphicsContext* context, RenderLayerModelObject* renderer, PaintPhase phase, const FloatRect& bound) 88 void drawClippedRect(GraphicsContext* context, RenderLayerModelObject* renderer, PaintPhase phase, const FloatRect& bound)
83 { 89 {
84 IntRect rect(1, 1, 9, 9); 90 IntRect rect(1, 1, 9, 9);
85 ClipRect clipRect(rect); 91 ClipRect clipRect(rect);
86 LayerClipRecorder layerClipRecorder(renderer, context, DisplayItem::ClipLaye rForeground, clipRect, 0, LayoutPoint(), PaintLayerFlags()); 92 LayerClipRecorder layerClipRecorder(renderer, context, DisplayItem::ClipLaye rForeground, clipRect, 0, LayoutPoint(), PaintLayerFlags());
87 drawRect(context, renderer, phase, bound); 93 drawRect(context, renderer, phase, bound);
88 } 94 }
89 95
90 TEST_F(ViewDisplayListTest, ViewDisplayListTest_NestedRecorders) 96 TEST_F(ViewDisplayListTest, ViewDisplayListTest_NestedRecorders)
91 { 97 {
92 GraphicsContext context(nullptr, &rootDisplayItemList()); 98 GraphicsContext context(nullptr, &rootDisplayItemList());
93 FloatRect bound = renderView()->viewRect(); 99 FloatRect bound = renderView()->viewRect();
94 100
95 drawClippedRect(&context, renderView(), PaintPhaseForeground, bound); 101 drawClippedRect(&context, renderView(), PaintPhaseForeground, bound);
102 rootDisplayItemList().endNewPaints();
96 103
97 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 104 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
98 TestDisplayItem(renderView(), DisplayItem::ClipLayerForeground), 105 TestDisplayItem(renderView(), DisplayItem::ClipLayerForeground),
99 TestDisplayItem(renderView(), DisplayItem::DrawingPaintPhaseForeground), 106 TestDisplayItem(renderView(), DisplayItem::DrawingPaintPhaseForeground),
100 TestDisplayItem(renderView(), DisplayItem::EndClip)); 107 TestDisplayItem(renderView(), DisplayItem::EndClip));
101 } 108 }
102 109
103 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateBasic) 110 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateBasic)
104 { 111 {
105 setBodyInnerHTML("<div id='first'><div id='second'></div></div>"); 112 setBodyInnerHTML("<div id='first'><div id='second'></div></div>");
106 RenderObject* first = document().body()->firstChild()->renderer(); 113 RenderObject* first = document().body()->firstChild()->renderer();
107 RenderObject* second = document().body()->firstChild()->firstChild()->render er(); 114 RenderObject* second = document().body()->firstChild()->firstChild()->render er();
108 GraphicsContext context(nullptr, &rootDisplayItemList()); 115 GraphicsContext context(nullptr, &rootDisplayItemList());
109 116
110 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300 , 300)); 117 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300 , 300));
111 drawRect(&context, second, PaintPhaseChildBlockBackground, FloatRect(100, 10 0, 200, 200)); 118 drawRect(&context, second, PaintPhaseChildBlockBackground, FloatRect(100, 10 0, 200, 200));
112 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300)); 119 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300));
120 rootDisplayItemList().endNewPaints();
113 121
114 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 122 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
115 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 123 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
116 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseChildBlockBackgrou nd), 124 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseChildBlockBackgrou nd),
117 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline)); 125 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline));
118 126
119 rootDisplayItemList().invalidate(second->displayItemClient()); 127 rootDisplayItemList().invalidate(second->displayItemClient());
120 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300 , 300)); 128 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300 , 300));
121 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300)); 129 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300));
130 rootDisplayItemList().endNewPaints();
122 131
123 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 132 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
124 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 133 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
125 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline)); 134 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline));
126 } 135 }
127 136
128 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateSwapOrder) 137 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateSwapOrder)
129 { 138 {
130 setBodyInnerHTML("<div id='first'><div id='second'></div></div><div id='unaf fected'></div>"); 139 setBodyInnerHTML("<div id='first'><div id='second'></div></div><div id='unaf fected'></div>");
131 RenderObject* first = document().body()->firstChild()->renderer(); 140 RenderObject* first = document().body()->firstChild()->renderer();
132 RenderObject* second = document().body()->firstChild()->firstChild()->render er(); 141 RenderObject* second = document().body()->firstChild()->firstChild()->render er();
133 RenderObject* unaffected = document().body()->firstChild()->nextSibling()->r enderer(); 142 RenderObject* unaffected = document().body()->firstChild()->nextSibling()->r enderer();
134 GraphicsContext context(nullptr, &rootDisplayItemList()); 143 GraphicsContext context(nullptr, &rootDisplayItemList());
135 144
136 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 145 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
137 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 146 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
138 drawRect(&context, unaffected, PaintPhaseBlockBackground, FloatRect(300, 300 , 10, 10)); 147 drawRect(&context, unaffected, PaintPhaseBlockBackground, FloatRect(300, 300 , 10, 10));
148 rootDisplayItemList().endNewPaints();
139 149
140 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 150 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
141 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 151 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
142 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground), 152 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground),
143 TestDisplayItem(unaffected, DisplayItem::DrawingPaintPhaseBlockBackgroun d)); 153 TestDisplayItem(unaffected, DisplayItem::DrawingPaintPhaseBlockBackgroun d));
144 154
145 rootDisplayItemList().invalidate(second->displayItemClient()); 155 rootDisplayItemList().invalidate(second->displayItemClient());
146 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 156 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
147 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 157 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
158 drawRect(&context, unaffected, PaintPhaseBlockBackground, FloatRect(300, 300 , 10, 10));
159 rootDisplayItemList().endNewPaints();
148 160
149 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 161 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
150 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground), 162 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground),
151 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 163 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
152 TestDisplayItem(unaffected, DisplayItem::DrawingPaintPhaseBlockBackgroun d)); 164 TestDisplayItem(unaffected, DisplayItem::DrawingPaintPhaseBlockBackgroun d));
153 } 165 }
154 166
155 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateNewItemInMiddle) 167 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateNewItemInMiddle)
156 { 168 {
157 setBodyInnerHTML("<div id='first'><div id='second'><div id='third'></div></d iv></div>"); 169 setBodyInnerHTML("<div id='first'><div id='second'><div id='third'></div></d iv></div>");
158 RenderObject* first = document().body()->firstChild()->renderer(); 170 RenderObject* first = document().body()->firstChild()->renderer();
159 RenderObject* second = document().body()->firstChild()->firstChild()->render er(); 171 RenderObject* second = document().body()->firstChild()->firstChild()->render er();
160 RenderObject* third = document().body()->firstChild()->firstChild()->firstCh ild()->renderer(); 172 RenderObject* third = document().body()->firstChild()->firstChild()->firstCh ild()->renderer();
161 GraphicsContext context(nullptr, &rootDisplayItemList()); 173 GraphicsContext context(nullptr, &rootDisplayItemList());
162 174
163 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 175 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
164 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 176 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
177 rootDisplayItemList().endNewPaints();
165 178
166 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 179 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
167 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 180 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
168 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground)); 181 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground));
169 182
170 rootDisplayItemList().invalidate(third->displayItemClient()); 183 rootDisplayItemList().invalidate(third->displayItemClient());
171 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 184 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
172 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(125, 100, 200 , 50)); 185 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(125, 100, 200 , 50));
173 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 186 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
187 rootDisplayItemList().endNewPaints();
174 188
175 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 189 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
176 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 190 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
177 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseBlockBackground), 191 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseBlockBackground),
178 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground)); 192 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground));
179 } 193 }
180 194
181 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateInvalidationWithPhases) 195 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateInvalidationWithPhases)
182 { 196 {
183 setBodyInnerHTML("<div id='first'><div id='second'></div></div><div id='thir d'></div>"); 197 setBodyInnerHTML("<div id='first'><div id='second'></div></div><div id='thir d'></div>");
184 RenderObject* first = document().body()->firstChild()->renderer(); 198 RenderObject* first = document().body()->firstChild()->renderer();
185 RenderObject* second = document().body()->firstChild()->firstChild()->render er(); 199 RenderObject* second = document().body()->firstChild()->firstChild()->render er();
186 RenderObject* third = document().body()->firstChild()->nextSibling()->render er(); 200 RenderObject* third = document().body()->firstChild()->nextSibling()->render er();
187 GraphicsContext context(nullptr, &rootDisplayItemList()); 201 GraphicsContext context(nullptr, &rootDisplayItemList());
188 202
189 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 203 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
190 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 204 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
191 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(300, 100, 50, 50)); 205 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(300, 100, 50, 50));
192 drawRect(&context, first, PaintPhaseForeground, FloatRect(100, 100, 100, 100 )); 206 drawRect(&context, first, PaintPhaseForeground, FloatRect(100, 100, 100, 100 ));
193 drawRect(&context, second, PaintPhaseForeground, FloatRect(100, 100, 50, 200 )); 207 drawRect(&context, second, PaintPhaseForeground, FloatRect(100, 100, 50, 200 ));
194 drawRect(&context, third, PaintPhaseForeground, FloatRect(300, 100, 50, 50)) ; 208 drawRect(&context, third, PaintPhaseForeground, FloatRect(300, 100, 50, 50)) ;
195 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 100, 100)); 209 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 100, 100));
196 drawRect(&context, second, PaintPhaseOutline, FloatRect(100, 100, 50, 200)); 210 drawRect(&context, second, PaintPhaseOutline, FloatRect(100, 100, 50, 200));
197 drawRect(&context, third, PaintPhaseOutline, FloatRect(300, 100, 50, 50)); 211 drawRect(&context, third, PaintPhaseOutline, FloatRect(300, 100, 50, 50));
212 rootDisplayItemList().endNewPaints();
198 213
199 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 9, 214 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 9,
200 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 215 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
201 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground), 216 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground),
202 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseBlockBackground), 217 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseBlockBackground),
203 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseForeground), 218 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseForeground),
204 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseForeground), 219 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseForeground),
205 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseForeground), 220 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseForeground),
206 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline), 221 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline),
207 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline), 222 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline),
208 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseOutline)); 223 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseOutline));
209 224
210 rootDisplayItemList().invalidate(second->displayItemClient()); 225 rootDisplayItemList().invalidate(second->displayItemClient());
211 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 226 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
212 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 227 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
228 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(300, 100, 50, 50));
213 drawRect(&context, first, PaintPhaseForeground, FloatRect(100, 100, 100, 100 )); 229 drawRect(&context, first, PaintPhaseForeground, FloatRect(100, 100, 100, 100 ));
214 drawRect(&context, second, PaintPhaseForeground, FloatRect(100, 100, 50, 200 )); 230 drawRect(&context, second, PaintPhaseForeground, FloatRect(100, 100, 50, 200 ));
231 drawRect(&context, third, PaintPhaseForeground, FloatRect(300, 100, 50, 50)) ;
215 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 100, 100)); 232 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 100, 100));
216 drawRect(&context, second, PaintPhaseOutline, FloatRect(100, 100, 50, 200)); 233 drawRect(&context, second, PaintPhaseOutline, FloatRect(100, 100, 50, 200));
234 drawRect(&context, third, PaintPhaseOutline, FloatRect(300, 100, 50, 50));
235 rootDisplayItemList().endNewPaints();
217 236
218 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 9, 237 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 9,
219 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 238 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
220 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground), 239 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground),
221 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseBlockBackground), 240 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseBlockBackground),
222 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseForeground), 241 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseForeground),
223 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseForeground), 242 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseForeground),
224 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseForeground), 243 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseForeground),
225 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline), 244 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline),
226 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline), 245 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline),
227 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseOutline)); 246 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseOutline));
228 247
248 // The following is only applicable when we support incremental paint.
249 #if 0
229 rootDisplayItemList().invalidate(second->displayItemClient()); 250 rootDisplayItemList().invalidate(second->displayItemClient());
230 251
231 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 6, 252 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 6,
232 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 253 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
233 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseBlockBackground), 254 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseBlockBackground),
234 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseForeground), 255 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseForeground),
235 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseForeground), 256 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseForeground),
236 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline), 257 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline),
237 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseOutline)); 258 TestDisplayItem(third, DisplayItem::DrawingPaintPhaseOutline));
259 #endif
238 } 260 }
239 261
240 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddFirstNoOverlap) 262 // This test is only applicable when we support incremental paint.
263 TEST_F(ViewDisplayListTest, DISABLED_ViewDisplayListTest_UpdateAddFirstNoOverlap )
241 { 264 {
242 setBodyInnerHTML("<div id='first'></div><div id='second'></div>"); 265 setBodyInnerHTML("<div id='first'></div><div id='second'></div>");
243 RenderObject* first = document().body()->firstChild()->renderer(); 266 RenderObject* first = document().body()->firstChild()->renderer();
244 RenderObject* second = document().body()->firstChild()->nextSibling()->rende rer(); 267 RenderObject* second = document().body()->firstChild()->nextSibling()->rende rer();
245 GraphicsContext context(nullptr, &rootDisplayItemList()); 268 GraphicsContext context(nullptr, &rootDisplayItemList());
246 269
247 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50 , 50)); 270 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50 , 50));
248 drawRect(&context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50)); 271 drawRect(&context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
249 272
250 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 273 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
(...skipping 10 matching lines...) Expand all
261 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground), 284 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground),
262 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline)); 285 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline));
263 286
264 rootDisplayItemList().invalidate(first->displayItemClient()); 287 rootDisplayItemList().invalidate(first->displayItemClient());
265 288
266 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 289 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
267 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground), 290 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground),
268 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline)); 291 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline));
269 } 292 }
270 293
271 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddFirstOverlap) 294 // This test is only applicable when we support incremental paint.
295 TEST_F(ViewDisplayListTest, DISABLED_ViewDisplayListTest_UpdateAddFirstOverlap)
272 { 296 {
273 setBodyInnerHTML("<div id='first'></div><div id='second'></div>"); 297 setBodyInnerHTML("<div id='first'></div><div id='second'></div>");
274 RenderObject* first = document().body()->firstChild()->renderer(); 298 RenderObject* first = document().body()->firstChild()->renderer();
275 RenderObject* second = document().body()->firstChild()->nextSibling()->rende rer(); 299 RenderObject* second = document().body()->firstChild()->nextSibling()->rende rer();
276 GraphicsContext context(nullptr, &rootDisplayItemList()); 300 GraphicsContext context(nullptr, &rootDisplayItemList());
277 301
278 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50 , 50)); 302 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50 , 50));
279 drawRect(&context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50)); 303 drawRect(&context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
280 304
281 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 305 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
(...skipping 15 matching lines...) Expand all
297 321
298 rootDisplayItemList().invalidate(first->displayItemClient()); 322 rootDisplayItemList().invalidate(first->displayItemClient());
299 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50 , 50)); 323 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50 , 50));
300 drawRect(&context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50)); 324 drawRect(&context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
301 325
302 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 326 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
303 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground), 327 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseBlockBackground),
304 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline)); 328 TestDisplayItem(second, DisplayItem::DrawingPaintPhaseOutline));
305 } 329 }
306 330
307 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddLastNoOverlap) 331 // This test is only applicable when we support incremental paint.
332 TEST_F(ViewDisplayListTest, DISABLED_ViewDisplayListTest_UpdateAddLastNoOverlap)
308 { 333 {
309 setBodyInnerHTML("<div id='first'></div><div id='second'></div>"); 334 setBodyInnerHTML("<div id='first'></div><div id='second'></div>");
310 RenderObject* first = document().body()->firstChild()->renderer(); 335 RenderObject* first = document().body()->firstChild()->renderer();
311 RenderObject* second = document().body()->firstChild()->nextSibling()->rende rer(); 336 RenderObject* second = document().body()->firstChild()->nextSibling()->rende rer();
312 GraphicsContext context(nullptr, &rootDisplayItemList()); 337 GraphicsContext context(nullptr, &rootDisplayItemList());
313 338
314 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 50)); 339 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 50));
315 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 50, 50)); 340 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 50, 50));
316 341
317 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 342 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
(...skipping 10 matching lines...) Expand all
328 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 353 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
329 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline)); 354 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline));
330 355
331 rootDisplayItemList().invalidate(second->displayItemClient()); 356 rootDisplayItemList().invalidate(second->displayItemClient());
332 357
333 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 358 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
334 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground), 359 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseBlockBackground),
335 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline)); 360 TestDisplayItem(first, DisplayItem::DrawingPaintPhaseOutline));
336 } 361 }
337 362
338 TEST_F(ViewDisplayListTest, ViewDisplayListTest_UpdateAddLastOverlap) 363 // This test is only applicable when we support incremental paint.
364 TEST_F(ViewDisplayListTest, DISABLED_ViewDisplayListTest_UpdateAddLastOverlap)
339 { 365 {
340 setBodyInnerHTML("<div id='first'></div><div id='second'></div>"); 366 setBodyInnerHTML("<div id='first'></div><div id='second'></div>");
341 RenderObject* first = document().body()->firstChild()->renderer(); 367 RenderObject* first = document().body()->firstChild()->renderer();
342 RenderObject* second = document().body()->firstChild()->nextSibling()->rende rer(); 368 RenderObject* second = document().body()->firstChild()->nextSibling()->rende rer();
343 GraphicsContext context(nullptr, &rootDisplayItemList()); 369 GraphicsContext context(nullptr, &rootDisplayItemList());
344 370
345 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 150 , 150)); 371 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 150 , 150));
346 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 150, 150)); 372 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 150, 150));
347 373
348 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 374 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
(...skipping 29 matching lines...) Expand all
378 RenderLayerModelObject* firstRenderer = toRenderLayerModelObject(document(). body()->firstChild()->renderer()); 404 RenderLayerModelObject* firstRenderer = toRenderLayerModelObject(document(). body()->firstChild()->renderer());
379 RenderLayerModelObject* secondRenderer = toRenderLayerModelObject(document() .body()->firstChild()->firstChild()->renderer()); 405 RenderLayerModelObject* secondRenderer = toRenderLayerModelObject(document() .body()->firstChild()->firstChild()->renderer());
380 GraphicsContext context(nullptr, &rootDisplayItemList()); 406 GraphicsContext context(nullptr, &rootDisplayItemList());
381 407
382 ClipRect firstClipRect(IntRect(1, 1, 2, 2)); 408 ClipRect firstClipRect(IntRect(1, 1, 2, 2));
383 { 409 {
384 LayerClipRecorder layerClipRecorder(firstRenderer, &context, DisplayItem ::ClipLayerForeground, firstClipRect, 0, LayoutPoint(), PaintLayerFlags()); 410 LayerClipRecorder layerClipRecorder(firstRenderer, &context, DisplayItem ::ClipLayerForeground, firstClipRect, 0, LayoutPoint(), PaintLayerFlags());
385 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(1 00, 100, 150, 150)); 411 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(1 00, 100, 150, 150));
386 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect( 100, 100, 150, 150)); 412 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect( 100, 100, 150, 150));
387 } 413 }
414 rootDisplayItemList().endNewPaints();
388 415
389 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 4, 416 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 4,
390 TestDisplayItem(firstRenderer, DisplayItem::ClipLayerForeground), 417 TestDisplayItem(firstRenderer, DisplayItem::ClipLayerForeground),
391 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound), 418 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound),
392 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round), 419 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round),
393 TestDisplayItem(firstRenderer, DisplayItem::EndClip)); 420 TestDisplayItem(firstRenderer, DisplayItem::EndClip));
394 421
395 rootDisplayItemList().invalidate(firstRenderer->displayItemClient()); 422 rootDisplayItemList().invalidate(firstRenderer->displayItemClient());
396 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 423 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
397 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 424 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
425 rootDisplayItemList().endNewPaints();
398 426
399 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 427 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
400 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound), 428 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound),
401 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round)); 429 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round));
402 430
403 rootDisplayItemList().invalidate(secondRenderer->displayItemClient()); 431 rootDisplayItemList().invalidate(secondRenderer->displayItemClient());
404 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 432 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
405 ClipRect secondClipRect(IntRect(1, 1, 2, 2)); 433 ClipRect secondClipRect(IntRect(1, 1, 2, 2));
406 { 434 {
407 LayerClipRecorder layerClipRecorder(secondRenderer, &context, DisplayIte m::ClipLayerForeground, secondClipRect, 0, LayoutPoint(), PaintLayerFlags()); 435 LayerClipRecorder layerClipRecorder(secondRenderer, &context, DisplayIte m::ClipLayerForeground, secondClipRect, 0, LayoutPoint(), PaintLayerFlags());
408 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect( 100, 100, 150, 150)); 436 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect( 100, 100, 150, 150));
409 } 437 }
438 rootDisplayItemList().endNewPaints();
410 439
411 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 4, 440 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 4,
412 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound), 441 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound),
413 TestDisplayItem(secondRenderer, DisplayItem::ClipLayerForeground), 442 TestDisplayItem(secondRenderer, DisplayItem::ClipLayerForeground),
414 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round), 443 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round),
415 TestDisplayItem(secondRenderer, DisplayItem::EndClip)); 444 TestDisplayItem(secondRenderer, DisplayItem::EndClip));
416 } 445 }
417 446
418 TEST_F(ViewDisplayListTest, CachedDisplayItems) 447 TEST_F(ViewDisplayListTest, CachedDisplayItems)
419 { 448 {
449 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true);
450
420 setBodyInnerHTML("<div id='first'><div id='second'></div></div>"); 451 setBodyInnerHTML("<div id='first'><div id='second'></div></div>");
421 RenderLayerModelObject* firstRenderer = toRenderLayerModelObject(document(). body()->firstChild()->renderer()); 452 RenderLayerModelObject* firstRenderer = toRenderLayerModelObject(document(). body()->firstChild()->renderer());
422 RenderLayerModelObject* secondRenderer = toRenderLayerModelObject(document() .body()->firstChild()->firstChild()->renderer()); 453 RenderLayerModelObject* secondRenderer = toRenderLayerModelObject(document() .body()->firstChild()->firstChild()->renderer());
423 GraphicsContext context(nullptr, &rootDisplayItemList()); 454 GraphicsContext context(nullptr, &rootDisplayItemList());
424 455
425 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 456 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
426 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 457 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
458 rootDisplayItemList().endNewPaints();
427 459
428 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 460 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
429 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound), 461 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound),
430 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round)); 462 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round));
431 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(firstRenderer->displayI temClient())); 463 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(firstRenderer->displayI temClient()));
432 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(secondRenderer->display ItemClient())); 464 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(secondRenderer->display ItemClient()));
433 DisplayItem* firstDisplayItem = rootDisplayItemList().paintList()[0].get(); 465 DisplayItem* firstDisplayItem = rootDisplayItemList().paintList()[0].get();
434 DisplayItem* secondDisplayItem = rootDisplayItemList().paintList()[1].get(); 466 DisplayItem* secondDisplayItem = rootDisplayItemList().paintList()[1].get();
435 467
436 rootDisplayItemList().invalidate(firstRenderer->displayItemClient()); 468 rootDisplayItemList().invalidate(firstRenderer->displayItemClient());
437 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(firstRenderer->display ItemClient())); 469 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(firstRenderer->display ItemClient()));
438 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(secondRenderer->display ItemClient())); 470 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(secondRenderer->display ItemClient()));
439 471
440 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 472 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
441 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 473 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
474 rootDisplayItemList().endNewPaints();
442 475
443 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 476 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
444 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound), 477 TestDisplayItem(firstRenderer, DisplayItem::DrawingPaintPhaseBlockBackgr ound),
445 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round)); 478 TestDisplayItem(secondRenderer, DisplayItem::DrawingPaintPhaseBlockBackg round));
446 // The first display item should be updated. 479 // The first display item should be updated.
447 EXPECT_NE(firstDisplayItem, rootDisplayItemList().paintList()[0].get()); 480 EXPECT_NE(firstDisplayItem, rootDisplayItemList().paintList()[0].get());
448 // The second display item should be cached. 481 // The second display item should be cached.
449 EXPECT_EQ(secondDisplayItem, rootDisplayItemList().paintList()[1].get()); 482 EXPECT_EQ(secondDisplayItem, rootDisplayItemList().paintList()[1].get());
450 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(firstRenderer->displayI temClient())); 483 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(firstRenderer->displayI temClient()));
451 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(secondRenderer->display ItemClient())); 484 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(secondRenderer->display ItemClient()));
(...skipping 10 matching lines...) Expand all
462 RenderLayer* rootLayer = renderView->layer(); 495 RenderLayer* rootLayer = renderView->layer();
463 RenderObject* htmlRenderer = document().documentElement()->renderer(); 496 RenderObject* htmlRenderer = document().documentElement()->renderer();
464 Element* div = toElement(document().body()->firstChild()); 497 Element* div = toElement(document().body()->firstChild());
465 RenderObject* divRenderer = document().body()->firstChild()->renderer(); 498 RenderObject* divRenderer = document().body()->firstChild()->renderer();
466 RenderObject* textRenderer = div->firstChild()->renderer(); 499 RenderObject* textRenderer = div->firstChild()->renderer();
467 500
468 SkCanvas canvas(800, 600); 501 SkCanvas canvas(800, 600);
469 GraphicsContext context(&canvas, &rootDisplayItemList()); 502 GraphicsContext context(&canvas, &rootDisplayItemList());
470 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB ehaviorNormal, LayoutSize()); 503 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB ehaviorNormal, LayoutSize());
471 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases); 504 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases);
505 rootDisplayItemList().endNewPaints();
472 506
473 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 507 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
474 TestDisplayItem(htmlRenderer, DisplayItem::DrawingPaintPhaseBlockBackgro und), 508 TestDisplayItem(htmlRenderer, DisplayItem::DrawingPaintPhaseBlockBackgro und),
475 TestDisplayItem(textRenderer, DisplayItem::DrawingPaintPhaseForeground)) ; 509 TestDisplayItem(textRenderer, DisplayItem::DrawingPaintPhaseForeground)) ;
476 510
477 div->focus(); 511 div->focus();
478 document().view()->updateLayoutAndStyleForPainting(); 512 document().view()->updateLayoutAndStyleForPainting();
479 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases); 513 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases);
514 rootDisplayItemList().endNewPaints();
480 515
481 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 516 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
482 TestDisplayItem(htmlRenderer, DisplayItem::DrawingPaintPhaseBlockBackgro und), 517 TestDisplayItem(htmlRenderer, DisplayItem::DrawingPaintPhaseBlockBackgro und),
483 TestDisplayItem(textRenderer, DisplayItem::DrawingPaintPhaseForeground), 518 TestDisplayItem(textRenderer, DisplayItem::DrawingPaintPhaseForeground),
484 TestDisplayItem(divRenderer, DisplayItem::DrawingPaintPhaseCaret)); 519 TestDisplayItem(divRenderer, DisplayItem::DrawingPaintPhaseCaret));
485 } 520 }
486 521
487 } // anonymous namespace 522 } // anonymous namespace
488 } // namespace blink 523 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/LayerClipRecorderTest.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698