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/SubtreeDisplayItem.h" |
16 #include <gtest/gtest.h> | 16 #include <gtest/gtest.h> |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
| 20 class SimpleSubtreeRecorder { |
| 21 public: |
| 22 static bool useCachedSubtreeIfPossible(DisplayItemList& displayItemList, con
st DisplayItemClientWrapper& client, int paintPhase) |
| 23 { |
| 24 if (displayItemList.subtreeCacheIsValid(client.displayItemClient(), Disp
layItem::paintPhaseToBeginSubtreeType(paintPhase))) { |
| 25 displayItemList.createAndAppend<CachedDisplayItem>(client, DisplayIt
em::paintPhaseToCachedSubtreeType(paintPhase)); |
| 26 return true; |
| 27 } |
| 28 return false; |
| 29 } |
| 30 |
| 31 SimpleSubtreeRecorder(DisplayItemList& displayItemList, const DisplayItemCli
entWrapper& client, int paintPhase) |
| 32 : m_displayItemList(displayItemList) |
| 33 , m_client(client) |
| 34 , m_paintPhase(paintPhase) |
| 35 { |
| 36 displayItemList.createAndAppend<BeginSubtreeDisplayItem>(client, Display
Item::paintPhaseToBeginSubtreeType(paintPhase)); |
| 37 } |
| 38 ~SimpleSubtreeRecorder() |
| 39 { |
| 40 m_displayItemList.createAndAppend<EndSubtreeDisplayItem>(m_client, Displ
ayItem::paintPhaseToEndSubtreeType(m_paintPhase)); |
| 41 } |
| 42 |
| 43 private: |
| 44 DisplayItemList& m_displayItemList; |
| 45 const DisplayItemClientWrapper m_client; |
| 46 const int m_paintPhase; |
| 47 }; |
| 48 |
20 class DisplayItemListTest : public ::testing::Test { | 49 class DisplayItemListTest : public ::testing::Test { |
21 public: | 50 public: |
22 DisplayItemListTest() | 51 DisplayItemListTest() |
23 : m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } | 52 : m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } |
24 | 53 |
25 protected: | 54 protected: |
26 DisplayItemList& displayItemList() { return m_displayItemList; } | 55 DisplayItemList& displayItemList() { return m_displayItemList; } |
27 const DisplayItems& newPaintListBeforeUpdate() { return displayItemList().m_
newDisplayItems; } | 56 const DisplayItems& newPaintListBeforeUpdate() { return displayItemList().m_
newDisplayItems; } |
28 | 57 |
29 private: | 58 private: |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 { | 484 { |
456 TestDisplayItemClient container1("container1"); | 485 TestDisplayItemClient container1("container1"); |
457 TestDisplayItemClient content1("content1"); | 486 TestDisplayItemClient content1("content1"); |
458 TestDisplayItemClient container2("container2"); | 487 TestDisplayItemClient container2("container2"); |
459 TestDisplayItemClient content2("content2"); | 488 TestDisplayItemClient content2("content2"); |
460 GraphicsContext context(&displayItemList()); | 489 GraphicsContext context(&displayItemList()); |
461 const int backgroundPaintPhase = backgroundDrawingType - DisplayItem::Drawin
gPaintPhaseFirst; | 490 const int backgroundPaintPhase = backgroundDrawingType - DisplayItem::Drawin
gPaintPhaseFirst; |
462 const int foregroundPaintPhase = foregroundDrawingType - DisplayItem::Drawin
gPaintPhaseFirst; | 491 const int foregroundPaintPhase = foregroundDrawingType - DisplayItem::Drawin
gPaintPhaseFirst; |
463 | 492 |
464 { | 493 { |
465 SubtreeRecorder r(context, container1, backgroundPaintPhase); | 494 SimpleSubtreeRecorder r(displayItemList(), container1, backgroundPaintPh
ase); |
466 EXPECT_FALSE(r.canUseCache()); | |
467 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100,
100, 100)); | 495 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100,
100, 100)); |
468 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 5
0, 200)); | 496 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 5
0, 200)); |
469 } | 497 } |
470 { | 498 { |
471 SubtreeRecorder r(context, container1, foregroundPaintPhase); | 499 SimpleSubtreeRecorder r(displayItemList(), container1, foregroundPaintPh
ase); |
472 EXPECT_FALSE(r.canUseCache()); | |
473 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 5
0, 200)); | 500 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 5
0, 200)); |
474 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100,
100, 100)); | 501 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100,
100, 100)); |
475 } | 502 } |
476 { | 503 { |
477 SubtreeRecorder r(context, container2, backgroundPaintPhase); | 504 SimpleSubtreeRecorder r(displayItemList(), container2, backgroundPaintPh
ase); |
478 EXPECT_FALSE(r.canUseCache()); | |
479 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200,
100, 100)); | 505 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200,
100, 100)); |
480 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 5
0, 200)); | 506 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
481 } | 507 } |
482 { | 508 { |
483 SubtreeRecorder r(context, container2, foregroundPaintPhase); | 509 SimpleSubtreeRecorder r(displayItemList(), container2, foregroundPaintPh
ase); |
484 EXPECT_FALSE(r.canUseCache()); | |
485 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); | 510 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
486 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200,
100, 100)); | 511 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200,
100, 100)); |
487 } | 512 } |
488 displayItemList().commitNewDisplayItems(); | 513 displayItemList().commitNewDisplayItems(); |
489 | 514 |
490 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 16, | 515 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 16, |
491 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), | 516 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), |
492 TestDisplayItem(container1, backgroundDrawingType), | 517 TestDisplayItem(container1, backgroundDrawingType), |
493 TestDisplayItem(content1, backgroundDrawingType), | 518 TestDisplayItem(content1, backgroundDrawingType), |
494 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase)), | 519 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase)), |
495 | 520 |
496 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundPaintPhase)), | 521 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundPaintPhase)), |
497 TestDisplayItem(content1, foregroundDrawingType), | 522 TestDisplayItem(content1, foregroundDrawingType), |
498 TestDisplayItem(container1, foregroundDrawingType), | 523 TestDisplayItem(container1, foregroundDrawingType), |
499 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(fore
groundPaintPhase)), | 524 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(fore
groundPaintPhase)), |
500 | 525 |
501 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), | 526 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), |
502 TestDisplayItem(container2, backgroundDrawingType), | 527 TestDisplayItem(container2, backgroundDrawingType), |
503 TestDisplayItem(content2, backgroundDrawingType), | 528 TestDisplayItem(content2, backgroundDrawingType), |
504 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase)), | 529 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase)), |
505 | 530 |
506 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundPaintPhase)), | 531 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundPaintPhase)), |
507 TestDisplayItem(content2, foregroundDrawingType), | 532 TestDisplayItem(content2, foregroundDrawingType), |
508 TestDisplayItem(container2, foregroundDrawingType), | 533 TestDisplayItem(container2, foregroundDrawingType), |
509 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(fore
groundPaintPhase))); | 534 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(fore
groundPaintPhase))); |
510 | 535 |
511 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. | 536 // 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)); | 537 EXPECT_TRUE(SimpleSubtreeRecorder::useCachedSubtreeIfPossible(displayItemLis
t(), container2, backgroundPaintPhase)); |
513 EXPECT_EQ((size_t)1, newPaintListBeforeUpdate().size()); | 538 EXPECT_EQ((size_t)1, newPaintListBeforeUpdate().size()); |
514 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); | 539 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); |
515 displayItemList().createAndAppend<CachedDisplayItem>(container2, DisplayItem
::paintPhaseToCachedSubtreeType(foregroundPaintPhase)); | 540 EXPECT_TRUE(SimpleSubtreeRecorder::useCachedSubtreeIfPossible(displayItemLis
t(), container2, foregroundPaintPhase)); |
516 EXPECT_EQ((size_t)2, newPaintListBeforeUpdate().size()); | 541 EXPECT_EQ((size_t)2, newPaintListBeforeUpdate().size()); |
517 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); | 542 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); |
518 | 543 |
519 displayItemList().createAndAppend<CachedDisplayItem>(container1, DisplayItem
::paintPhaseToCachedSubtreeType(backgroundPaintPhase)); | 544 EXPECT_TRUE(SimpleSubtreeRecorder::useCachedSubtreeIfPossible(displayItemLis
t(), container1, backgroundPaintPhase)); |
520 EXPECT_EQ((size_t)3, newPaintListBeforeUpdate().size()); | 545 EXPECT_EQ((size_t)3, newPaintListBeforeUpdate().size()); |
521 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); | 546 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); |
522 displayItemList().createAndAppend<CachedDisplayItem>(container1, DisplayItem
::paintPhaseToCachedSubtreeType(foregroundPaintPhase)); | 547 EXPECT_TRUE(SimpleSubtreeRecorder::useCachedSubtreeIfPossible(displayItemLis
t(), container1, foregroundPaintPhase)); |
523 EXPECT_EQ((size_t)4, newPaintListBeforeUpdate().size()); | 548 EXPECT_EQ((size_t)4, newPaintListBeforeUpdate().size()); |
524 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); | 549 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); |
525 displayItemList().commitNewDisplayItems(); | 550 displayItemList().commitNewDisplayItems(); |
526 | 551 |
527 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 16, | 552 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 16, |
528 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundDrawingType)), | 553 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundDrawingType)), |
529 TestDisplayItem(container2, backgroundDrawingType), | 554 TestDisplayItem(container2, backgroundDrawingType), |
530 TestDisplayItem(content2, backgroundDrawingType), | 555 TestDisplayItem(content2, backgroundDrawingType), |
531 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(back
groundDrawingType)), | 556 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(back
groundDrawingType)), |
532 | 557 |
533 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundDrawingType)), | 558 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundDrawingType)), |
534 TestDisplayItem(content2, foregroundDrawingType), | 559 TestDisplayItem(content2, foregroundDrawingType), |
535 TestDisplayItem(container2, foregroundDrawingType), | 560 TestDisplayItem(container2, foregroundDrawingType), |
536 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(fore
groundDrawingType)), | 561 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(fore
groundDrawingType)), |
537 | 562 |
538 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundDrawingType)), | 563 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundDrawingType)), |
539 TestDisplayItem(container1, backgroundDrawingType), | 564 TestDisplayItem(container1, backgroundDrawingType), |
540 TestDisplayItem(content1, backgroundDrawingType), | 565 TestDisplayItem(content1, backgroundDrawingType), |
541 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(back
groundDrawingType)), | 566 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(back
groundDrawingType)), |
542 | 567 |
543 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundDrawingType)), | 568 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundDrawingType)), |
544 TestDisplayItem(content1, foregroundDrawingType), | 569 TestDisplayItem(content1, foregroundDrawingType), |
545 TestDisplayItem(container1, foregroundDrawingType), | 570 TestDisplayItem(container1, foregroundDrawingType), |
546 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(fore
groundDrawingType))); | 571 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(fore
groundDrawingType))); |
547 } | 572 } |
548 | 573 |
| 574 TEST_F(DisplayItemListTest, CachedNestedSubtreeUpdate) |
| 575 { |
| 576 TestDisplayItemClient container1("container1"); |
| 577 TestDisplayItemClient content1("content1"); |
| 578 TestDisplayItemClient container2("container2"); |
| 579 TestDisplayItemClient content2("content2"); |
| 580 GraphicsContext context(&displayItemList()); |
| 581 const int backgroundPaintPhase = backgroundDrawingType - DisplayItem::Drawin
gPaintPhaseFirst; |
| 582 const int foregroundPaintPhase = foregroundDrawingType - DisplayItem::Drawin
gPaintPhaseFirst; |
| 583 |
| 584 { |
| 585 SimpleSubtreeRecorder r(displayItemList(), container1, backgroundPaintPh
ase); |
| 586 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100,
100, 100)); |
| 587 { |
| 588 SimpleSubtreeRecorder r(displayItemList(), content1, backgroundPaint
Phase); |
| 589 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 10
0, 50, 200)); |
| 590 } |
| 591 } |
| 592 { |
| 593 SimpleSubtreeRecorder r(displayItemList(), container1, foregroundPaintPh
ase); |
| 594 { |
| 595 SimpleSubtreeRecorder r(displayItemList(), content1, foregroundPaint
Phase); |
| 596 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 10
0, 50, 200)); |
| 597 } |
| 598 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100,
100, 100)); |
| 599 } |
| 600 { |
| 601 SimpleSubtreeRecorder r(displayItemList(), container2, backgroundPaintPh
ase); |
| 602 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200,
100, 100)); |
| 603 { |
| 604 SimpleSubtreeRecorder r(displayItemList(), content2, backgroundPaint
Phase); |
| 605 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 20
0, 50, 200)); |
| 606 } |
| 607 } |
| 608 displayItemList().commitNewDisplayItems(); |
| 609 |
| 610 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 18, |
| 611 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), |
| 612 TestDisplayItem(container1, backgroundDrawingType), |
| 613 TestDisplayItem(content1, DisplayItem::paintPhaseToBeginSubtreeType(back
groundPaintPhase)), |
| 614 TestDisplayItem(content1, backgroundDrawingType), |
| 615 TestDisplayItem(content1, DisplayItem::paintPhaseToEndSubtreeType(backgr
oundPaintPhase)), |
| 616 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase)), |
| 617 |
| 618 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(fo
regroundPaintPhase)), |
| 619 TestDisplayItem(content1, DisplayItem::paintPhaseToBeginSubtreeType(fore
groundPaintPhase)), |
| 620 TestDisplayItem(content1, foregroundDrawingType), |
| 621 TestDisplayItem(content1, DisplayItem::paintPhaseToEndSubtreeType(foregr
oundPaintPhase)), |
| 622 TestDisplayItem(container1, foregroundDrawingType), |
| 623 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(fore
groundPaintPhase)), |
| 624 |
| 625 TestDisplayItem(container2, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), |
| 626 TestDisplayItem(container2, backgroundDrawingType), |
| 627 TestDisplayItem(content2, DisplayItem::paintPhaseToBeginSubtreeType(back
groundPaintPhase)), |
| 628 TestDisplayItem(content2, backgroundDrawingType), |
| 629 TestDisplayItem(content2, DisplayItem::paintPhaseToEndSubtreeType(backgr
oundPaintPhase)), |
| 630 TestDisplayItem(container2, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase))); |
| 631 |
| 632 // Container2 itself now becomes empty (but still has the 'content2' child),
and chooses not to output subtree info. |
| 633 displayItemList().invalidate(container2.displayItemClient()); |
| 634 displayItemList().invalidate(content2.displayItemClient()); |
| 635 EXPECT_FALSE(SimpleSubtreeRecorder::useCachedSubtreeIfPossible(displayItemLi
st(), container2, backgroundPaintPhase)); |
| 636 EXPECT_FALSE(SimpleSubtreeRecorder::useCachedSubtreeIfPossible(displayItemLi
st(), content2, backgroundPaintPhase)); |
| 637 // Content2 now outputs foreground. |
| 638 EXPECT_FALSE(SimpleSubtreeRecorder::useCachedSubtreeIfPossible(displayItemLi
st(), content2, foregroundPaintPhase)); |
| 639 { |
| 640 SimpleSubtreeRecorder r(displayItemList(), content2, foregroundPaintPhas
e); |
| 641 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
| 642 } |
| 643 EXPECT_EQ((size_t)3, newPaintListBeforeUpdate().size()); |
| 644 |
| 645 // Container1 subtree now uses cached background, but not cached foreground. |
| 646 // The merge algorithm allows changing subtree without invalidating the disp
layItemClient. |
| 647 EXPECT_TRUE(SimpleSubtreeRecorder::useCachedSubtreeIfPossible(displayItemLis
t(), container1, backgroundPaintPhase)); |
| 648 EXPECT_EQ((size_t)4, newPaintListBeforeUpdate().size()); |
| 649 EXPECT_TRUE(newPaintListBeforeUpdate().last().isCachedSubtree()); |
| 650 |
| 651 displayItemList().commitNewDisplayItems(); |
| 652 |
| 653 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 9, |
| 654 TestDisplayItem(content2, DisplayItem::paintPhaseToBeginSubtreeType(fore
groundPaintPhase)), |
| 655 TestDisplayItem(content2, foregroundDrawingType), |
| 656 TestDisplayItem(content2, DisplayItem::paintPhaseToEndSubtreeType(foregr
oundPaintPhase)), |
| 657 |
| 658 TestDisplayItem(container1, DisplayItem::paintPhaseToBeginSubtreeType(ba
ckgroundPaintPhase)), |
| 659 TestDisplayItem(container1, backgroundDrawingType), |
| 660 TestDisplayItem(content1, DisplayItem::paintPhaseToBeginSubtreeType(back
groundPaintPhase)), |
| 661 TestDisplayItem(content1, backgroundDrawingType), |
| 662 TestDisplayItem(content1, DisplayItem::paintPhaseToEndSubtreeType(backgr
oundPaintPhase)), |
| 663 TestDisplayItem(container1, DisplayItem::paintPhaseToEndSubtreeType(back
groundPaintPhase))); |
| 664 |
| 665 EXPECT_TRUE(displayItemList().subtreeCacheIsValid(container1.displayItemClie
nt(), DisplayItem::paintPhaseToBeginSubtreeType(backgroundPaintPhase))); |
| 666 EXPECT_TRUE(displayItemList().subtreeCacheIsValid(content1.displayItemClient
(), DisplayItem::paintPhaseToBeginSubtreeType(backgroundPaintPhase))); |
| 667 EXPECT_FALSE(displayItemList().subtreeCacheIsValid(container1.displayItemCli
ent(), DisplayItem::paintPhaseToBeginSubtreeType(foregroundPaintPhase))); |
| 668 EXPECT_FALSE(displayItemList().subtreeCacheIsValid(content1.displayItemClien
t(), DisplayItem::paintPhaseToBeginSubtreeType(foregroundPaintPhase))); |
| 669 |
| 670 EXPECT_FALSE(displayItemList().subtreeCacheIsValid(container2.displayItemCli
ent(), DisplayItem::paintPhaseToBeginSubtreeType(backgroundPaintPhase))); |
| 671 EXPECT_FALSE(displayItemList().subtreeCacheIsValid(content2.displayItemClien
t(), DisplayItem::paintPhaseToBeginSubtreeType(backgroundPaintPhase))); |
| 672 EXPECT_FALSE(displayItemList().subtreeCacheIsValid(container2.displayItemCli
ent(), DisplayItem::paintPhaseToBeginSubtreeType(foregroundPaintPhase))); |
| 673 EXPECT_TRUE(displayItemList().subtreeCacheIsValid(content2.displayItemClient
(), DisplayItem::paintPhaseToBeginSubtreeType(foregroundPaintPhase))); |
| 674 } |
| 675 |
549 TEST_F(DisplayItemListTest, Scope) | 676 TEST_F(DisplayItemListTest, Scope) |
550 { | 677 { |
551 TestDisplayItemClient multicol("multicol"); | 678 TestDisplayItemClient multicol("multicol"); |
552 TestDisplayItemClient content("content"); | 679 TestDisplayItemClient content("content"); |
553 GraphicsContext context(&displayItemList()); | 680 GraphicsContext context(&displayItemList()); |
554 | 681 |
555 FloatRect rect1(100, 100, 50, 50); | 682 FloatRect rect1(100, 100, 50, 50); |
556 FloatRect rect2(150, 100, 50, 50); | 683 FloatRect rect2(150, 100, 50, 50); |
557 FloatRect rect3(200, 100, 50, 50); | 684 FloatRect rect3(200, 100, 50, 50); |
558 | 685 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 805 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
679 displayItemList().commitNewDisplayItems(); | 806 displayItemList().commitNewDisplayItems(); |
680 | 807 |
681 // Empty clips should have been optimized out. | 808 // Empty clips should have been optimized out. |
682 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 809 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
683 TestDisplayItem(first, backgroundDrawingType), | 810 TestDisplayItem(first, backgroundDrawingType), |
684 TestDisplayItem(third, backgroundDrawingType)); | 811 TestDisplayItem(third, backgroundDrawingType)); |
685 } | 812 } |
686 | 813 |
687 } // namespace blink | 814 } // namespace blink |
OLD | NEW |