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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp

Issue 1588543004: Remove paintInvalidationRect from display item client invalidation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp ('k') | no next file » | 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 "platform/graphics/paint/PaintController.h" 5 #include "platform/graphics/paint/PaintController.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/paint/CachedDisplayItem.h" 9 #include "platform/graphics/paint/CachedDisplayItem.h"
10 #include "platform/graphics/paint/ClipPathRecorder.h" 10 #include "platform/graphics/paint/ClipPathRecorder.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300 )); 120 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300 ));
121 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 20 0)); 121 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 20 0));
122 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300 )); 122 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300 ));
123 paintController().commitNewDisplayItems(); 123 paintController().commitNewDisplayItems();
124 124
125 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, 125 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3,
126 TestDisplayItem(first, backgroundDrawingType), 126 TestDisplayItem(first, backgroundDrawingType),
127 TestDisplayItem(second, backgroundDrawingType), 127 TestDisplayItem(second, backgroundDrawingType),
128 TestDisplayItem(first, foregroundDrawingType)); 128 TestDisplayItem(first, foregroundDrawingType));
129 129
130 paintController().invalidate(second, PaintInvalidationFull, nullptr); 130 paintController().invalidate(second);
131 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300 )); 131 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300 ));
132 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300 )); 132 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300 ));
133 paintController().commitNewDisplayItems(); 133 paintController().commitNewDisplayItems();
134 134
135 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 135 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
136 TestDisplayItem(first, backgroundDrawingType), 136 TestDisplayItem(first, backgroundDrawingType),
137 TestDisplayItem(first, foregroundDrawingType)); 137 TestDisplayItem(first, foregroundDrawingType));
138 } 138 }
139 139
140 TEST_F(PaintControllerTest, UpdateSwapOrder) 140 TEST_F(PaintControllerTest, UpdateSwapOrder)
141 { 141 {
142 TestDisplayItemClient first("first"); 142 TestDisplayItemClient first("first");
143 TestDisplayItemClient second("second"); 143 TestDisplayItemClient second("second");
144 TestDisplayItemClient unaffected("unaffected"); 144 TestDisplayItemClient unaffected("unaffected");
145 GraphicsContext context(paintController()); 145 GraphicsContext context(paintController());
146 146
147 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100 )); 147 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100 ));
148 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200 )); 148 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200 ));
149 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10, 10)); 149 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10, 10));
150 paintController().commitNewDisplayItems(); 150 paintController().commitNewDisplayItems();
151 151
152 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, 152 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3,
153 TestDisplayItem(first, backgroundDrawingType), 153 TestDisplayItem(first, backgroundDrawingType),
154 TestDisplayItem(second, backgroundDrawingType), 154 TestDisplayItem(second, backgroundDrawingType),
155 TestDisplayItem(unaffected, backgroundDrawingType)); 155 TestDisplayItem(unaffected, backgroundDrawingType));
156 156
157 paintController().invalidate(second, PaintInvalidationFull, nullptr); 157 paintController().invalidate(second);
158 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200 )); 158 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200 ));
159 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100 )); 159 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100 ));
160 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10, 10)); 160 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10, 10));
161 paintController().commitNewDisplayItems(); 161 paintController().commitNewDisplayItems();
162 162
163 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, 163 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3,
164 TestDisplayItem(second, backgroundDrawingType), 164 TestDisplayItem(second, backgroundDrawingType),
165 TestDisplayItem(first, backgroundDrawingType), 165 TestDisplayItem(first, backgroundDrawingType),
166 TestDisplayItem(unaffected, backgroundDrawingType)); 166 TestDisplayItem(unaffected, backgroundDrawingType));
167 } 167 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 paintController().commitNewDisplayItems(); 208 paintController().commitNewDisplayItems();
209 209
210 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 6, 210 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 6,
211 TestDisplayItem(first, backgroundDrawingType), 211 TestDisplayItem(first, backgroundDrawingType),
212 TestDisplayItem(second, backgroundDrawingType), 212 TestDisplayItem(second, backgroundDrawingType),
213 TestDisplayItem(third, backgroundDrawingType), 213 TestDisplayItem(third, backgroundDrawingType),
214 TestDisplayItem(first, foregroundDrawingType), 214 TestDisplayItem(first, foregroundDrawingType),
215 TestDisplayItem(second, foregroundDrawingType), 215 TestDisplayItem(second, foregroundDrawingType),
216 TestDisplayItem(third, foregroundDrawingType)); 216 TestDisplayItem(third, foregroundDrawingType));
217 217
218 paintController().invalidate(second, PaintInvalidationFull, nullptr); 218 paintController().invalidate(second);
219 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100 )); 219 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100 ));
220 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200 )); 220 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200 ));
221 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50)) ; 221 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50)) ;
222 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 100, 100 )); 222 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 100, 100 ));
223 drawRect(context, second, foregroundDrawingType, FloatRect(100, 100, 50, 200 )); 223 drawRect(context, second, foregroundDrawingType, FloatRect(100, 100, 50, 200 ));
224 drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50)) ; 224 drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50)) ;
225 paintController().commitNewDisplayItems(); 225 paintController().commitNewDisplayItems();
226 226
227 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 6, 227 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 6,
228 TestDisplayItem(first, backgroundDrawingType), 228 TestDisplayItem(first, backgroundDrawingType),
(...skipping 11 matching lines...) Expand all
240 GraphicsContext context(paintController()); 240 GraphicsContext context(paintController());
241 241
242 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50) ); 242 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50) );
243 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50) ); 243 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50) );
244 paintController().commitNewDisplayItems(); 244 paintController().commitNewDisplayItems();
245 245
246 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 246 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
247 TestDisplayItem(second, backgroundDrawingType), 247 TestDisplayItem(second, backgroundDrawingType),
248 TestDisplayItem(second, foregroundDrawingType)); 248 TestDisplayItem(second, foregroundDrawingType));
249 249
250 paintController().invalidate(first, PaintInvalidationFull, nullptr); 250 paintController().invalidate(first);
251 paintController().invalidate(second, PaintInvalidationFull, nullptr); 251 paintController().invalidate(second);
252 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 )); 252 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 ));
253 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150 )); 253 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150 ));
254 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50) ); 254 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50) );
255 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50) ); 255 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50) );
256 paintController().commitNewDisplayItems(); 256 paintController().commitNewDisplayItems();
257 257
258 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, 258 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4,
259 TestDisplayItem(first, backgroundDrawingType), 259 TestDisplayItem(first, backgroundDrawingType),
260 TestDisplayItem(first, foregroundDrawingType), 260 TestDisplayItem(first, foregroundDrawingType),
261 TestDisplayItem(second, backgroundDrawingType), 261 TestDisplayItem(second, backgroundDrawingType),
262 TestDisplayItem(second, foregroundDrawingType)); 262 TestDisplayItem(second, foregroundDrawingType));
263 263
264 paintController().invalidate(first, PaintInvalidationFull, nullptr); 264 paintController().invalidate(first);
265 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50) ); 265 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50) );
266 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50) ); 266 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50) );
267 paintController().commitNewDisplayItems(); 267 paintController().commitNewDisplayItems();
268 268
269 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 269 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
270 TestDisplayItem(second, backgroundDrawingType), 270 TestDisplayItem(second, backgroundDrawingType),
271 TestDisplayItem(second, foregroundDrawingType)); 271 TestDisplayItem(second, foregroundDrawingType));
272 } 272 }
273 273
274 TEST_F(PaintControllerTest, UpdateAddLastOverlap) 274 TEST_F(PaintControllerTest, UpdateAddLastOverlap)
275 { 275 {
276 TestDisplayItemClient first("first"); 276 TestDisplayItemClient first("first");
277 TestDisplayItemClient second("second"); 277 TestDisplayItemClient second("second");
278 GraphicsContext context(paintController()); 278 GraphicsContext context(paintController());
279 279
280 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 )); 280 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 ));
281 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150 )); 281 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150 ));
282 paintController().commitNewDisplayItems(); 282 paintController().commitNewDisplayItems();
283 283
284 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 284 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
285 TestDisplayItem(first, backgroundDrawingType), 285 TestDisplayItem(first, backgroundDrawingType),
286 TestDisplayItem(first, foregroundDrawingType)); 286 TestDisplayItem(first, foregroundDrawingType));
287 287
288 paintController().invalidate(first, PaintInvalidationFull, nullptr); 288 paintController().invalidate(first);
289 paintController().invalidate(second, PaintInvalidationFull, nullptr); 289 paintController().invalidate(second);
290 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 )); 290 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 ));
291 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150 )); 291 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150 ));
292 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50) ); 292 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50) );
293 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50) ); 293 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50) );
294 paintController().commitNewDisplayItems(); 294 paintController().commitNewDisplayItems();
295 295
296 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, 296 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4,
297 TestDisplayItem(first, backgroundDrawingType), 297 TestDisplayItem(first, backgroundDrawingType),
298 TestDisplayItem(first, foregroundDrawingType), 298 TestDisplayItem(first, foregroundDrawingType),
299 TestDisplayItem(second, backgroundDrawingType), 299 TestDisplayItem(second, backgroundDrawingType),
300 TestDisplayItem(second, foregroundDrawingType)); 300 TestDisplayItem(second, foregroundDrawingType));
301 301
302 paintController().invalidate(first, PaintInvalidationFull, nullptr); 302 paintController().invalidate(first);
303 paintController().invalidate(second, PaintInvalidationFull, nullptr); 303 paintController().invalidate(second);
304 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 )); 304 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 ));
305 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150 )); 305 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150 ));
306 paintController().commitNewDisplayItems(); 306 paintController().commitNewDisplayItems();
307 307
308 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 308 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
309 TestDisplayItem(first, backgroundDrawingType), 309 TestDisplayItem(first, backgroundDrawingType),
310 TestDisplayItem(first, foregroundDrawingType)); 310 TestDisplayItem(first, foregroundDrawingType));
311 } 311 }
312 312
313 TEST_F(PaintControllerTest, UpdateClip) 313 TEST_F(PaintControllerTest, UpdateClip)
314 { 314 {
315 TestDisplayItemClient first("first"); 315 TestDisplayItemClient first("first");
316 TestDisplayItemClient second("second"); 316 TestDisplayItemClient second("second");
317 GraphicsContext context(paintController()); 317 GraphicsContext context(paintController());
318 318
319 { 319 {
320 ClipRecorder clipRecorder(context, first, clipType, LayoutRect(1, 1, 2, 2)); 320 ClipRecorder clipRecorder(context, first, clipType, LayoutRect(1, 1, 2, 2));
321 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150)); 321 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150));
322 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150 , 150)); 322 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150 , 150));
323 } 323 }
324 paintController().commitNewDisplayItems(); 324 paintController().commitNewDisplayItems();
325 325
326 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, 326 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4,
327 TestDisplayItem(first, clipType), 327 TestDisplayItem(first, clipType),
328 TestDisplayItem(first, backgroundDrawingType), 328 TestDisplayItem(first, backgroundDrawingType),
329 TestDisplayItem(second, backgroundDrawingType), 329 TestDisplayItem(second, backgroundDrawingType),
330 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType))); 330 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType)));
331 331
332 paintController().invalidate(first, PaintInvalidationFull, nullptr); 332 paintController().invalidate(first);
333 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 )); 333 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 ));
334 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15 0)); 334 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15 0));
335 paintController().commitNewDisplayItems(); 335 paintController().commitNewDisplayItems();
336 336
337 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 337 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
338 TestDisplayItem(first, backgroundDrawingType), 338 TestDisplayItem(first, backgroundDrawingType),
339 TestDisplayItem(second, backgroundDrawingType)); 339 TestDisplayItem(second, backgroundDrawingType));
340 340
341 paintController().invalidate(second, PaintInvalidationFull, nullptr); 341 paintController().invalidate(second);
342 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 )); 342 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 ));
343 { 343 {
344 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2, 2)); 344 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2, 2));
345 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150 , 150)); 345 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150 , 150));
346 } 346 }
347 paintController().commitNewDisplayItems(); 347 paintController().commitNewDisplayItems();
348 348
349 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, 349 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4,
350 TestDisplayItem(first, backgroundDrawingType), 350 TestDisplayItem(first, backgroundDrawingType),
351 TestDisplayItem(second, clipType), 351 TestDisplayItem(second, clipType),
(...skipping 12 matching lines...) Expand all
364 paintController().commitNewDisplayItems(); 364 paintController().commitNewDisplayItems();
365 365
366 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 366 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
367 TestDisplayItem(first, backgroundDrawingType), 367 TestDisplayItem(first, backgroundDrawingType),
368 TestDisplayItem(second, backgroundDrawingType)); 368 TestDisplayItem(second, backgroundDrawingType));
369 EXPECT_TRUE(paintController().clientCacheIsValid(first)); 369 EXPECT_TRUE(paintController().clientCacheIsValid(first));
370 EXPECT_TRUE(paintController().clientCacheIsValid(second)); 370 EXPECT_TRUE(paintController().clientCacheIsValid(second));
371 const SkPicture* firstPicture = static_cast<const DrawingDisplayItem&>(paint Controller().displayItemList()[0]).picture(); 371 const SkPicture* firstPicture = static_cast<const DrawingDisplayItem&>(paint Controller().displayItemList()[0]).picture();
372 const SkPicture* secondPicture = static_cast<const DrawingDisplayItem&>(pain tController().displayItemList()[1]).picture(); 372 const SkPicture* secondPicture = static_cast<const DrawingDisplayItem&>(pain tController().displayItemList()[1]).picture();
373 373
374 paintController().invalidate(first, PaintInvalidationFull, nullptr); 374 paintController().invalidate(first);
375 EXPECT_FALSE(paintController().clientCacheIsValid(first)); 375 EXPECT_FALSE(paintController().clientCacheIsValid(first));
376 EXPECT_TRUE(paintController().clientCacheIsValid(second)); 376 EXPECT_TRUE(paintController().clientCacheIsValid(second));
377 377
378 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 )); 378 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150 ));
379 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15 0)); 379 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15 0));
380 paintController().commitNewDisplayItems(); 380 paintController().commitNewDisplayItems();
381 381
382 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 382 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
383 TestDisplayItem(first, backgroundDrawingType), 383 TestDisplayItem(first, backgroundDrawingType),
384 TestDisplayItem(second, backgroundDrawingType)); 384 TestDisplayItem(second, backgroundDrawingType));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 TestDisplayItem(container1, backgroundDrawingType), 416 TestDisplayItem(container1, backgroundDrawingType),
417 TestDisplayItem(content1, backgroundDrawingType), 417 TestDisplayItem(content1, backgroundDrawingType),
418 TestDisplayItem(content1, foregroundDrawingType), 418 TestDisplayItem(content1, foregroundDrawingType),
419 TestDisplayItem(container1, foregroundDrawingType), 419 TestDisplayItem(container1, foregroundDrawingType),
420 TestDisplayItem(container2, backgroundDrawingType), 420 TestDisplayItem(container2, backgroundDrawingType),
421 TestDisplayItem(content2, backgroundDrawingType), 421 TestDisplayItem(content2, backgroundDrawingType),
422 TestDisplayItem(content2, foregroundDrawingType), 422 TestDisplayItem(content2, foregroundDrawingType),
423 TestDisplayItem(container2, foregroundDrawingType)); 423 TestDisplayItem(container2, foregroundDrawingType));
424 424
425 // Simulate the situation when container1 e.g. gets a z-index that is now gr eater than container2. 425 // Simulate the situation when container1 e.g. gets a z-index that is now gr eater than container2.
426 paintController().invalidate(container1, PaintInvalidationFull, nullptr); 426 paintController().invalidate(container1);
427 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200, 100 , 100)); 427 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200, 100 , 100));
428 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 50, 2 00)); 428 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 50, 2 00));
429 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 50, 2 00)); 429 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 50, 2 00));
430 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200, 100 , 100)); 430 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200, 100 , 100));
431 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100, 100 , 100)); 431 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100, 100 , 100));
432 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 50, 2 00)); 432 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 50, 2 00));
433 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 50, 2 00)); 433 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 50, 2 00));
434 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100, 100 , 100)); 434 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100, 100 , 100));
435 paintController().commitNewDisplayItems(); 435 paintController().commitNewDisplayItems();
436 436
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 TestDisplayItem(container1, DisplayItem::EndSubsequence), 574 TestDisplayItem(container1, DisplayItem::EndSubsequence),
575 575
576 TestDisplayItem(container2, DisplayItem::Subsequence), 576 TestDisplayItem(container2, DisplayItem::Subsequence),
577 TestDisplayItem(container2, backgroundDrawingType), 577 TestDisplayItem(container2, backgroundDrawingType),
578 TestDisplayItem(content2, DisplayItem::Subsequence), 578 TestDisplayItem(content2, DisplayItem::Subsequence),
579 TestDisplayItem(content2, backgroundDrawingType), 579 TestDisplayItem(content2, backgroundDrawingType),
580 TestDisplayItem(content2, DisplayItem::EndSubsequence), 580 TestDisplayItem(content2, DisplayItem::EndSubsequence),
581 TestDisplayItem(container2, DisplayItem::EndSubsequence)); 581 TestDisplayItem(container2, DisplayItem::EndSubsequence));
582 582
583 // Invalidate container1 but not content1. 583 // Invalidate container1 but not content1.
584 paintController().invalidate(container1, PaintInvalidationFull, nullptr); 584 paintController().invalidate(container1);
585 585
586 // Container2 itself now becomes empty (but still has the 'content2' child), 586 // Container2 itself now becomes empty (but still has the 'content2' child),
587 // and chooses not to output subsequence info. 587 // and chooses not to output subsequence info.
588 588
589 paintController().invalidate(container2, PaintInvalidationFull, nullptr); 589 paintController().invalidate(container2);
590 paintController().invalidate(content2, PaintInvalidationFull, nullptr); 590 paintController().invalidate(content2);
591 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co ntainer2)); 591 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co ntainer2));
592 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co ntent2)); 592 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co ntent2));
593 // Content2 now outputs foreground only. 593 // Content2 now outputs foreground only.
594 { 594 {
595 SubsequenceRecorder r(context, content2); 595 SubsequenceRecorder r(context, content2);
596 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5 0, 200)); 596 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5 0, 200));
597 } 597 }
598 // Repaint container1 with foreground only. 598 // Repaint container1 with foreground only.
599 { 599 {
600 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context , container1)); 600 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context , container1));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 paintController().commitNewDisplayItems(); 676 paintController().commitNewDisplayItems();
677 677
678 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, 678 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3,
679 TestDisplayItem(multicol, backgroundDrawingType), 679 TestDisplayItem(multicol, backgroundDrawingType),
680 TestDisplayItem(content, foregroundDrawingType), 680 TestDisplayItem(content, foregroundDrawingType),
681 TestDisplayItem(content, foregroundDrawingType)); 681 TestDisplayItem(content, foregroundDrawingType));
682 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(paintController() .displayItemList()[1]).picture()); 682 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(paintController() .displayItemList()[1]).picture());
683 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(paintController() .displayItemList()[2]).picture()); 683 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(paintController() .displayItemList()[2]).picture());
684 684
685 // Now the multicol becomes 3 columns and repaints. 685 // Now the multicol becomes 3 columns and repaints.
686 paintController().invalidate(multicol, PaintInvalidationFull, nullptr); 686 paintController().invalidate(multicol);
687 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100, 100)); 687 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100, 100));
688 688
689 paintController().beginScope(); 689 paintController().beginScope();
690 drawRect(context, content, foregroundDrawingType, rect1); 690 drawRect(context, content, foregroundDrawingType, rect1);
691 paintController().endScope(); 691 paintController().endScope();
692 692
693 paintController().beginScope(); 693 paintController().beginScope();
694 drawRect(context, content, foregroundDrawingType, rect2); 694 drawRect(context, content, foregroundDrawingType, rect2);
695 paintController().endScope(); 695 paintController().endScope();
696 696
(...skipping 28 matching lines...) Expand all
725 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 725 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100));
726 726
727 paintController().commitNewDisplayItems(); 727 paintController().commitNewDisplayItems();
728 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 5, 728 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 5,
729 TestDisplayItem(first, backgroundDrawingType), 729 TestDisplayItem(first, backgroundDrawingType),
730 TestDisplayItem(second, DisplayItem::BeginClipPath), 730 TestDisplayItem(second, DisplayItem::BeginClipPath),
731 TestDisplayItem(second, backgroundDrawingType), 731 TestDisplayItem(second, backgroundDrawingType),
732 TestDisplayItem(second, DisplayItem::EndClipPath), 732 TestDisplayItem(second, DisplayItem::EndClipPath),
733 TestDisplayItem(third, backgroundDrawingType)); 733 TestDisplayItem(third, backgroundDrawingType));
734 734
735 paintController().invalidate(second, PaintInvalidationFull, nullptr); 735 paintController().invalidate(second);
736 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 736 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100));
737 { 737 {
738 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2, 2)); 738 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2, 2));
739 // Do not draw anything for second. 739 // Do not draw anything for second.
740 } 740 }
741 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 741 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100));
742 paintController().commitNewDisplayItems(); 742 paintController().commitNewDisplayItems();
743 743
744 // Empty clips should have been optimized out. 744 // Empty clips should have been optimized out.
745 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, 745 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2,
746 TestDisplayItem(first, backgroundDrawingType), 746 TestDisplayItem(first, backgroundDrawingType),
747 TestDisplayItem(third, backgroundDrawingType)); 747 TestDisplayItem(third, backgroundDrawingType));
748 748
749 paintController().invalidate(second, PaintInvalidationFull, nullptr); 749 paintController().invalidate(second);
750 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 750 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100));
751 { 751 {
752 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2, 2)); 752 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2, 2));
753 { 753 {
754 ClipPathRecorder clipPathRecorder(context, second, Path()); 754 ClipPathRecorder clipPathRecorder(context, second, Path());
755 // Do not draw anything for second. 755 // Do not draw anything for second.
756 } 756 }
757 } 757 }
758 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 758 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100));
759 paintController().commitNewDisplayItems(); 759 paintController().commitNewDisplayItems();
(...skipping 13 matching lines...) Expand all
773 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 773 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100));
774 774
775 paintController().commitNewDisplayItems(); 775 paintController().commitNewDisplayItems();
776 const auto& paintChunks = paintController().paintChunks(); 776 const auto& paintChunks = paintController().paintChunks();
777 ASSERT_EQ(1u, paintChunks.size()); 777 ASSERT_EQ(1u, paintChunks.size());
778 EXPECT_EQ(0u, paintChunks[0].beginIndex); 778 EXPECT_EQ(0u, paintChunks[0].beginIndex);
779 EXPECT_EQ(1u, paintChunks[0].endIndex); 779 EXPECT_EQ(1u, paintChunks[0].endIndex);
780 } 780 }
781 781
782 } // namespace blink 782 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698