OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "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/ClipPathDisplayItem.h" | 9 #include "platform/graphics/paint/ClipPathDisplayItem.h" |
10 #include "platform/graphics/paint/ClipPathRecorder.h" | 10 #include "platform/graphics/paint/ClipPathRecorder.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 drawClippedRect(context, client, clipType, backgroundDrawingType, FloatRect(
100, 100, 200, 200)); | 151 drawClippedRect(context, client, clipType, backgroundDrawingType, FloatRect(
100, 100, 200, 200)); |
152 getPaintController().commitNewDisplayItems(); | 152 getPaintController().commitNewDisplayItems(); |
153 | 153 |
154 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, | 154 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, |
155 TestDisplayItem(client, clipType), | 155 TestDisplayItem(client, clipType), |
156 TestDisplayItem(client, backgroundDrawingType), | 156 TestDisplayItem(client, backgroundDrawingType), |
157 TestDisplayItem(client, DisplayItem::clipTypeToEndClipType(clipType))); | 157 TestDisplayItem(client, DisplayItem::clipTypeToEndClipType(clipType))); |
158 | 158 |
159 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 159 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
160 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 160 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
161 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 161 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
162 FloatRect(LayoutRect::infiniteIntRect()))); | 162 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 TEST_P(PaintControllerTest, UpdateBasic) | 166 TEST_P(PaintControllerTest, UpdateBasic) |
167 { | 167 { |
168 FakeDisplayItemClient first("first", LayoutRect(100, 100, 300, 300)); | 168 FakeDisplayItemClient first("first", LayoutRect(100, 100, 300, 300)); |
169 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); | 169 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); |
170 GraphicsContext context(getPaintController()); | 170 GraphicsContext context(getPaintController()); |
171 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 171 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
172 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 172 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
173 | 173 |
174 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); | 174 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); |
175 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 20
0)); | 175 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 20
0)); |
176 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); | 176 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); |
177 | 177 |
178 EXPECT_EQ(0, numCachedNewItems()); | 178 EXPECT_EQ(0, numCachedNewItems()); |
179 | 179 |
180 getPaintController().commitNewDisplayItems(); | 180 getPaintController().commitNewDisplayItems(); |
181 | 181 |
182 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, | 182 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, |
183 TestDisplayItem(first, backgroundDrawingType), | 183 TestDisplayItem(first, backgroundDrawingType), |
184 TestDisplayItem(second, backgroundDrawingType), | 184 TestDisplayItem(second, backgroundDrawingType), |
185 TestDisplayItem(first, foregroundDrawingType)); | 185 TestDisplayItem(first, foregroundDrawingType)); |
186 | 186 |
187 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 187 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
188 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 188 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
189 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 189 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
190 FloatRect(LayoutRect::infiniteIntRect()))); | 190 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
191 | 191 |
192 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 192 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
193 } | 193 } |
194 | 194 |
195 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); | 195 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); |
196 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); | 196 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); |
197 | 197 |
198 EXPECT_EQ(2, numCachedNewItems()); | 198 EXPECT_EQ(2, numCachedNewItems()); |
199 #ifndef NDEBUG | 199 #ifndef NDEBUG |
200 EXPECT_EQ(2, numSequentialMatches()); | 200 EXPECT_EQ(2, numSequentialMatches()); |
201 EXPECT_EQ(0, numOutOfOrderMatches()); | 201 EXPECT_EQ(0, numOutOfOrderMatches()); |
202 EXPECT_EQ(1, numIndexedItems()); | 202 EXPECT_EQ(1, numIndexedItems()); |
203 #endif | 203 #endif |
204 | 204 |
205 getPaintController().commitNewDisplayItems(); | 205 getPaintController().commitNewDisplayItems(); |
206 | 206 |
207 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, | 207 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, |
208 TestDisplayItem(first, backgroundDrawingType), | 208 TestDisplayItem(first, backgroundDrawingType), |
209 TestDisplayItem(first, foregroundDrawingType)); | 209 TestDisplayItem(first, foregroundDrawingType)); |
210 | 210 |
211 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 211 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
212 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 212 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
213 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 213 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
214 FloatRect(100, 100, 200, 200))); // |second| disappeared from the ch
unk. | 214 EXPECT_EQ(IntRect(100, 100, 200, 200), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 TEST_P(PaintControllerTest, UpdateSwapOrder) | 218 TEST_P(PaintControllerTest, UpdateSwapOrder) |
219 { | 219 { |
220 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); | 220 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); |
221 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); | 221 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); |
222 FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10))
; | 222 FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10))
; |
223 GraphicsContext context(getPaintController()); | 223 GraphicsContext context(getPaintController()); |
224 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 224 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, | 261 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, |
262 TestDisplayItem(second, backgroundDrawingType), | 262 TestDisplayItem(second, backgroundDrawingType), |
263 TestDisplayItem(second, foregroundDrawingType), | 263 TestDisplayItem(second, foregroundDrawingType), |
264 TestDisplayItem(first, backgroundDrawingType), | 264 TestDisplayItem(first, backgroundDrawingType), |
265 TestDisplayItem(first, foregroundDrawingType), | 265 TestDisplayItem(first, foregroundDrawingType), |
266 TestDisplayItem(unaffected, backgroundDrawingType), | 266 TestDisplayItem(unaffected, backgroundDrawingType), |
267 TestDisplayItem(unaffected, foregroundDrawingType)); | 267 TestDisplayItem(unaffected, foregroundDrawingType)); |
268 | 268 |
269 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 269 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
270 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 270 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
271 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 271 |
272 FloatRect(100, 100, 50, 200))); // Bounds of |second|. | 272 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
| 273 EXPECT_EQ(IntRect(100, 100, 50, 200), getPaintController().paintChunks()
[0].rasterInvalidationRects[0].rect); // Bounds of |second|. |
273 } | 274 } |
274 } | 275 } |
275 | 276 |
276 TEST_P(PaintControllerTest, UpdateSwapOrderWithInvalidation) | 277 TEST_P(PaintControllerTest, UpdateSwapOrderWithInvalidation) |
277 { | 278 { |
278 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); | 279 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); |
279 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); | 280 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); |
280 FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10))
; | 281 FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10))
; |
281 GraphicsContext context(getPaintController()); | 282 GraphicsContext context(getPaintController()); |
282 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 283 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, | 322 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, |
322 TestDisplayItem(second, backgroundDrawingType), | 323 TestDisplayItem(second, backgroundDrawingType), |
323 TestDisplayItem(second, foregroundDrawingType), | 324 TestDisplayItem(second, foregroundDrawingType), |
324 TestDisplayItem(first, backgroundDrawingType), | 325 TestDisplayItem(first, backgroundDrawingType), |
325 TestDisplayItem(first, foregroundDrawingType), | 326 TestDisplayItem(first, foregroundDrawingType), |
326 TestDisplayItem(unaffected, backgroundDrawingType), | 327 TestDisplayItem(unaffected, backgroundDrawingType), |
327 TestDisplayItem(unaffected, foregroundDrawingType)); | 328 TestDisplayItem(unaffected, foregroundDrawingType)); |
328 | 329 |
329 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 330 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
330 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 331 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
331 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 332 EXPECT_EQ(2u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
332 FloatRect(100, 100, 100, 100), // Old bounds of |first|. | 333 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // Old bounds of |first|. |
333 FloatRect(100, 100, 100, 100))); // New bounds of |first|. | 334 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[1].rect); // New bounds of |first|. |
334 // No need to invalidate raster of |second| because the client (|first|)
which swapped order | 335 // No need to invalidate raster of |second| because the client (|first|)
which swapped order |
335 // with it has been invalidated. | 336 // with it has been invalidated. |
336 } | 337 } |
337 } | 338 } |
338 | 339 |
339 TEST_P(PaintControllerTest, UpdateNewItemInMiddle) | 340 TEST_P(PaintControllerTest, UpdateNewItemInMiddle) |
340 { | 341 { |
341 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); | 342 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); |
342 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); | 343 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); |
343 FakeDisplayItemClient third("third", LayoutRect(125, 100, 200, 50)); | 344 FakeDisplayItemClient third("third", LayoutRect(125, 100, 200, 50)); |
(...skipping 25 matching lines...) Expand all Loading... |
369 | 370 |
370 getPaintController().commitNewDisplayItems(); | 371 getPaintController().commitNewDisplayItems(); |
371 | 372 |
372 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, | 373 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, |
373 TestDisplayItem(first, backgroundDrawingType), | 374 TestDisplayItem(first, backgroundDrawingType), |
374 TestDisplayItem(third, backgroundDrawingType), | 375 TestDisplayItem(third, backgroundDrawingType), |
375 TestDisplayItem(second, backgroundDrawingType)); | 376 TestDisplayItem(second, backgroundDrawingType)); |
376 | 377 |
377 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 378 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
378 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 379 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
379 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 380 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
380 FloatRect(125, 100, 200, 50))); // |third| newly appeared in the chu
nk. | 381 EXPECT_EQ(IntRect(125, 100, 200, 50), getPaintController().paintChunks()
[0].rasterInvalidationRects[0].rect); |
381 } | 382 } |
382 } | 383 } |
383 | 384 |
384 TEST_P(PaintControllerTest, UpdateInvalidationWithPhases) | 385 TEST_P(PaintControllerTest, UpdateInvalidationWithPhases) |
385 { | 386 { |
386 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); | 387 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); |
387 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); | 388 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); |
388 FakeDisplayItemClient third("third", LayoutRect(300, 100, 50, 50)); | 389 FakeDisplayItemClient third("third", LayoutRect(300, 100, 50, 50)); |
389 GraphicsContext context(getPaintController()); | 390 GraphicsContext context(getPaintController()); |
390 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 391 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, | 430 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, |
430 TestDisplayItem(first, backgroundDrawingType), | 431 TestDisplayItem(first, backgroundDrawingType), |
431 TestDisplayItem(second, backgroundDrawingType), | 432 TestDisplayItem(second, backgroundDrawingType), |
432 TestDisplayItem(third, backgroundDrawingType), | 433 TestDisplayItem(third, backgroundDrawingType), |
433 TestDisplayItem(first, foregroundDrawingType), | 434 TestDisplayItem(first, foregroundDrawingType), |
434 TestDisplayItem(second, foregroundDrawingType), | 435 TestDisplayItem(second, foregroundDrawingType), |
435 TestDisplayItem(third, foregroundDrawingType)); | 436 TestDisplayItem(third, foregroundDrawingType)); |
436 | 437 |
437 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 438 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
438 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 439 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
439 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 440 EXPECT_EQ(2u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
440 FloatRect(100, 100, 50, 200), // Old bounds of |second|. | 441 EXPECT_EQ(IntRect(100, 100, 50, 200), getPaintController().paintChunks()
[0].rasterInvalidationRects[0].rect); // Old bounds of |second|. |
441 FloatRect(100, 100, 50, 200))); // New bounds of |second|. | 442 EXPECT_EQ(IntRect(100, 100, 50, 200), getPaintController().paintChunks()
[0].rasterInvalidationRects[1].rect); // New bounds of |second|. |
442 } | 443 } |
443 } | 444 } |
444 | 445 |
445 TEST_P(PaintControllerTest, UpdateAddFirstOverlap) | 446 TEST_P(PaintControllerTest, UpdateAddFirstOverlap) |
446 { | 447 { |
447 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); | 448 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); |
448 FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); | 449 FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); |
449 GraphicsContext context(getPaintController()); | 450 GraphicsContext context(getPaintController()); |
450 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 451 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
451 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 452 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
(...skipping 20 matching lines...) Expand all Loading... |
472 getPaintController().commitNewDisplayItems(); | 473 getPaintController().commitNewDisplayItems(); |
473 | 474 |
474 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, | 475 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, |
475 TestDisplayItem(first, backgroundDrawingType), | 476 TestDisplayItem(first, backgroundDrawingType), |
476 TestDisplayItem(first, foregroundDrawingType), | 477 TestDisplayItem(first, foregroundDrawingType), |
477 TestDisplayItem(second, backgroundDrawingType), | 478 TestDisplayItem(second, backgroundDrawingType), |
478 TestDisplayItem(second, foregroundDrawingType)); | 479 TestDisplayItem(second, foregroundDrawingType)); |
479 | 480 |
480 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 481 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
481 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 482 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
482 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 483 EXPECT_EQ(3u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
483 FloatRect(100, 100, 150, 150), // |first| newly appeared in the chun
k. | 484 EXPECT_EQ(IntRect(200, 200, 50, 50), getPaintController().paintChunks()[
0].rasterInvalidationRects[0].rect); // Old bounds of |second|. |
484 FloatRect(200, 200, 50, 50), // Old bounds of |second|. | 485 EXPECT_EQ(IntRect(100, 100, 150, 150), getPaintController().paintChunks(
)[0].rasterInvalidationRects[1].rect); // |first| newly appeared in the chunk. |
485 FloatRect(150, 150, 100, 100))); // New bounds of |second|. | 486 EXPECT_EQ(IntRect(150, 150, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[2].rect); // New bounds of |second|. |
486 | 487 |
487 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 488 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
488 } | 489 } |
489 | 490 |
490 drawRect(context, second, backgroundDrawingType, FloatRect(150, 150, 100, 10
0)); | 491 drawRect(context, second, backgroundDrawingType, FloatRect(150, 150, 100, 10
0)); |
491 drawRect(context, second, foregroundDrawingType, FloatRect(150, 150, 100, 10
0)); | 492 drawRect(context, second, foregroundDrawingType, FloatRect(150, 150, 100, 10
0)); |
492 | 493 |
493 EXPECT_EQ(2, numCachedNewItems()); | 494 EXPECT_EQ(2, numCachedNewItems()); |
494 #ifndef NDEBUG | 495 #ifndef NDEBUG |
495 EXPECT_EQ(2, numSequentialMatches()); | 496 EXPECT_EQ(2, numSequentialMatches()); |
496 EXPECT_EQ(0, numOutOfOrderMatches()); | 497 EXPECT_EQ(0, numOutOfOrderMatches()); |
497 EXPECT_EQ(2, numIndexedItems()); | 498 EXPECT_EQ(2, numIndexedItems()); |
498 #endif | 499 #endif |
499 | 500 |
500 getPaintController().commitNewDisplayItems(); | 501 getPaintController().commitNewDisplayItems(); |
501 | 502 |
502 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, | 503 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, |
503 TestDisplayItem(second, backgroundDrawingType), | 504 TestDisplayItem(second, backgroundDrawingType), |
504 TestDisplayItem(second, foregroundDrawingType)); | 505 TestDisplayItem(second, foregroundDrawingType)); |
505 | 506 |
506 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 507 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
507 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 508 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
508 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 509 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
509 FloatRect(100, 100, 150, 150))); // |first| disappeared from the chu
nk. | 510 EXPECT_EQ(IntRect(100, 100, 150, 150), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // |first| disappeared from the chunk. |
510 } | 511 } |
511 } | 512 } |
512 | 513 |
513 TEST_P(PaintControllerTest, UpdateAddLastOverlap) | 514 TEST_P(PaintControllerTest, UpdateAddLastOverlap) |
514 { | 515 { |
515 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); | 516 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); |
516 FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); | 517 FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); |
517 GraphicsContext context(getPaintController()); | 518 GraphicsContext context(getPaintController()); |
518 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 519 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
519 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 520 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
(...skipping 20 matching lines...) Expand all Loading... |
540 getPaintController().commitNewDisplayItems(); | 541 getPaintController().commitNewDisplayItems(); |
541 | 542 |
542 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, | 543 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, |
543 TestDisplayItem(first, backgroundDrawingType), | 544 TestDisplayItem(first, backgroundDrawingType), |
544 TestDisplayItem(first, foregroundDrawingType), | 545 TestDisplayItem(first, foregroundDrawingType), |
545 TestDisplayItem(second, backgroundDrawingType), | 546 TestDisplayItem(second, backgroundDrawingType), |
546 TestDisplayItem(second, foregroundDrawingType)); | 547 TestDisplayItem(second, foregroundDrawingType)); |
547 | 548 |
548 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 549 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
549 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 550 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
550 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 551 EXPECT_EQ(3u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
551 FloatRect(100, 100, 150, 150), // Old bounds of |first|. | 552 EXPECT_EQ(IntRect(100, 100, 150, 150), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // Old bounds of |first|. |
552 FloatRect(150, 150, 100, 100), // New bounds of |first|. | 553 EXPECT_EQ(IntRect(150, 150, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[1].rect); // New bounds of |first|. |
553 FloatRect(200, 200, 50, 50))); // |second| newly appeared in the chu
nk. | 554 EXPECT_EQ(IntRect(200, 200, 50, 50), getPaintController().paintChunks()[
0].rasterInvalidationRects[2].rect); // |second| newly appeared in the chunk. |
554 | 555 |
555 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 556 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
556 } | 557 } |
557 | 558 |
558 first.setDisplayItemsUncached(); | 559 first.setDisplayItemsUncached(); |
559 first.setVisualRect(LayoutRect(100, 100, 150, 150)); | 560 first.setVisualRect(LayoutRect(100, 100, 150, 150)); |
560 second.setDisplayItemsUncached(); | 561 second.setDisplayItemsUncached(); |
561 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 562 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
562 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 563 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
563 EXPECT_EQ(0, numCachedNewItems()); | 564 EXPECT_EQ(0, numCachedNewItems()); |
564 getPaintController().commitNewDisplayItems(); | 565 getPaintController().commitNewDisplayItems(); |
565 | 566 |
566 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, | 567 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, |
567 TestDisplayItem(first, backgroundDrawingType), | 568 TestDisplayItem(first, backgroundDrawingType), |
568 TestDisplayItem(first, foregroundDrawingType)); | 569 TestDisplayItem(first, foregroundDrawingType)); |
569 | 570 |
570 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 571 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
571 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 572 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
572 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 573 |
573 FloatRect(150, 150, 100, 100), // Old bounds of |first|. | 574 EXPECT_EQ(3u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
574 FloatRect(100, 100, 150, 150), // New bounds of |first|. | 575 EXPECT_EQ(IntRect(150, 150, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // Old bounds of |first|. |
575 FloatRect(200, 200, 50, 50))); // |second| disappeared from the chun
k. | 576 EXPECT_EQ(IntRect(200, 200, 50, 50), getPaintController().paintChunks()[
0].rasterInvalidationRects[1].rect); // |second| disappeared from the chunk. |
| 577 EXPECT_EQ(IntRect(100, 100, 150, 150), getPaintController().paintChunks(
)[0].rasterInvalidationRects[2].rect); // New bounds of |first|. |
576 } | 578 } |
577 } | 579 } |
578 | 580 |
579 TEST_P(PaintControllerTest, UpdateClip) | 581 TEST_P(PaintControllerTest, UpdateClip) |
580 { | 582 { |
581 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); | 583 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); |
582 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); | 584 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); |
583 GraphicsContext context(getPaintController()); | 585 GraphicsContext context(getPaintController()); |
584 | 586 |
585 { | 587 { |
(...skipping 30 matching lines...) Expand all Loading... |
616 #endif | 618 #endif |
617 | 619 |
618 getPaintController().commitNewDisplayItems(); | 620 getPaintController().commitNewDisplayItems(); |
619 | 621 |
620 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, | 622 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, |
621 TestDisplayItem(first, backgroundDrawingType), | 623 TestDisplayItem(first, backgroundDrawingType), |
622 TestDisplayItem(second, backgroundDrawingType)); | 624 TestDisplayItem(second, backgroundDrawingType)); |
623 | 625 |
624 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 626 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
625 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 627 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
626 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | |
627 FloatRect(LayoutRect::infiniteIntRect()))); // This is a new chunk. | |
628 | 628 |
| 629 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
| 630 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); // This is a new chunk. |
629 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 631 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
630 } | 632 } |
631 | 633 |
632 second.setDisplayItemsUncached(); | 634 second.setDisplayItemsUncached(); |
633 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 635 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
634 { | 636 { |
635 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 637 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
636 PaintChunk::Id id(second, clipType); | 638 PaintChunk::Id id(second, clipType); |
637 PaintChunkProperties properties; | 639 PaintChunkProperties properties; |
638 properties.clip = ClipPaintPropertyNode::create(nullptr, nullptr, Fl
oatRoundedRect(1, 1, 2, 2)); | 640 properties.clip = ClipPaintPropertyNode::create(nullptr, nullptr, Fl
oatRoundedRect(1, 1, 2, 2)); |
639 getPaintController().updateCurrentPaintChunkProperties(&id, properti
es); | 641 getPaintController().updateCurrentPaintChunkProperties(&id, properti
es); |
640 } | 642 } |
641 ClipRecorder clipRecorder(context, second, clipType, IntRect(1, 1, 2, 2)
); | 643 ClipRecorder clipRecorder(context, second, clipType, IntRect(1, 1, 2, 2)
); |
642 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200
, 200)); | 644 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200
, 200)); |
643 } | 645 } |
644 getPaintController().commitNewDisplayItems(); | 646 getPaintController().commitNewDisplayItems(); |
645 | 647 |
646 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, | 648 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, |
647 TestDisplayItem(first, backgroundDrawingType), | 649 TestDisplayItem(first, backgroundDrawingType), |
648 TestDisplayItem(second, clipType), | 650 TestDisplayItem(second, clipType), |
649 TestDisplayItem(second, backgroundDrawingType), | 651 TestDisplayItem(second, backgroundDrawingType), |
650 TestDisplayItem(second, DisplayItem::clipTypeToEndClipType(clipType))); | 652 TestDisplayItem(second, DisplayItem::clipTypeToEndClipType(clipType))); |
651 | 653 |
652 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 654 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
653 EXPECT_EQ(2u, getPaintController().paintChunks().size()); | 655 EXPECT_EQ(2u, getPaintController().paintChunks().size()); |
654 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 656 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
655 FloatRect(100, 100, 200, 200))); // |second| disappeared from the fi
rst chunk. | 657 EXPECT_EQ(IntRect(100, 100, 200, 200), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // |second| disappeared from the first ch
unk. |
656 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre( | 658 |
657 FloatRect(LayoutRect::infiniteIntRect()))); // This is a new chunk. | 659 EXPECT_EQ(1u, getPaintController().paintChunks()[1].rasterInvalidationRe
cts.size()); |
| 660 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[1].rasterInvalidationRects[0].rect); // This is a new chunk. |
658 } | 661 } |
659 } | 662 } |
660 | 663 |
661 TEST_P(PaintControllerTest, CachedDisplayItems) | 664 TEST_P(PaintControllerTest, CachedDisplayItems) |
662 { | 665 { |
663 FakeDisplayItemClient first("first"); | 666 FakeDisplayItemClient first("first"); |
664 FakeDisplayItemClient second("second"); | 667 FakeDisplayItemClient second("second"); |
665 GraphicsContext context(getPaintController()); | 668 GraphicsContext context(getPaintController()); |
666 | 669 |
667 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 670 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 TestDisplayItem(content2, backgroundDrawingType), | 752 TestDisplayItem(content2, backgroundDrawingType), |
750 TestDisplayItem(content2, foregroundDrawingType), | 753 TestDisplayItem(content2, foregroundDrawingType), |
751 TestDisplayItem(container2, foregroundDrawingType), | 754 TestDisplayItem(container2, foregroundDrawingType), |
752 TestDisplayItem(container1, backgroundDrawingType), | 755 TestDisplayItem(container1, backgroundDrawingType), |
753 TestDisplayItem(content1, backgroundDrawingType), | 756 TestDisplayItem(content1, backgroundDrawingType), |
754 TestDisplayItem(content1, foregroundDrawingType), | 757 TestDisplayItem(content1, foregroundDrawingType), |
755 TestDisplayItem(container1, foregroundDrawingType)); | 758 TestDisplayItem(container1, foregroundDrawingType)); |
756 | 759 |
757 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 760 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
758 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 761 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
759 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 762 EXPECT_EQ(2u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
760 FloatRect(100, 200, 100, 100), // Bounds of |container2| which was m
oved behind |container1|. | 763 EXPECT_EQ(IntRect(100, 200, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // Bounds of |container2| which was moved
behind |container1|. |
761 FloatRect(100, 200, 50, 200))); // Bounds of |content2| which was mo
ved along with |container2|. | 764 EXPECT_EQ(IntRect(100, 200, 50, 200), getPaintController().paintChunks()
[0].rasterInvalidationRects[1].rect); // Bounds of |content2| which was moved al
ong with |container2|. |
762 } | 765 } |
763 } | 766 } |
764 | 767 |
765 TEST_P(PaintControllerTest, UpdateSwapOrderWithChildrenAndInvalidation) | 768 TEST_P(PaintControllerTest, UpdateSwapOrderWithChildrenAndInvalidation) |
766 { | 769 { |
767 FakeDisplayItemClient container1("container1", LayoutRect(100, 100, 100, 100
)); | 770 FakeDisplayItemClient container1("container1", LayoutRect(100, 100, 100, 100
)); |
768 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); | 771 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); |
769 FakeDisplayItemClient container2("container2", LayoutRect(100, 200, 100, 100
)); | 772 FakeDisplayItemClient container2("container2", LayoutRect(100, 200, 100, 100
)); |
770 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); | 773 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); |
771 GraphicsContext context(getPaintController()); | 774 GraphicsContext context(getPaintController()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 TestDisplayItem(content2, backgroundDrawingType), | 816 TestDisplayItem(content2, backgroundDrawingType), |
814 TestDisplayItem(content2, foregroundDrawingType), | 817 TestDisplayItem(content2, foregroundDrawingType), |
815 TestDisplayItem(container2, foregroundDrawingType), | 818 TestDisplayItem(container2, foregroundDrawingType), |
816 TestDisplayItem(container1, backgroundDrawingType), | 819 TestDisplayItem(container1, backgroundDrawingType), |
817 TestDisplayItem(content1, backgroundDrawingType), | 820 TestDisplayItem(content1, backgroundDrawingType), |
818 TestDisplayItem(content1, foregroundDrawingType), | 821 TestDisplayItem(content1, foregroundDrawingType), |
819 TestDisplayItem(container1, foregroundDrawingType)); | 822 TestDisplayItem(container1, foregroundDrawingType)); |
820 | 823 |
821 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 824 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
822 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 825 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
823 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 826 EXPECT_EQ(4u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
824 FloatRect(100, 100, 100, 100), // Old bounds of |container1|. | 827 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // Old bounds of |container1|. |
825 FloatRect(100, 100, 100, 100), // New bounds of |container1|. | 828 EXPECT_EQ(IntRect(100, 200, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[1].rect); // Bounds of |container2| which was moved
behind |container1|. |
826 FloatRect(100, 200, 100, 100), // Bounds of |container2| which was m
oved behind |container1|. | 829 EXPECT_EQ(IntRect(100, 200, 50, 200), getPaintController().paintChunks()
[0].rasterInvalidationRects[2].rect); // Bounds of |content2| which was moved al
ong with |container2|. |
827 FloatRect(100, 200, 50, 200))); // Bounds of |content2| which was mo
ved along with |container2|. | 830 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[3].rect); // New bounds of |container1|. |
828 } | 831 } |
829 } | 832 } |
830 | 833 |
831 TEST_P(PaintControllerTest, CachedSubsequenceSwapOrder) | 834 TEST_P(PaintControllerTest, CachedSubsequenceSwapOrder) |
832 { | 835 { |
833 FakeDisplayItemClient container1("container1", LayoutRect(100, 100, 100, 100
)); | 836 FakeDisplayItemClient container1("container1", LayoutRect(100, 100, 100, 100
)); |
834 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); | 837 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); |
835 FakeDisplayItemClient container2("container2", LayoutRect(100, 200, 100, 100
)); | 838 FakeDisplayItemClient container2("container2", LayoutRect(100, 200, 100, 100
)); |
836 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); | 839 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); |
837 GraphicsContext context(getPaintController()); | 840 GraphicsContext context(getPaintController()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 TestDisplayItem(container2, backgroundDrawingType), | 880 TestDisplayItem(container2, backgroundDrawingType), |
878 TestDisplayItem(content2, backgroundDrawingType), | 881 TestDisplayItem(content2, backgroundDrawingType), |
879 TestDisplayItem(content2, foregroundDrawingType), | 882 TestDisplayItem(content2, foregroundDrawingType), |
880 TestDisplayItem(container2, foregroundDrawingType), | 883 TestDisplayItem(container2, foregroundDrawingType), |
881 TestDisplayItem(container2, DisplayItem::kEndSubsequence)); | 884 TestDisplayItem(container2, DisplayItem::kEndSubsequence)); |
882 | 885 |
883 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 886 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
884 EXPECT_EQ(2u, getPaintController().paintChunks().size()); | 887 EXPECT_EQ(2u, getPaintController().paintChunks().size()); |
885 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); | 888 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); |
886 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); | 889 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); |
887 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 890 |
888 FloatRect(LayoutRect::infiniteIntRect()))); | 891 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
889 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre( | 892 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); // Old bounds of |container1|. |
890 FloatRect(LayoutRect::infiniteIntRect()))); | 893 EXPECT_EQ(1u, getPaintController().paintChunks()[1].rasterInvalidationRe
cts.size()); |
| 894 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[1].rasterInvalidationRects[0].rect); // Old bounds of |container1|. |
891 } | 895 } |
892 | 896 |
893 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. | 897 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. |
894 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 898 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
895 // When under-invalidation-checking is enabled, useCachedSubsequenceIfPo
ssible is forced off, | 899 // When under-invalidation-checking is enabled, useCachedSubsequenceIfPo
ssible is forced off, |
896 // and the client is expected to create the same painting as in the prev
ious paint. | 900 // and the client is expected to create the same painting as in the prev
ious paint. |
897 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context
, container2)); | 901 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context
, container2)); |
898 { | 902 { |
899 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 903 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
900 PaintChunk::Id id(container2, backgroundDrawingType); | 904 PaintChunk::Id id(container2, backgroundDrawingType); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, | 999 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 4, |
996 TestDisplayItem(container1, backgroundDrawingType), | 1000 TestDisplayItem(container1, backgroundDrawingType), |
997 TestDisplayItem(content1, backgroundDrawingType), | 1001 TestDisplayItem(content1, backgroundDrawingType), |
998 TestDisplayItem(container2, backgroundDrawingType), | 1002 TestDisplayItem(container2, backgroundDrawingType), |
999 TestDisplayItem(content2, backgroundDrawingType)); | 1003 TestDisplayItem(content2, backgroundDrawingType)); |
1000 | 1004 |
1001 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1005 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1002 EXPECT_EQ(2u, getPaintController().paintChunks().size()); | 1006 EXPECT_EQ(2u, getPaintController().paintChunks().size()); |
1003 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); | 1007 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); |
1004 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); | 1008 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); |
1005 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 1009 |
1006 FloatRect(LayoutRect::infiniteIntRect()))); | 1010 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
1007 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre( | 1011 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
1008 FloatRect(LayoutRect::infiniteIntRect()))); | 1012 EXPECT_EQ(1u, getPaintController().paintChunks()[1].rasterInvalidationRe
cts.size()); |
| 1013 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[1].rasterInvalidationRects[0].rect); |
1009 } | 1014 } |
1010 | 1015 |
1011 // Move content2 into container1, without invalidation. | 1016 // Move content2 into container1, without invalidation. |
1012 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1017 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1013 PaintChunk::Id id(container1, backgroundDrawingType); | 1018 PaintChunk::Id id(container1, backgroundDrawingType); |
1014 getPaintController().updateCurrentPaintChunkProperties(&id, container1Pr
operties); | 1019 getPaintController().updateCurrentPaintChunkProperties(&id, container1Pr
operties); |
1015 } | 1020 } |
1016 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100, 100
, 100)); | 1021 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100, 100
, 100)); |
1017 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 50, 2
00)); | 1022 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 50, 2
00)); |
1018 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 50, 2
00)); | 1023 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 50, 2
00)); |
(...skipping 16 matching lines...) Expand all Loading... |
1035 TestDisplayItem(container1, backgroundDrawingType), | 1040 TestDisplayItem(container1, backgroundDrawingType), |
1036 TestDisplayItem(content1, backgroundDrawingType), | 1041 TestDisplayItem(content1, backgroundDrawingType), |
1037 TestDisplayItem(content2, backgroundDrawingType), | 1042 TestDisplayItem(content2, backgroundDrawingType), |
1038 TestDisplayItem(container2, backgroundDrawingType)); | 1043 TestDisplayItem(container2, backgroundDrawingType)); |
1039 | 1044 |
1040 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1045 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1041 EXPECT_EQ(2u, getPaintController().paintChunks().size()); | 1046 EXPECT_EQ(2u, getPaintController().paintChunks().size()); |
1042 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); | 1047 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); |
1043 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); | 1048 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); |
1044 // |content2| is invalidated raster on both the old chunk and the new ch
unk. | 1049 // |content2| is invalidated raster on both the old chunk and the new ch
unk. |
1045 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 1050 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
1046 FloatRect(100, 200, 50, 200))); | 1051 EXPECT_EQ(IntRect(100, 200, 50, 200), getPaintController().paintChunks()
[0].rasterInvalidationRects[0].rect); |
1047 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre( | 1052 EXPECT_EQ(1u, getPaintController().paintChunks()[1].rasterInvalidationRe
cts.size()); |
1048 FloatRect(100, 200, 50, 200))); | 1053 EXPECT_EQ(IntRect(100, 200, 50, 200), getPaintController().paintChunks()
[1].rasterInvalidationRects[0].rect); |
1049 } | 1054 } |
1050 } | 1055 } |
1051 | 1056 |
1052 TEST_P(PaintControllerTest, OutOfOrderNoCrash) | 1057 TEST_P(PaintControllerTest, OutOfOrderNoCrash) |
1053 { | 1058 { |
1054 FakeDisplayItemClient client("client"); | 1059 FakeDisplayItemClient client("client"); |
1055 GraphicsContext context(getPaintController()); | 1060 GraphicsContext context(getPaintController()); |
1056 | 1061 |
1057 const DisplayItem::Type type1 = DisplayItem::kDrawingFirst; | 1062 const DisplayItem::Type type1 = DisplayItem::kDrawingFirst; |
1058 const DisplayItem::Type type2 = static_cast<DisplayItem::Type>(DisplayItem::
kDrawingFirst + 1); | 1063 const DisplayItem::Type type2 = static_cast<DisplayItem::Type>(DisplayItem::
kDrawingFirst + 1); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 TestDisplayItem(content2, DisplayItem::kEndSubsequence), | 1155 TestDisplayItem(content2, DisplayItem::kEndSubsequence), |
1151 TestDisplayItem(container2, DisplayItem::kEndSubsequence)); | 1156 TestDisplayItem(container2, DisplayItem::kEndSubsequence)); |
1152 | 1157 |
1153 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1158 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1154 EXPECT_EQ(5u, getPaintController().paintChunks().size()); | 1159 EXPECT_EQ(5u, getPaintController().paintChunks().size()); |
1155 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); | 1160 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); |
1156 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), getPaintContr
oller().paintChunks()[1].id); | 1161 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), getPaintContr
oller().paintChunks()[1].id); |
1157 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), getPaintCon
troller().paintChunks()[2].id); | 1162 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), getPaintCon
troller().paintChunks()[2].id); |
1158 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[3].id); | 1163 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[3].id); |
1159 EXPECT_EQ(PaintChunk::Id(content2, backgroundDrawingType), getPaintContr
oller().paintChunks()[4].id); | 1164 EXPECT_EQ(PaintChunk::Id(content2, backgroundDrawingType), getPaintContr
oller().paintChunks()[4].id); |
1160 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1165 |
1161 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1166 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
1162 EXPECT_THAT(getPaintController().paintChunks()[2].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1167 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
1163 EXPECT_THAT(getPaintController().paintChunks()[3].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1168 EXPECT_EQ(1u, getPaintController().paintChunks()[1].rasterInvalidationRe
cts.size()); |
1164 EXPECT_THAT(getPaintController().paintChunks()[4].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1169 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
| 1170 EXPECT_EQ(1u, getPaintController().paintChunks()[2].rasterInvalidationRe
cts.size()); |
| 1171 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
| 1172 EXPECT_EQ(1u, getPaintController().paintChunks()[3].rasterInvalidationRe
cts.size()); |
| 1173 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
| 1174 EXPECT_EQ(1u, getPaintController().paintChunks()[4].rasterInvalidationRe
cts.size()); |
| 1175 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
1165 } | 1176 } |
1166 | 1177 |
1167 // Invalidate container1 but not content1. | 1178 // Invalidate container1 but not content1. |
1168 container1.setDisplayItemsUncached(); | 1179 container1.setDisplayItemsUncached(); |
1169 | 1180 |
1170 // Container2 itself now becomes empty (but still has the 'content2' child), | 1181 // Container2 itself now becomes empty (but still has the 'content2' child), |
1171 // and chooses not to output subsequence info. | 1182 // and chooses not to output subsequence info. |
1172 | 1183 |
1173 container2.setDisplayItemsUncached(); | 1184 container2.setDisplayItemsUncached(); |
1174 content2.setDisplayItemsUncached(); | 1185 content2.setDisplayItemsUncached(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 TestDisplayItem(content1, foregroundDrawingType), | 1240 TestDisplayItem(content1, foregroundDrawingType), |
1230 TestDisplayItem(content1, DisplayItem::kEndSubsequence), | 1241 TestDisplayItem(content1, DisplayItem::kEndSubsequence), |
1231 TestDisplayItem(container1, foregroundDrawingType), | 1242 TestDisplayItem(container1, foregroundDrawingType), |
1232 TestDisplayItem(container1, DisplayItem::kEndSubsequence)); | 1243 TestDisplayItem(container1, DisplayItem::kEndSubsequence)); |
1233 | 1244 |
1234 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1245 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1235 EXPECT_EQ(3u, getPaintController().paintChunks().size()); | 1246 EXPECT_EQ(3u, getPaintController().paintChunks().size()); |
1236 EXPECT_EQ(PaintChunk::Id(content2, foregroundDrawingType), getPaintContr
oller().paintChunks()[0].id); | 1247 EXPECT_EQ(PaintChunk::Id(content2, foregroundDrawingType), getPaintContr
oller().paintChunks()[0].id); |
1237 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), getPaintContr
oller().paintChunks()[1].id); | 1248 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), getPaintContr
oller().paintChunks()[1].id); |
1238 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), getPaintCon
troller().paintChunks()[2].id); | 1249 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), getPaintCon
troller().paintChunks()[2].id); |
| 1250 |
1239 // This is a new chunk. | 1251 // This is a new chunk. |
1240 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 1252 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
1241 FloatRect(LayoutRect::infiniteIntRect()))); | 1253 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
| 1254 |
1242 // This chunk didn't change. | 1255 // This chunk didn't change. |
1243 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre()); | 1256 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre()); |
1244 // |container1| is invalidated. | 1257 // |container1| is invalidated. |
1245 EXPECT_THAT(getPaintController().paintChunks()[2].rasterInvalidationRect
s, UnorderedElementsAre( | 1258 EXPECT_EQ(2u, getPaintController().paintChunks()[2].rasterInvalidationRe
cts.size()); |
1246 FloatRect(100, 100, 100, 100), // Old bounds of |container1|. | 1259 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[2].rasterInvalidationRects[0].rect); // Old bounds of |container1|. |
1247 FloatRect(100, 100, 100, 100))); // New bounds of |container1|. | 1260 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[2].rasterInvalidationRects[1].rect); // New bounds of |container1|. |
1248 } | 1261 } |
1249 | 1262 |
1250 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 1263 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
1251 DisplayItemClient::endShouldKeepAliveAllClients(); | 1264 DisplayItemClient::endShouldKeepAliveAllClients(); |
1252 #endif | 1265 #endif |
1253 } | 1266 } |
1254 | 1267 |
1255 TEST_P(PaintControllerTest, SkipCache) | 1268 TEST_P(PaintControllerTest, SkipCache) |
1256 { | 1269 { |
1257 FakeDisplayItemClient multicol("multicol", LayoutRect(100, 100, 200, 200)); | 1270 FakeDisplayItemClient multicol("multicol", LayoutRect(100, 100, 200, 200)); |
(...skipping 18 matching lines...) Expand all Loading... |
1276 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, | 1289 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, |
1277 TestDisplayItem(multicol, backgroundDrawingType), | 1290 TestDisplayItem(multicol, backgroundDrawingType), |
1278 TestDisplayItem(content, foregroundDrawingType), | 1291 TestDisplayItem(content, foregroundDrawingType), |
1279 TestDisplayItem(content, foregroundDrawingType)); | 1292 TestDisplayItem(content, foregroundDrawingType)); |
1280 sk_sp<const SkPicture> picture1 = sk_ref_sp(static_cast<const DrawingDisplay
Item&>(getPaintController().getDisplayItemList()[1]).picture()); | 1293 sk_sp<const SkPicture> picture1 = sk_ref_sp(static_cast<const DrawingDisplay
Item&>(getPaintController().getDisplayItemList()[1]).picture()); |
1281 sk_sp<const SkPicture> picture2 = sk_ref_sp(static_cast<const DrawingDisplay
Item&>(getPaintController().getDisplayItemList()[2]).picture()); | 1294 sk_sp<const SkPicture> picture2 = sk_ref_sp(static_cast<const DrawingDisplay
Item&>(getPaintController().getDisplayItemList()[2]).picture()); |
1282 EXPECT_NE(picture1, picture2); | 1295 EXPECT_NE(picture1, picture2); |
1283 | 1296 |
1284 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1297 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1285 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 1298 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
1286 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1299 EXPECT_EQ(1u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
| 1300 EXPECT_EQ(LayoutRect::infiniteIntRect(), getPaintController().paintChunk
s()[0].rasterInvalidationRects[0].rect); |
1287 | 1301 |
1288 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 1302 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
1289 } | 1303 } |
1290 | 1304 |
1291 // Draw again with nothing invalidated. | 1305 // Draw again with nothing invalidated. |
1292 EXPECT_TRUE(getPaintController().clientCacheIsValid(multicol)); | 1306 EXPECT_TRUE(getPaintController().clientCacheIsValid(multicol)); |
1293 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 200, 100,
100)); | 1307 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 200, 100,
100)); |
1294 | 1308 |
1295 getPaintController().beginSkippingCache(); | 1309 getPaintController().beginSkippingCache(); |
1296 drawRect(context, content, foregroundDrawingType, rect1); | 1310 drawRect(context, content, foregroundDrawingType, rect1); |
(...skipping 11 matching lines...) Expand all Loading... |
1308 | 1322 |
1309 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, | 1323 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, |
1310 TestDisplayItem(multicol, backgroundDrawingType), | 1324 TestDisplayItem(multicol, backgroundDrawingType), |
1311 TestDisplayItem(content, foregroundDrawingType), | 1325 TestDisplayItem(content, foregroundDrawingType), |
1312 TestDisplayItem(content, foregroundDrawingType)); | 1326 TestDisplayItem(content, foregroundDrawingType)); |
1313 EXPECT_NE(picture1.get(), static_cast<const DrawingDisplayItem&>(getPaintCon
troller().getDisplayItemList()[1]).picture()); | 1327 EXPECT_NE(picture1.get(), static_cast<const DrawingDisplayItem&>(getPaintCon
troller().getDisplayItemList()[1]).picture()); |
1314 EXPECT_NE(picture2.get(), static_cast<const DrawingDisplayItem&>(getPaintCon
troller().getDisplayItemList()[2]).picture()); | 1328 EXPECT_NE(picture2.get(), static_cast<const DrawingDisplayItem&>(getPaintCon
troller().getDisplayItemList()[2]).picture()); |
1315 | 1329 |
1316 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1330 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1317 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 1331 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
1318 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 1332 EXPECT_EQ(2u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
1319 FloatRect(100, 100, 100, 100), // Old bounds of |content|. | 1333 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // Old bounds of |content|. |
1320 FloatRect(100, 100, 100, 100))); // New bounds of |content|. | 1334 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[1].rect); // New bounds of |content|. |
1321 | 1335 |
1322 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); | 1336 getPaintController().updateCurrentPaintChunkProperties(&m_rootPaintChunk
Id, PaintChunkProperties()); |
1323 } | 1337 } |
1324 | 1338 |
1325 // Now the multicol becomes 3 columns and repaints. | 1339 // Now the multicol becomes 3 columns and repaints. |
1326 multicol.setDisplayItemsUncached(); | 1340 multicol.setDisplayItemsUncached(); |
1327 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); | 1341 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); |
1328 | 1342 |
1329 getPaintController().beginSkippingCache(); | 1343 getPaintController().beginSkippingCache(); |
1330 drawRect(context, content, foregroundDrawingType, rect1); | 1344 drawRect(context, content, foregroundDrawingType, rect1); |
1331 drawRect(context, content, foregroundDrawingType, rect2); | 1345 drawRect(context, content, foregroundDrawingType, rect2); |
1332 drawRect(context, content, foregroundDrawingType, rect3); | 1346 drawRect(context, content, foregroundDrawingType, rect3); |
1333 getPaintController().endSkippingCache(); | 1347 getPaintController().endSkippingCache(); |
1334 | 1348 |
1335 // We should repaint everything on invalidation of the scope container. | 1349 // We should repaint everything on invalidation of the scope container. |
1336 EXPECT_DISPLAY_LIST(getPaintController().newDisplayItemList(), 4, | 1350 EXPECT_DISPLAY_LIST(getPaintController().newDisplayItemList(), 4, |
1337 TestDisplayItem(multicol, backgroundDrawingType), | 1351 TestDisplayItem(multicol, backgroundDrawingType), |
1338 TestDisplayItem(content, foregroundDrawingType), | 1352 TestDisplayItem(content, foregroundDrawingType), |
1339 TestDisplayItem(content, foregroundDrawingType), | 1353 TestDisplayItem(content, foregroundDrawingType), |
1340 TestDisplayItem(content, foregroundDrawingType)); | 1354 TestDisplayItem(content, foregroundDrawingType)); |
1341 EXPECT_NE(picture1.get(), static_cast<const DrawingDisplayItem&>(getPaintCon
troller().newDisplayItemList()[1]).picture()); | 1355 EXPECT_NE(picture1.get(), static_cast<const DrawingDisplayItem&>(getPaintCon
troller().newDisplayItemList()[1]).picture()); |
1342 EXPECT_NE(picture2.get(), static_cast<const DrawingDisplayItem&>(getPaintCon
troller().newDisplayItemList()[2]).picture()); | 1356 EXPECT_NE(picture2.get(), static_cast<const DrawingDisplayItem&>(getPaintCon
troller().newDisplayItemList()[2]).picture()); |
1343 | 1357 |
1344 getPaintController().commitNewDisplayItems(); | 1358 getPaintController().commitNewDisplayItems(); |
1345 | 1359 |
1346 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1360 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1347 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 1361 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
1348 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 1362 EXPECT_EQ(4u, getPaintController().paintChunks()[0].rasterInvalidationRe
cts.size()); |
1349 FloatRect(100, 100, 200, 200), // Old bounds of |multicol|. | 1363 EXPECT_EQ(IntRect(100, 100, 200, 200), getPaintController().paintChunks(
)[0].rasterInvalidationRects[0].rect); // Old bounds of |multicol|. |
1350 FloatRect(100, 100, 200, 200), // New bounds of |multicol|. | 1364 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[1].rect); // Old bounds of |content|. |
1351 FloatRect(100, 100, 100, 100), // Old bounds of |content|. | 1365 EXPECT_EQ(IntRect(100, 100, 200, 200), getPaintController().paintChunks(
)[0].rasterInvalidationRects[2].rect); // New bounds of |multicol|. |
1352 FloatRect(100, 100, 100, 100))); // New bounds of |content|. | 1366 EXPECT_EQ(IntRect(100, 100, 100, 100), getPaintController().paintChunks(
)[0].rasterInvalidationRects[3].rect); // New bounds of |content|. |
1353 } | 1367 } |
1354 } | 1368 } |
1355 | 1369 |
1356 TEST_P(PaintControllerTest, PartialSkipCache) | 1370 TEST_P(PaintControllerTest, PartialSkipCache) |
1357 { | 1371 { |
1358 FakeDisplayItemClient content("content"); | 1372 FakeDisplayItemClient content("content"); |
1359 GraphicsContext context(getPaintController()); | 1373 GraphicsContext context(getPaintController()); |
1360 | 1374 |
1361 FloatRect rect1(100, 100, 50, 50); | 1375 FloatRect rect1(100, 100, 50, 50); |
1362 FloatRect rect2(150, 100, 50, 50); | 1376 FloatRect rect2(150, 100, 50, 50); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 } | 1914 } |
1901 | 1915 |
1902 TEST_F(PaintControllerUnderInvalidationTest, FoldCompositingDrawingInSubsequence
) | 1916 TEST_F(PaintControllerUnderInvalidationTest, FoldCompositingDrawingInSubsequence
) |
1903 { | 1917 { |
1904 testFoldCompositingDrawingInSubsequence(); | 1918 testFoldCompositingDrawingInSubsequence(); |
1905 } | 1919 } |
1906 | 1920 |
1907 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) | 1921 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
1908 | 1922 |
1909 } // namespace blink | 1923 } // namespace blink |
OLD | NEW |