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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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/TextPainterTest.cpp ('k') | Source/core/paint/ViewPainter.cpp » ('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/layout/LayoutTestHelper.h" 7 #include "core/layout/LayoutTestHelper.h"
8 #include "core/layout/LayoutText.h" 8 #include "core/layout/LayoutText.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/layout/compositing/LayerCompositor.h" 10 #include "core/layout/compositing/LayerCompositor.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 113 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
114 TestDisplayItem(layoutView(), DisplayItem::ClipLayerForeground), 114 TestDisplayItem(layoutView(), DisplayItem::ClipLayerForeground),
115 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground)), 115 TestDisplayItem(layoutView(), DisplayItem::paintPhaseToDrawingType(Paint PhaseForeground)),
116 TestDisplayItem(layoutView(), DisplayItem::clipTypeToEndClipType(Display Item::ClipLayerForeground))); 116 TestDisplayItem(layoutView(), DisplayItem::clipTypeToEndClipType(Display Item::ClipLayerForeground)));
117 } 117 }
118 118
119 TEST_F(ViewDisplayListTest, UpdateBasic) 119 TEST_F(ViewDisplayListTest, UpdateBasic)
120 { 120 {
121 setBodyInnerHTML("<div id='first'><div id='second'></div></div>"); 121 setBodyInnerHTML("<div id='first'><div id='second'></div></div>");
122 LayoutObject* first = document().body()->firstChild()->renderer(); 122 LayoutObject* first = document().body()->firstChild()->layoutObject();
123 LayoutObject* second = document().body()->firstChild()->firstChild()->render er(); 123 LayoutObject* second = document().body()->firstChild()->firstChild()->layout Object();
124 GraphicsContext context(nullptr, &rootDisplayItemList()); 124 GraphicsContext context(nullptr, &rootDisplayItemList());
125 125
126 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300 , 300)); 126 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300 , 300));
127 drawRect(&context, second, PaintPhaseChildBlockBackground, FloatRect(100, 10 0, 200, 200)); 127 drawRect(&context, second, PaintPhaseChildBlockBackground, FloatRect(100, 10 0, 200, 200));
128 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300)); 128 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300));
129 rootDisplayItemList().endNewPaints(); 129 rootDisplayItemList().endNewPaints();
130 130
131 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 131 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
132 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 132 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
133 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseC hildBlockBackground)), 133 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseC hildBlockBackground)),
134 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline))); 134 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline)));
135 135
136 rootDisplayItemList().invalidate(second->displayItemClient()); 136 rootDisplayItemList().invalidate(second->displayItemClient());
137 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300 , 300)); 137 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 300 , 300));
138 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300)); 138 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 300, 300));
139 rootDisplayItemList().endNewPaints(); 139 rootDisplayItemList().endNewPaints();
140 140
141 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 141 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
142 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 142 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
143 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline))); 143 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline)));
144 } 144 }
145 145
146 TEST_F(ViewDisplayListTest, UpdateSwapOrder) 146 TEST_F(ViewDisplayListTest, UpdateSwapOrder)
147 { 147 {
148 setBodyInnerHTML("<div id='first'><div id='second'></div></div><div id='unaf fected'></div>"); 148 setBodyInnerHTML("<div id='first'><div id='second'></div></div><div id='unaf fected'></div>");
149 LayoutObject* first = document().body()->firstChild()->renderer(); 149 LayoutObject* first = document().body()->firstChild()->layoutObject();
150 LayoutObject* second = document().body()->firstChild()->firstChild()->render er(); 150 LayoutObject* second = document().body()->firstChild()->firstChild()->layout Object();
151 LayoutObject* unaffected = document().body()->firstChild()->nextSibling()->r enderer(); 151 LayoutObject* unaffected = document().body()->firstChild()->nextSibling()->l ayoutObject();
152 GraphicsContext context(nullptr, &rootDisplayItemList()); 152 GraphicsContext context(nullptr, &rootDisplayItemList());
153 153
154 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 154 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
155 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 155 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
156 drawRect(&context, unaffected, PaintPhaseBlockBackground, FloatRect(300, 300 , 10, 10)); 156 drawRect(&context, unaffected, PaintPhaseBlockBackground, FloatRect(300, 300 , 10, 10));
157 rootDisplayItemList().endNewPaints(); 157 rootDisplayItemList().endNewPaints();
158 158
159 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 159 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
160 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 160 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
161 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)), 161 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)),
162 TestDisplayItem(unaffected, DisplayItem::paintPhaseToDrawingType(PaintPh aseBlockBackground))); 162 TestDisplayItem(unaffected, DisplayItem::paintPhaseToDrawingType(PaintPh aseBlockBackground)));
163 163
164 rootDisplayItemList().invalidate(second->displayItemClient()); 164 rootDisplayItemList().invalidate(second->displayItemClient());
165 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 165 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
166 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 166 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
167 drawRect(&context, unaffected, PaintPhaseBlockBackground, FloatRect(300, 300 , 10, 10)); 167 drawRect(&context, unaffected, PaintPhaseBlockBackground, FloatRect(300, 300 , 10, 10));
168 rootDisplayItemList().endNewPaints(); 168 rootDisplayItemList().endNewPaints();
169 169
170 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 170 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
171 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)), 171 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)),
172 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 172 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
173 TestDisplayItem(unaffected, DisplayItem::paintPhaseToDrawingType(PaintPh aseBlockBackground))); 173 TestDisplayItem(unaffected, DisplayItem::paintPhaseToDrawingType(PaintPh aseBlockBackground)));
174 } 174 }
175 175
176 TEST_F(ViewDisplayListTest, UpdateNewItemInMiddle) 176 TEST_F(ViewDisplayListTest, UpdateNewItemInMiddle)
177 { 177 {
178 setBodyInnerHTML("<div id='first'><div id='second'><div id='third'></div></d iv></div>"); 178 setBodyInnerHTML("<div id='first'><div id='second'><div id='third'></div></d iv></div>");
179 LayoutObject* first = document().body()->firstChild()->renderer(); 179 LayoutObject* first = document().body()->firstChild()->layoutObject();
180 LayoutObject* second = document().body()->firstChild()->firstChild()->render er(); 180 LayoutObject* second = document().body()->firstChild()->firstChild()->layout Object();
181 LayoutObject* third = document().body()->firstChild()->firstChild()->firstCh ild()->renderer(); 181 LayoutObject* third = document().body()->firstChild()->firstChild()->firstCh ild()->layoutObject();
182 GraphicsContext context(nullptr, &rootDisplayItemList()); 182 GraphicsContext context(nullptr, &rootDisplayItemList());
183 183
184 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 184 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
185 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 185 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
186 rootDisplayItemList().endNewPaints(); 186 rootDisplayItemList().endNewPaints();
187 187
188 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 188 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
189 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 189 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
190 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground))); 190 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)));
191 191
192 rootDisplayItemList().invalidate(third->displayItemClient()); 192 rootDisplayItemList().invalidate(third->displayItemClient());
193 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 193 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
194 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(125, 100, 200 , 50)); 194 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(125, 100, 200 , 50));
195 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 195 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
196 rootDisplayItemList().endNewPaints(); 196 rootDisplayItemList().endNewPaints();
197 197
198 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3, 198 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 3,
199 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 199 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
200 TestDisplayItem(third, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 200 TestDisplayItem(third, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
201 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground))); 201 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)));
202 } 202 }
203 203
204 TEST_F(ViewDisplayListTest, UpdateInvalidationWithPhases) 204 TEST_F(ViewDisplayListTest, UpdateInvalidationWithPhases)
205 { 205 {
206 setBodyInnerHTML("<div id='first'><div id='second'></div></div><div id='thir d'></div>"); 206 setBodyInnerHTML("<div id='first'><div id='second'></div></div><div id='thir d'></div>");
207 LayoutObject* first = document().body()->firstChild()->renderer(); 207 LayoutObject* first = document().body()->firstChild()->layoutObject();
208 LayoutObject* second = document().body()->firstChild()->firstChild()->render er(); 208 LayoutObject* second = document().body()->firstChild()->firstChild()->layout Object();
209 LayoutObject* third = document().body()->firstChild()->nextSibling()->render er(); 209 LayoutObject* third = document().body()->firstChild()->nextSibling()->layout Object();
210 GraphicsContext context(nullptr, &rootDisplayItemList()); 210 GraphicsContext context(nullptr, &rootDisplayItemList());
211 211
212 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100)); 212 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 100 , 100));
213 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200)); 213 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(100, 100, 50 , 200));
214 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(300, 100, 50, 50)); 214 drawRect(&context, third, PaintPhaseBlockBackground, FloatRect(300, 100, 50, 50));
215 drawRect(&context, first, PaintPhaseForeground, FloatRect(100, 100, 100, 100 )); 215 drawRect(&context, first, PaintPhaseForeground, FloatRect(100, 100, 100, 100 ));
216 drawRect(&context, second, PaintPhaseForeground, FloatRect(100, 100, 50, 200 )); 216 drawRect(&context, second, PaintPhaseForeground, FloatRect(100, 100, 50, 200 ));
217 drawRect(&context, third, PaintPhaseForeground, FloatRect(300, 100, 50, 50)) ; 217 drawRect(&context, third, PaintPhaseForeground, FloatRect(300, 100, 50, 50)) ;
218 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 100, 100)); 218 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 100, 100));
219 drawRect(&context, second, PaintPhaseOutline, FloatRect(100, 100, 50, 200)); 219 drawRect(&context, second, PaintPhaseOutline, FloatRect(100, 100, 50, 200));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseF oreground)), 251 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseF oreground)),
252 TestDisplayItem(third, DisplayItem::paintPhaseToDrawingType(PaintPhaseFo reground)), 252 TestDisplayItem(third, DisplayItem::paintPhaseToDrawingType(PaintPhaseFo reground)),
253 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline)), 253 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline)),
254 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseO utline)), 254 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseO utline)),
255 TestDisplayItem(third, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline))); 255 TestDisplayItem(third, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline)));
256 } 256 }
257 257
258 TEST_F(ViewDisplayListTest, UpdateAddFirstOverlap) 258 TEST_F(ViewDisplayListTest, UpdateAddFirstOverlap)
259 { 259 {
260 setBodyInnerHTML("<div id='first'></div><div id='second'></div>"); 260 setBodyInnerHTML("<div id='first'></div><div id='second'></div>");
261 LayoutObject* first = document().body()->firstChild()->renderer(); 261 LayoutObject* first = document().body()->firstChild()->layoutObject();
262 LayoutObject* second = document().body()->firstChild()->nextSibling()->rende rer(); 262 LayoutObject* second = document().body()->firstChild()->nextSibling()->layou tObject();
263 GraphicsContext context(nullptr, &rootDisplayItemList()); 263 GraphicsContext context(nullptr, &rootDisplayItemList());
264 264
265 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50 , 50)); 265 drawRect(&context, second, PaintPhaseBlockBackground, FloatRect(200, 200, 50 , 50));
266 drawRect(&context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50)); 266 drawRect(&context, second, PaintPhaseOutline, FloatRect(200, 200, 50, 50));
267 rootDisplayItemList().endNewPaints(); 267 rootDisplayItemList().endNewPaints();
268 268
269 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 269 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
270 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)), 270 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)),
271 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseO utline))); 271 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseO utline)));
272 272
(...skipping 17 matching lines...) Expand all
290 rootDisplayItemList().endNewPaints(); 290 rootDisplayItemList().endNewPaints();
291 291
292 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 292 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
293 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)), 293 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseB lockBackground)),
294 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseO utline))); 294 TestDisplayItem(second, DisplayItem::paintPhaseToDrawingType(PaintPhaseO utline)));
295 } 295 }
296 296
297 TEST_F(ViewDisplayListTest, UpdateAddLastOverlap) 297 TEST_F(ViewDisplayListTest, UpdateAddLastOverlap)
298 { 298 {
299 setBodyInnerHTML("<div id='first'></div><div id='second'></div>"); 299 setBodyInnerHTML("<div id='first'></div><div id='second'></div>");
300 LayoutObject* first = document().body()->firstChild()->renderer(); 300 LayoutObject* first = document().body()->firstChild()->layoutObject();
301 LayoutObject* second = document().body()->firstChild()->nextSibling()->rende rer(); 301 LayoutObject* second = document().body()->firstChild()->nextSibling()->layou tObject();
302 GraphicsContext context(nullptr, &rootDisplayItemList()); 302 GraphicsContext context(nullptr, &rootDisplayItemList());
303 303
304 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 150 , 150)); 304 drawRect(&context, first, PaintPhaseBlockBackground, FloatRect(100, 100, 150 , 150));
305 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 150, 150)); 305 drawRect(&context, first, PaintPhaseOutline, FloatRect(100, 100, 150, 150));
306 rootDisplayItemList().endNewPaints(); 306 rootDisplayItemList().endNewPaints();
307 307
308 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 308 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
309 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 309 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
310 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline))); 310 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline)));
311 311
(...skipping 18 matching lines...) Expand all
330 rootDisplayItemList().endNewPaints(); 330 rootDisplayItemList().endNewPaints();
331 331
332 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 332 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
333 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)), 333 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseBl ockBackground)),
334 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline))); 334 TestDisplayItem(first, DisplayItem::paintPhaseToDrawingType(PaintPhaseOu tline)));
335 } 335 }
336 336
337 TEST_F(ViewDisplayListTest, UpdateClip) 337 TEST_F(ViewDisplayListTest, UpdateClip)
338 { 338 {
339 setBodyInnerHTML("<div id='first'><div id='second'></div></div>"); 339 setBodyInnerHTML("<div id='first'><div id='second'></div></div>");
340 LayoutBoxModelObject* firstRenderer = toLayoutBoxModelObject(document().body ()->firstChild()->renderer()); 340 LayoutBoxModelObject* firstRenderer = toLayoutBoxModelObject(document().body ()->firstChild()->layoutObject());
341 LayoutBoxModelObject* secondRenderer = toLayoutBoxModelObject(document().bod y()->firstChild()->firstChild()->renderer()); 341 LayoutBoxModelObject* secondRenderer = toLayoutBoxModelObject(document().bod y()->firstChild()->firstChild()->layoutObject());
342 GraphicsContext context(nullptr, &rootDisplayItemList()); 342 GraphicsContext context(nullptr, &rootDisplayItemList());
343 343
344 ClipRect firstClipRect(LayoutRect(1, 1, 2, 2)); 344 ClipRect firstClipRect(LayoutRect(1, 1, 2, 2));
345 { 345 {
346 LayerClipRecorder layerClipRecorder(firstRenderer, &context, DisplayItem ::ClipLayerForeground, firstClipRect, 0, LayoutPoint(), PaintLayerFlags()); 346 LayerClipRecorder layerClipRecorder(firstRenderer, &context, DisplayItem ::ClipLayerForeground, firstClipRect, 0, LayoutPoint(), PaintLayerFlags());
347 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(1 00, 100, 150, 150)); 347 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(1 00, 100, 150, 150));
348 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect( 100, 100, 150, 150)); 348 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect( 100, 100, 150, 150));
349 } 349 }
350 rootDisplayItemList().endNewPaints(); 350 rootDisplayItemList().endNewPaints();
351 351
(...skipping 26 matching lines...) Expand all
378 TestDisplayItem(secondRenderer, DisplayItem::ClipLayerForeground), 378 TestDisplayItem(secondRenderer, DisplayItem::ClipLayerForeground),
379 TestDisplayItem(secondRenderer, DisplayItem::paintPhaseToDrawingType(Pai ntPhaseBlockBackground)), 379 TestDisplayItem(secondRenderer, DisplayItem::paintPhaseToDrawingType(Pai ntPhaseBlockBackground)),
380 TestDisplayItem(secondRenderer, DisplayItem::clipTypeToEndClipType(Displ ayItem::ClipLayerForeground))); 380 TestDisplayItem(secondRenderer, DisplayItem::clipTypeToEndClipType(Displ ayItem::ClipLayerForeground)));
381 } 381 }
382 382
383 TEST_F(ViewDisplayListTest, CachedDisplayItems) 383 TEST_F(ViewDisplayListTest, CachedDisplayItems)
384 { 384 {
385 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true); 385 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true);
386 386
387 setBodyInnerHTML("<div id='first'><div id='second'></div></div>"); 387 setBodyInnerHTML("<div id='first'><div id='second'></div></div>");
388 LayoutBoxModelObject* firstRenderer = toLayoutBoxModelObject(document().body ()->firstChild()->renderer()); 388 LayoutBoxModelObject* firstRenderer = toLayoutBoxModelObject(document().body ()->firstChild()->layoutObject());
389 LayoutBoxModelObject* secondRenderer = toLayoutBoxModelObject(document().bod y()->firstChild()->firstChild()->renderer()); 389 LayoutBoxModelObject* secondRenderer = toLayoutBoxModelObject(document().bod y()->firstChild()->firstChild()->layoutObject());
390 GraphicsContext context(nullptr, &rootDisplayItemList()); 390 GraphicsContext context(nullptr, &rootDisplayItemList());
391 391
392 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 392 drawRect(&context, firstRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
393 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150)); 393 drawRect(&context, secondRenderer, PaintPhaseBlockBackground, FloatRect(100, 100, 150, 150));
394 rootDisplayItemList().endNewPaints(); 394 rootDisplayItemList().endNewPaints();
395 395
396 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 396 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
397 TestDisplayItem(firstRenderer, DisplayItem::paintPhaseToDrawingType(Pain tPhaseBlockBackground)), 397 TestDisplayItem(firstRenderer, DisplayItem::paintPhaseToDrawingType(Pain tPhaseBlockBackground)),
398 TestDisplayItem(secondRenderer, DisplayItem::paintPhaseToDrawingType(Pai ntPhaseBlockBackground))); 398 TestDisplayItem(secondRenderer, DisplayItem::paintPhaseToDrawingType(Pai ntPhaseBlockBackground)));
399 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(firstRenderer->displayI temClient())); 399 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(firstRenderer->displayI temClient()));
(...skipping 26 matching lines...) Expand all
426 426
427 TEST_F(ViewDisplayListTest, FullDocumentPaintingWithCaret_CacheDisabled) 427 TEST_F(ViewDisplayListTest, FullDocumentPaintingWithCaret_CacheDisabled)
428 { 428 {
429 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(false); 429 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(false);
430 430
431 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'> XYZ</div>"); 431 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'> XYZ</div>");
432 document().page()->focusController().setActive(true); 432 document().page()->focusController().setActive(true);
433 document().page()->focusController().setFocused(true); 433 document().page()->focusController().setFocused(true);
434 LayoutView* layoutView = document().layoutView(); 434 LayoutView* layoutView = document().layoutView();
435 Layer* rootLayer = layoutView->layer(); 435 Layer* rootLayer = layoutView->layer();
436 LayoutObject* htmlRenderer = document().documentElement()->renderer(); 436 LayoutObject* htmlRenderer = document().documentElement()->layoutObject();
437 Element* div = toElement(document().body()->firstChild()); 437 Element* div = toElement(document().body()->firstChild());
438 LayoutObject* divRenderer = document().body()->firstChild()->renderer(); 438 LayoutObject* divRenderer = document().body()->firstChild()->layoutObject();
439 InlineTextBox* textInlineBox = toLayoutText(div->firstChild()->renderer())-> firstTextBox(); 439 InlineTextBox* textInlineBox = toLayoutText(div->firstChild()->layoutObject( ))->firstTextBox();
440 440
441 SkCanvas canvas(800, 600); 441 SkCanvas canvas(800, 600);
442 GraphicsContext context(&canvas, &rootDisplayItemList()); 442 GraphicsContext context(&canvas, &rootDisplayItemList());
443 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB ehaviorNormal, LayoutSize()); 443 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB ehaviorNormal, LayoutSize());
444 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases); 444 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases);
445 rootDisplayItemList().endNewPaints(); 445 rootDisplayItemList().endNewPaints();
446 446
447 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2, 447 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 2,
448 TestDisplayItem(htmlRenderer, DisplayItem::BoxDecorationBackground), 448 TestDisplayItem(htmlRenderer, DisplayItem::BoxDecorationBackground),
449 TestDisplayItem(textInlineBox->displayItemClient(), DisplayItem::paintPh aseToDrawingType(PaintPhaseForeground))); 449 TestDisplayItem(textInlineBox->displayItemClient(), DisplayItem::paintPh aseToDrawingType(PaintPhaseForeground)));
(...skipping 11 matching lines...) Expand all
461 461
462 TEST_F(ViewDisplayListTest, FullDocumentPaintingWithCaret_CacheEnabled) 462 TEST_F(ViewDisplayListTest, FullDocumentPaintingWithCaret_CacheEnabled)
463 { 463 {
464 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true); 464 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true);
465 465
466 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'> XYZ</div>"); 466 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'> XYZ</div>");
467 document().page()->focusController().setActive(true); 467 document().page()->focusController().setActive(true);
468 document().page()->focusController().setFocused(true); 468 document().page()->focusController().setFocused(true);
469 LayoutView* layoutView = document().layoutView(); 469 LayoutView* layoutView = document().layoutView();
470 Layer* rootLayer = layoutView->layer(); 470 Layer* rootLayer = layoutView->layer();
471 LayoutObject* htmlRenderer = document().documentElement()->renderer(); 471 LayoutObject* htmlRenderer = document().documentElement()->layoutObject();
472 LayoutObject* bodyRenderer = document().body()->renderer(); 472 LayoutObject* bodyRenderer = document().body()->layoutObject();
473 Element* div = toElement(document().body()->firstChild()); 473 Element* div = toElement(document().body()->firstChild());
474 LayoutObject* divRenderer = document().body()->firstChild()->renderer(); 474 LayoutObject* divRenderer = document().body()->firstChild()->layoutObject();
475 InlineTextBox* textInlineBox = toLayoutText(div->firstChild()->renderer())-> firstTextBox(); 475 InlineTextBox* textInlineBox = toLayoutText(div->firstChild()->layoutObject( ))->firstTextBox();
476 476
477 SkCanvas canvas(800, 600); 477 SkCanvas canvas(800, 600);
478 GraphicsContext context(&canvas, &rootDisplayItemList()); 478 GraphicsContext context(&canvas, &rootDisplayItemList());
479 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB ehaviorNormal, LayoutSize()); 479 LayerPaintingInfo paintingInfo(rootLayer, LayoutRect(0, 0, 800, 600), PaintB ehaviorNormal, LayoutSize());
480 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases); 480 LayerPainter(*rootLayer).paintLayerContents(&context, paintingInfo, PaintLay erPaintingCompositingAllPhases);
481 rootDisplayItemList().endNewPaints(); 481 rootDisplayItemList().endNewPaints();
482 482
483 EXPECT_EQ((size_t)10, rootDisplayItemList().paintList().size()); 483 EXPECT_EQ((size_t)10, rootDisplayItemList().paintList().size());
484 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 10, 484 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 10,
485 TestDisplayItem(htmlRenderer, DisplayItem::paintPhaseToBeginSubtreeType( PaintPhaseBlockBackground)), 485 TestDisplayItem(htmlRenderer, DisplayItem::paintPhaseToBeginSubtreeType( PaintPhaseBlockBackground)),
(...skipping 27 matching lines...) Expand all
513 TestDisplayItem(divRenderer, DisplayItem::Caret), // New! 513 TestDisplayItem(divRenderer, DisplayItem::Caret), // New!
514 TestDisplayItem(divRenderer, DisplayItem::paintPhaseToEndSubtreeType(Pai ntPhaseForeground)), 514 TestDisplayItem(divRenderer, DisplayItem::paintPhaseToEndSubtreeType(Pai ntPhaseForeground)),
515 TestDisplayItem(bodyRenderer, DisplayItem::paintPhaseToEndSubtreeType(Pa intPhaseForeground)), 515 TestDisplayItem(bodyRenderer, DisplayItem::paintPhaseToEndSubtreeType(Pa intPhaseForeground)),
516 TestDisplayItem(htmlRenderer, DisplayItem::paintPhaseToEndSubtreeType(Pa intPhaseForeground))); 516 TestDisplayItem(htmlRenderer, DisplayItem::paintPhaseToEndSubtreeType(Pa intPhaseForeground)));
517 } 517 }
518 518
519 TEST_F(ViewDisplayListTest, ComplexUpdateSwapOrder) 519 TEST_F(ViewDisplayListTest, ComplexUpdateSwapOrder)
520 { 520 {
521 setBodyInnerHTML("<div id='container1'><div id='content1'></div></div>" 521 setBodyInnerHTML("<div id='container1'><div id='content1'></div></div>"
522 "<div id='container2'><div id='content2'></div></div>"); 522 "<div id='container2'><div id='content2'></div></div>");
523 LayoutObject* container1 = document().body()->firstChild()->renderer(); 523 LayoutObject* container1 = document().body()->firstChild()->layoutObject();
524 LayoutObject* content1 = document().body()->firstChild()->firstChild()->rend erer(); 524 LayoutObject* content1 = document().body()->firstChild()->firstChild()->layo utObject();
525 LayoutObject* container2 = document().body()->firstChild()->nextSibling()->r enderer(); 525 LayoutObject* container2 = document().body()->firstChild()->nextSibling()->l ayoutObject();
526 LayoutObject* content2 = document().body()->firstChild()->nextSibling()->fir stChild()->renderer(); 526 LayoutObject* content2 = document().body()->firstChild()->nextSibling()->fir stChild()->layoutObject();
527 GraphicsContext context(nullptr, &rootDisplayItemList()); 527 GraphicsContext context(nullptr, &rootDisplayItemList());
528 528
529 drawRect(&context, container1, PaintPhaseBlockBackground, FloatRect(100, 100 , 100, 100)); 529 drawRect(&context, container1, PaintPhaseBlockBackground, FloatRect(100, 100 , 100, 100));
530 drawRect(&context, content1, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200)); 530 drawRect(&context, content1, PaintPhaseBlockBackground, FloatRect(100, 100, 50, 200));
531 drawRect(&context, content1, PaintPhaseForeground, FloatRect(100, 100, 50, 2 00)); 531 drawRect(&context, content1, PaintPhaseForeground, FloatRect(100, 100, 50, 2 00));
532 drawRect(&context, container1, PaintPhaseForeground, FloatRect(100, 100, 100 , 100)); 532 drawRect(&context, container1, PaintPhaseForeground, FloatRect(100, 100, 100 , 100));
533 drawRect(&context, container2, PaintPhaseBlockBackground, FloatRect(100, 200 , 100, 100)); 533 drawRect(&context, container2, PaintPhaseBlockBackground, FloatRect(100, 200 , 100, 100));
534 drawRect(&context, content2, PaintPhaseBlockBackground, FloatRect(100, 200, 50, 200)); 534 drawRect(&context, content2, PaintPhaseBlockBackground, FloatRect(100, 200, 50, 200));
535 drawRect(&context, content2, PaintPhaseForeground, FloatRect(100, 200, 50, 2 00)); 535 drawRect(&context, content2, PaintPhaseForeground, FloatRect(100, 200, 50, 2 00));
536 drawRect(&context, container2, PaintPhaseForeground, FloatRect(100, 200, 100 , 100)); 536 drawRect(&context, container2, PaintPhaseForeground, FloatRect(100, 200, 100 , 100));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 TestDisplayItem(content1, DisplayItem::paintPhaseToDrawingType(PaintPhas eForeground)), 568 TestDisplayItem(content1, DisplayItem::paintPhaseToDrawingType(PaintPhas eForeground)),
569 TestDisplayItem(container1, DisplayItem::paintPhaseToDrawingType(PaintPh aseForeground))); 569 TestDisplayItem(container1, DisplayItem::paintPhaseToDrawingType(PaintPh aseForeground)));
570 } 570 }
571 571
572 TEST_F(ViewDisplayListTest, CachedSubtreeSwapOrder) 572 TEST_F(ViewDisplayListTest, CachedSubtreeSwapOrder)
573 { 573 {
574 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true); 574 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true);
575 575
576 setBodyInnerHTML("<div id='container1'><div id='content1'></div></div>" 576 setBodyInnerHTML("<div id='container1'><div id='content1'></div></div>"
577 "<div id='container2'><div id='content2'></div></div>"); 577 "<div id='container2'><div id='content2'></div></div>");
578 LayoutObject* container1 = document().body()->firstChild()->renderer(); 578 LayoutObject* container1 = document().body()->firstChild()->layoutObject();
579 LayoutObject* content1 = document().body()->firstChild()->firstChild()->rend erer(); 579 LayoutObject* content1 = document().body()->firstChild()->firstChild()->layo utObject();
580 LayoutObject* container2 = document().body()->firstChild()->nextSibling()->r enderer(); 580 LayoutObject* container2 = document().body()->firstChild()->nextSibling()->l ayoutObject();
581 LayoutObject* content2 = document().body()->firstChild()->nextSibling()->fir stChild()->renderer(); 581 LayoutObject* content2 = document().body()->firstChild()->nextSibling()->fir stChild()->layoutObject();
582 GraphicsContext context(nullptr, &rootDisplayItemList()); 582 GraphicsContext context(nullptr, &rootDisplayItemList());
583 583
584 { 584 {
585 SubtreeRecorder r(&context, *container1, PaintPhaseBlockBackground); 585 SubtreeRecorder r(&context, *container1, PaintPhaseBlockBackground);
586 r.begin(); 586 r.begin();
587 drawRect(&context, container1, PaintPhaseBlockBackground, FloatRect(100, 100, 100, 100)); 587 drawRect(&context, container1, PaintPhaseBlockBackground, FloatRect(100, 100, 100, 100));
588 drawRect(&context, content1, PaintPhaseBlockBackground, FloatRect(100, 1 00, 50, 200)); 588 drawRect(&context, content1, PaintPhaseBlockBackground, FloatRect(100, 1 00, 50, 200));
589 } 589 }
590 { 590 {
591 SubtreeRecorder r(&context, *container1, PaintPhaseForeground); 591 SubtreeRecorder r(&context, *container1, PaintPhaseForeground);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 TestDisplayItem(container1, DisplayItem::paintPhaseToDrawingType(PaintPh aseForeground)), 674 TestDisplayItem(container1, DisplayItem::paintPhaseToDrawingType(PaintPh aseForeground)),
675 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(Pain tPhaseForeground))); 675 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(Pain tPhaseForeground)));
676 } 676 }
677 677
678 TEST_F(ViewDisplayListTest, Scope) 678 TEST_F(ViewDisplayListTest, Scope)
679 { 679 {
680 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true); 680 RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true);
681 681
682 setBodyInnerHTML("<div id='multicol'><div id='content'></div></div>"); 682 setBodyInnerHTML("<div id='multicol'><div id='content'></div></div>");
683 683
684 LayoutObject* multicol = document().body()->firstChild()->renderer(); 684 LayoutObject* multicol = document().body()->firstChild()->layoutObject();
685 LayoutObject* content = document().body()->firstChild()->firstChild()->rende rer(); 685 LayoutObject* content = document().body()->firstChild()->firstChild()->layou tObject();
686 GraphicsContext context(nullptr, &rootDisplayItemList()); 686 GraphicsContext context(nullptr, &rootDisplayItemList());
687 687
688 FloatRect rect1(100, 100, 50, 50); 688 FloatRect rect1(100, 100, 50, 50);
689 FloatRect rect2(150, 100, 50, 50); 689 FloatRect rect2(150, 100, 50, 50);
690 FloatRect rect3(200, 100, 50, 50); 690 FloatRect rect3(200, 100, 50, 50);
691 drawRect(&context, multicol, PaintPhaseBlockBackground, FloatRect(100, 200, 100, 100)); 691 drawRect(&context, multicol, PaintPhaseBlockBackground, FloatRect(100, 200, 100, 100));
692 { 692 {
693 ScopeRecorder r(&context, *multicol); 693 ScopeRecorder r(&context, *multicol);
694 drawRect(&context, content, PaintPhaseForeground, rect1); 694 drawRect(&context, content, PaintPhaseForeground, rect1);
695 } 695 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 4, 752 EXPECT_DISPLAY_LIST(rootDisplayItemList().paintList(), 4,
753 TestDisplayItem(multicol, DisplayItem::paintPhaseToDrawingType(PaintPhas eBlockBackground)), 753 TestDisplayItem(multicol, DisplayItem::paintPhaseToDrawingType(PaintPhas eBlockBackground)),
754 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase Foreground)), 754 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase Foreground)),
755 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase Foreground)), 755 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase Foreground)),
756 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase Foreground))); 756 TestDisplayItem(content, DisplayItem::paintPhaseToDrawingType(PaintPhase Foreground)));
757 EXPECT_NE(picture1, static_cast<DrawingDisplayItem*>(rootDisplayItemList().p aintList()[1].get())->picture()); 757 EXPECT_NE(picture1, static_cast<DrawingDisplayItem*>(rootDisplayItemList().p aintList()[1].get())->picture());
758 EXPECT_NE(picture2, static_cast<DrawingDisplayItem*>(rootDisplayItemList().p aintList()[2].get())->picture()); 758 EXPECT_NE(picture2, static_cast<DrawingDisplayItem*>(rootDisplayItemList().p aintList()[2].get())->picture());
759 } 759 }
760 760
761 } // namespace blink 761 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/TextPainterTest.cpp ('k') | Source/core/paint/ViewPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698