OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "platform/graphics/paint/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.h" |
7 | 7 |
8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
10 #include "platform/graphics/paint/CachedDisplayItem.h" | 10 #include "platform/graphics/paint/CachedDisplayItem.h" |
11 #include "platform/graphics/paint/ClipPathRecorder.h" | 11 #include "platform/graphics/paint/ClipPathRecorder.h" |
12 #include "platform/graphics/paint/ClipRecorder.h" | 12 #include "platform/graphics/paint/ClipRecorder.h" |
13 #include "platform/graphics/paint/DrawingDisplayItem.h" | 13 #include "platform/graphics/paint/DrawingDisplayItem.h" |
14 #include "platform/graphics/paint/DrawingRecorder.h" | 14 #include "platform/graphics/paint/DrawingRecorder.h" |
15 #include "platform/graphics/paint/SubtreeRecorder.h" | 15 #include "platform/graphics/paint/SubsequenceRecorder.h" |
16 #include <gtest/gtest.h> | 16 #include <gtest/gtest.h> |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 class DisplayItemListTest : public ::testing::Test { | 20 class DisplayItemListTest : public ::testing::Test { |
21 public: | 21 public: |
22 DisplayItemListTest() | 22 DisplayItemListTest() |
23 : m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } | 23 : m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } |
24 | 24 |
25 protected: | 25 protected: |
26 DisplayItemList& displayItemList() { return m_displayItemList; } | 26 DisplayItemList& displayItemList() { return m_displayItemList; } |
27 const DisplayItems& newPaintListBeforeUpdate() { return displayItemList().m_
newDisplayItems; } | 27 const DisplayItems& newDisplayItemsBeforeUpdate() { return displayItemList()
.m_newDisplayItems; } |
28 | 28 |
29 private: | 29 private: |
30 void SetUp() override | 30 void SetUp() override |
31 { | 31 { |
32 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 32 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
33 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); | 33 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); |
34 } | 34 } |
35 void TearDown() override | 35 void TearDown() override |
36 { | 36 { |
37 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); | 37 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 TestDisplayItem(container2, backgroundDrawingType), | 444 TestDisplayItem(container2, backgroundDrawingType), |
445 TestDisplayItem(content2, backgroundDrawingType), | 445 TestDisplayItem(content2, backgroundDrawingType), |
446 TestDisplayItem(content2, foregroundDrawingType), | 446 TestDisplayItem(content2, foregroundDrawingType), |
447 TestDisplayItem(container2, foregroundDrawingType), | 447 TestDisplayItem(container2, foregroundDrawingType), |
448 TestDisplayItem(container1, backgroundDrawingType), | 448 TestDisplayItem(container1, backgroundDrawingType), |
449 TestDisplayItem(content1, backgroundDrawingType), | 449 TestDisplayItem(content1, backgroundDrawingType), |
450 TestDisplayItem(content1, foregroundDrawingType), | 450 TestDisplayItem(content1, foregroundDrawingType), |
451 TestDisplayItem(container1, foregroundDrawingType)); | 451 TestDisplayItem(container1, foregroundDrawingType)); |
452 } | 452 } |
453 | 453 |
454 TEST_F(DisplayItemListTest, CachedSubtreeSwapOrder) | 454 TEST_F(DisplayItemListTest, CachedSubsequenceSwapOrder) |
455 { | 455 { |
456 TestDisplayItemClient container1("container1"); | 456 TestDisplayItemClient container1("container1"); |
457 TestDisplayItemClient content1("content1"); | 457 TestDisplayItemClient content1("content1"); |
458 TestDisplayItemClient container2("container2"); | 458 TestDisplayItemClient container2("container2"); |
459 TestDisplayItemClient content2("content2"); | 459 TestDisplayItemClient content2("content2"); |
460 GraphicsContext context(&displayItemList()); | 460 GraphicsContext context(&displayItemList()); |
461 const int backgroundPaintPhase = backgroundDrawingType - DisplayItem::Drawin
gPaintPhaseFirst; | |
462 const int foregroundPaintPhase = foregroundDrawingType - DisplayItem::Drawin
gPaintPhaseFirst; | |
463 | 461 |
464 { | 462 { |
465 SubtreeRecorder r(context, container1, backgroundPaintPhase); | 463 SubsequenceRecorder r(context, container1); |
466 EXPECT_FALSE(r.canUseCache()); | |
467 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100,
100, 100)); | 464 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100,
100, 100)); |
468 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 5
0, 200)); | 465 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 5
0, 200)); |
469 } | |
470 { | |
471 SubtreeRecorder r(context, container1, foregroundPaintPhase); | |
472 EXPECT_FALSE(r.canUseCache()); | |
473 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 5
0, 200)); | 466 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 5
0, 200)); |
474 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100,
100, 100)); | 467 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100,
100, 100)); |
475 } | 468 } |
476 { | 469 { |
477 SubtreeRecorder r(context, container2, backgroundPaintPhase); | 470 SubsequenceRecorder r(context, container2); |
478 EXPECT_FALSE(r.canUseCache()); | |
479 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200,
100, 100)); | 471 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200,
100, 100)); |
480 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 5
0, 200)); | 472 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
481 } | |
482 { | |
483 SubtreeRecorder r(context, container2, foregroundPaintPhase); | |
484 EXPECT_FALSE(r.canUseCache()); | |
485 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); | 473 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
486 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200,
100, 100)); | 474 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200,
100, 100)); |
487 } | 475 } |
488 displayItemList().commitNewDisplayItems(); | 476 displayItemList().commitNewDisplayItems(); |
489 | 477 |
490 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 16, | 478 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 12, |
491 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), | 479 TestDisplayItem(container1, DisplayItem::BeginSubsequence), |
492 TestDisplayItem(container1, backgroundDrawingType), | 480 TestDisplayItem(container1, backgroundDrawingType), |
493 TestDisplayItem(content1, backgroundDrawingType), | 481 TestDisplayItem(content1, backgroundDrawingType), |
494 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase)), | |
495 | |
496 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundPaintPhase)), | |
497 TestDisplayItem(content1, foregroundDrawingType), | 482 TestDisplayItem(content1, foregroundDrawingType), |
498 TestDisplayItem(container1, foregroundDrawingType), | 483 TestDisplayItem(container1, foregroundDrawingType), |
499 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(fore
groundPaintPhase)), | 484 TestDisplayItem(container1, DisplayItem::EndSubsequence), |
500 | 485 |
501 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), | 486 TestDisplayItem(container2, DisplayItem::BeginSubsequence), |
502 TestDisplayItem(container2, backgroundDrawingType), | 487 TestDisplayItem(container2, backgroundDrawingType), |
503 TestDisplayItem(content2, backgroundDrawingType), | 488 TestDisplayItem(content2, backgroundDrawingType), |
504 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase)), | |
505 | |
506 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundPaintPhase)), | |
507 TestDisplayItem(content2, foregroundDrawingType), | 489 TestDisplayItem(content2, foregroundDrawingType), |
508 TestDisplayItem(container2, foregroundDrawingType), | 490 TestDisplayItem(container2, foregroundDrawingType), |
509 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(fore
groundPaintPhase))); | 491 TestDisplayItem(container2, DisplayItem::EndSubsequence)); |
510 | 492 |
511 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. | 493 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. |
512 displayItemList().createAndAppend<CachedDisplayItem>(container2, DisplayItem
::paintPhaseToCachedSubtreeType(backgroundPaintPhase)); | 494 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, con
tainer2)); |
513 EXPECT_EQ((size_t)1, newPaintListBeforeUpdate().size()); | 495 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, con
tainer1)); |
514 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); | |
515 displayItemList().createAndAppend<CachedDisplayItem>(container2, DisplayItem
::paintPhaseToCachedSubtreeType(foregroundPaintPhase)); | |
516 EXPECT_EQ((size_t)2, newPaintListBeforeUpdate().size()); | |
517 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); | |
518 | 496 |
519 displayItemList().createAndAppend<CachedDisplayItem>(container1, DisplayItem
::paintPhaseToCachedSubtreeType(backgroundPaintPhase)); | 497 EXPECT_DISPLAY_LIST(newDisplayItemsBeforeUpdate(), 2, |
520 EXPECT_EQ((size_t)3, newPaintListBeforeUpdate().size()); | 498 TestDisplayItem(container2, DisplayItem::CachedSubsequence), |
521 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); | 499 TestDisplayItem(container1, DisplayItem::CachedSubsequence)); |
522 displayItemList().createAndAppend<CachedDisplayItem>(container1, DisplayItem
::paintPhaseToCachedSubtreeType(foregroundPaintPhase)); | 500 |
523 EXPECT_EQ((size_t)4, newPaintListBeforeUpdate().size()); | |
524 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); | |
525 displayItemList().commitNewDisplayItems(); | 501 displayItemList().commitNewDisplayItems(); |
526 | 502 |
527 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 16, | 503 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 12, |
528 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundDrawingType)), | 504 TestDisplayItem(container2, DisplayItem::BeginSubsequence), |
529 TestDisplayItem(container2, backgroundDrawingType), | 505 TestDisplayItem(container2, backgroundDrawingType), |
530 TestDisplayItem(content2, backgroundDrawingType), | 506 TestDisplayItem(content2, backgroundDrawingType), |
531 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(back
groundDrawingType)), | |
532 | |
533 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundDrawingType)), | |
534 TestDisplayItem(content2, foregroundDrawingType), | 507 TestDisplayItem(content2, foregroundDrawingType), |
535 TestDisplayItem(container2, foregroundDrawingType), | 508 TestDisplayItem(container2, foregroundDrawingType), |
536 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(fore
groundDrawingType)), | 509 TestDisplayItem(container2, DisplayItem::EndSubsequence), |
537 | 510 |
538 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundDrawingType)), | 511 TestDisplayItem(container1, DisplayItem::BeginSubsequence), |
539 TestDisplayItem(container1, backgroundDrawingType), | 512 TestDisplayItem(container1, backgroundDrawingType), |
540 TestDisplayItem(content1, backgroundDrawingType), | 513 TestDisplayItem(content1, backgroundDrawingType), |
541 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(back
groundDrawingType)), | |
542 | |
543 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundDrawingType)), | |
544 TestDisplayItem(content1, foregroundDrawingType), | 514 TestDisplayItem(content1, foregroundDrawingType), |
545 TestDisplayItem(container1, foregroundDrawingType), | 515 TestDisplayItem(container1, foregroundDrawingType), |
546 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(fore
groundDrawingType))); | 516 TestDisplayItem(container1, DisplayItem::EndSubsequence)); |
| 517 } |
| 518 |
| 519 TEST_F(DisplayItemListTest, CachedNestedSubsequenceUpdate) |
| 520 { |
| 521 TestDisplayItemClient container1("container1"); |
| 522 TestDisplayItemClient content1("content1"); |
| 523 TestDisplayItemClient container2("container2"); |
| 524 TestDisplayItemClient content2("content2"); |
| 525 GraphicsContext context(&displayItemList()); |
| 526 |
| 527 { |
| 528 SubsequenceRecorder r(context, container1); |
| 529 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100,
100, 100)); |
| 530 { |
| 531 SubsequenceRecorder r(context, content1); |
| 532 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 10
0, 50, 200)); |
| 533 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 10
0, 50, 200)); |
| 534 } |
| 535 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100,
100, 100)); |
| 536 } |
| 537 { |
| 538 SubsequenceRecorder r(context, container2); |
| 539 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200,
100, 100)); |
| 540 { |
| 541 SubsequenceRecorder r(context, content2); |
| 542 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 20
0, 50, 200)); |
| 543 } |
| 544 } |
| 545 displayItemList().commitNewDisplayItems(); |
| 546 |
| 547 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 14, |
| 548 TestDisplayItem(container1, DisplayItem::BeginSubsequence), |
| 549 TestDisplayItem(container1, backgroundDrawingType), |
| 550 TestDisplayItem(content1, DisplayItem::BeginSubsequence), |
| 551 TestDisplayItem(content1, backgroundDrawingType), |
| 552 TestDisplayItem(content1, foregroundDrawingType), |
| 553 TestDisplayItem(content1, DisplayItem::EndSubsequence), |
| 554 TestDisplayItem(container1, foregroundDrawingType), |
| 555 TestDisplayItem(container1, DisplayItem::EndSubsequence), |
| 556 |
| 557 TestDisplayItem(container2, DisplayItem::BeginSubsequence), |
| 558 TestDisplayItem(container2, backgroundDrawingType), |
| 559 TestDisplayItem(content2, DisplayItem::BeginSubsequence), |
| 560 TestDisplayItem(content2, backgroundDrawingType), |
| 561 TestDisplayItem(content2, DisplayItem::EndSubsequence), |
| 562 TestDisplayItem(container2, DisplayItem::EndSubsequence)); |
| 563 |
| 564 // Invalidate container1 but not content1. |
| 565 displayItemList().invalidate(container1.displayItemClient()); |
| 566 |
| 567 // Container2 itself now becomes empty (but still has the 'content2' child), |
| 568 // and chooses not to output subsequence info. |
| 569 displayItemList().invalidate(container2.displayItemClient()); |
| 570 displayItemList().invalidate(content2.displayItemClient()); |
| 571 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntainer2)); |
| 572 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntent2)); |
| 573 // Content2 now outputs foreground only. |
| 574 { |
| 575 SubsequenceRecorder r(context, content2); |
| 576 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
| 577 } |
| 578 // Repaint container1 with foreground only. |
| 579 { |
| 580 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context
, container1)); |
| 581 SubsequenceRecorder r(context, container1); |
| 582 // Use cached subsequence of content1. |
| 583 EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context,
content1)); |
| 584 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100,
100, 100)); |
| 585 } |
| 586 EXPECT_DISPLAY_LIST(newDisplayItemsBeforeUpdate(), 7, |
| 587 TestDisplayItem(content2, DisplayItem::BeginSubsequence), |
| 588 TestDisplayItem(content2, foregroundDrawingType), |
| 589 TestDisplayItem(content2, DisplayItem::EndSubsequence), |
| 590 TestDisplayItem(container1, DisplayItem::BeginSubsequence), |
| 591 TestDisplayItem(content1, DisplayItem::CachedSubsequence), |
| 592 TestDisplayItem(container1, foregroundDrawingType), |
| 593 TestDisplayItem(container1, DisplayItem::EndSubsequence)); |
| 594 |
| 595 displayItemList().commitNewDisplayItems(); |
| 596 |
| 597 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 10, |
| 598 TestDisplayItem(content2, DisplayItem::BeginSubsequence), |
| 599 TestDisplayItem(content2, foregroundDrawingType), |
| 600 TestDisplayItem(content2, DisplayItem::EndSubsequence), |
| 601 |
| 602 TestDisplayItem(container1, DisplayItem::BeginSubsequence), |
| 603 TestDisplayItem(content1, DisplayItem::BeginSubsequence), |
| 604 TestDisplayItem(content1, backgroundDrawingType), |
| 605 TestDisplayItem(content1, foregroundDrawingType), |
| 606 TestDisplayItem(content1, DisplayItem::EndSubsequence), |
| 607 TestDisplayItem(container1, foregroundDrawingType), |
| 608 TestDisplayItem(container1, DisplayItem::EndSubsequence)); |
547 } | 609 } |
548 | 610 |
549 TEST_F(DisplayItemListTest, Scope) | 611 TEST_F(DisplayItemListTest, Scope) |
550 { | 612 { |
551 TestDisplayItemClient multicol("multicol"); | 613 TestDisplayItemClient multicol("multicol"); |
552 TestDisplayItemClient content("content"); | 614 TestDisplayItemClient content("content"); |
553 GraphicsContext context(&displayItemList()); | 615 GraphicsContext context(&displayItemList()); |
554 | 616 |
555 FloatRect rect1(100, 100, 50, 50); | 617 FloatRect rect1(100, 100, 50, 50); |
556 FloatRect rect2(150, 100, 50, 50); | 618 FloatRect rect2(150, 100, 50, 50); |
(...skipping 22 matching lines...) Expand all Loading... |
579 EXPECT_TRUE(displayItemList().clientCacheIsValid(multicol.displayItemClient(
))); | 641 EXPECT_TRUE(displayItemList().clientCacheIsValid(multicol.displayItemClient(
))); |
580 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 200, 100,
100)); | 642 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 200, 100,
100)); |
581 displayItemList().beginScope(); | 643 displayItemList().beginScope(); |
582 drawRect(context, content, foregroundDrawingType, rect1); | 644 drawRect(context, content, foregroundDrawingType, rect1); |
583 displayItemList().endScope(); | 645 displayItemList().endScope(); |
584 | 646 |
585 displayItemList().beginScope(); | 647 displayItemList().beginScope(); |
586 drawRect(context, content, foregroundDrawingType, rect2); | 648 drawRect(context, content, foregroundDrawingType, rect2); |
587 displayItemList().endScope(); | 649 displayItemList().endScope(); |
588 | 650 |
589 EXPECT_TRUE(newPaintListBeforeUpdate()[0].isCachedDrawing()); | 651 EXPECT_TRUE(newDisplayItemsBeforeUpdate()[0].isCachedDrawing()); |
590 EXPECT_TRUE(newPaintListBeforeUpdate()[1].isDrawing()); | 652 EXPECT_TRUE(newDisplayItemsBeforeUpdate()[1].isDrawing()); |
591 EXPECT_TRUE(newPaintListBeforeUpdate()[2].isDrawing()); | 653 EXPECT_TRUE(newDisplayItemsBeforeUpdate()[2].isDrawing()); |
592 displayItemList().commitNewDisplayItems(); | 654 displayItemList().commitNewDisplayItems(); |
593 | 655 |
594 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, | 656 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, |
595 TestDisplayItem(multicol, backgroundDrawingType), | 657 TestDisplayItem(multicol, backgroundDrawingType), |
596 TestDisplayItem(content, foregroundDrawingType), | 658 TestDisplayItem(content, foregroundDrawingType), |
597 TestDisplayItem(content, foregroundDrawingType)); | 659 TestDisplayItem(content, foregroundDrawingType)); |
598 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[1]).picture()); | 660 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[1]).picture()); |
599 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[2]).picture()); | 661 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[2]).picture()); |
600 | 662 |
601 // Now the multicol becomes 3 columns and repaints. | 663 // Now the multicol becomes 3 columns and repaints. |
602 displayItemList().invalidate(multicol.displayItemClient()); | 664 displayItemList().invalidate(multicol.displayItemClient()); |
603 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); | 665 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); |
604 | 666 |
605 displayItemList().beginScope(); | 667 displayItemList().beginScope(); |
606 drawRect(context, content, foregroundDrawingType, rect1); | 668 drawRect(context, content, foregroundDrawingType, rect1); |
607 displayItemList().endScope(); | 669 displayItemList().endScope(); |
608 | 670 |
609 displayItemList().beginScope(); | 671 displayItemList().beginScope(); |
610 drawRect(context, content, foregroundDrawingType, rect2); | 672 drawRect(context, content, foregroundDrawingType, rect2); |
611 displayItemList().endScope(); | 673 displayItemList().endScope(); |
612 | 674 |
613 displayItemList().beginScope(); | 675 displayItemList().beginScope(); |
614 drawRect(context, content, foregroundDrawingType, rect3); | 676 drawRect(context, content, foregroundDrawingType, rect3); |
615 displayItemList().endScope(); | 677 displayItemList().endScope(); |
616 | 678 |
617 // We should repaint everything on invalidation of the scope container. | 679 // We should repaint everything on invalidation of the scope container. |
618 EXPECT_TRUE(newPaintListBeforeUpdate()[0].isDrawing()); | 680 EXPECT_TRUE(newDisplayItemsBeforeUpdate()[0].isDrawing()); |
619 EXPECT_TRUE(newPaintListBeforeUpdate()[1].isDrawing()); | 681 EXPECT_TRUE(newDisplayItemsBeforeUpdate()[1].isDrawing()); |
620 EXPECT_TRUE(newPaintListBeforeUpdate()[2].isDrawing()); | 682 EXPECT_TRUE(newDisplayItemsBeforeUpdate()[2].isDrawing()); |
621 EXPECT_TRUE(newPaintListBeforeUpdate()[3].isDrawing()); | 683 EXPECT_TRUE(newDisplayItemsBeforeUpdate()[3].isDrawing()); |
622 displayItemList().commitNewDisplayItems(); | 684 displayItemList().commitNewDisplayItems(); |
623 | 685 |
624 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, | 686 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, |
625 TestDisplayItem(multicol, backgroundDrawingType), | 687 TestDisplayItem(multicol, backgroundDrawingType), |
626 TestDisplayItem(content, foregroundDrawingType), | 688 TestDisplayItem(content, foregroundDrawingType), |
627 TestDisplayItem(content, foregroundDrawingType), | 689 TestDisplayItem(content, foregroundDrawingType), |
628 TestDisplayItem(content, foregroundDrawingType)); | 690 TestDisplayItem(content, foregroundDrawingType)); |
629 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[1]).picture()); | 691 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[1]).picture()); |
630 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[2]).picture()); | 692 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[2]).picture()); |
631 } | 693 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 740 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
679 displayItemList().commitNewDisplayItems(); | 741 displayItemList().commitNewDisplayItems(); |
680 | 742 |
681 // Empty clips should have been optimized out. | 743 // Empty clips should have been optimized out. |
682 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 744 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
683 TestDisplayItem(first, backgroundDrawingType), | 745 TestDisplayItem(first, backgroundDrawingType), |
684 TestDisplayItem(third, backgroundDrawingType)); | 746 TestDisplayItem(third, backgroundDrawingType)); |
685 } | 747 } |
686 | 748 |
687 } // namespace blink | 749 } // namespace blink |
OLD | NEW |