| 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/ClipRecorder.h" | 10 #include "platform/graphics/paint/ClipRecorder.h" |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 585 |
| 586 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, | 586 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, |
| 587 TestDisplayItem(multicol, backgroundDrawingType), | 587 TestDisplayItem(multicol, backgroundDrawingType), |
| 588 TestDisplayItem(content, foregroundDrawingType), | 588 TestDisplayItem(content, foregroundDrawingType), |
| 589 TestDisplayItem(content, foregroundDrawingType)); | 589 TestDisplayItem(content, foregroundDrawingType)); |
| 590 RefPtr<const SkPicture> picture1 = displayItemList().displayItems()[1].pictu
re(); | 590 RefPtr<const SkPicture> picture1 = displayItemList().displayItems()[1].pictu
re(); |
| 591 RefPtr<const SkPicture> picture2 = displayItemList().displayItems()[2].pictu
re(); | 591 RefPtr<const SkPicture> picture2 = displayItemList().displayItems()[2].pictu
re(); |
| 592 EXPECT_NE(picture1, picture2); | 592 EXPECT_NE(picture1, picture2); |
| 593 | 593 |
| 594 // Draw again with nothing invalidated. | 594 // Draw again with nothing invalidated. |
| 595 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); | 595 EXPECT_TRUE(displayItemList().clientCacheIsValid(multicol.displayItemClient(
))); |
| 596 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 200, 100,
100)); |
| 596 displayItemList().beginScope(multicol.displayItemClient()); | 597 displayItemList().beginScope(multicol.displayItemClient()); |
| 597 drawRect(context, content, foregroundDrawingType, rect1); | 598 drawRect(context, content, foregroundDrawingType, rect1); |
| 598 displayItemList().endScope(multicol.displayItemClient()); | 599 displayItemList().endScope(multicol.displayItemClient()); |
| 599 | 600 |
| 600 displayItemList().beginScope(multicol.displayItemClient()); | 601 displayItemList().beginScope(multicol.displayItemClient()); |
| 601 drawRect(context, content, foregroundDrawingType, rect2); | 602 drawRect(context, content, foregroundDrawingType, rect2); |
| 602 displayItemList().endScope(multicol.displayItemClient()); | 603 displayItemList().endScope(multicol.displayItemClient()); |
| 603 | 604 |
| 604 EXPECT_TRUE(isCached(newPaintListBeforeUpdate()[0])); | 605 EXPECT_TRUE(isCached(newPaintListBeforeUpdate()[0])); |
| 605 EXPECT_TRUE(isCached(newPaintListBeforeUpdate()[1])); | 606 EXPECT_TRUE(isDrawing(newPaintListBeforeUpdate()[1])); |
| 606 EXPECT_TRUE(isCached(newPaintListBeforeUpdate()[2])); | 607 EXPECT_TRUE(isDrawing(newPaintListBeforeUpdate()[2])); |
| 607 displayItemList().commitNewDisplayItems(); | 608 displayItemList().commitNewDisplayItems(); |
| 608 | 609 |
| 609 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, | 610 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, |
| 610 TestDisplayItem(multicol, backgroundDrawingType), | 611 TestDisplayItem(multicol, backgroundDrawingType), |
| 611 TestDisplayItem(content, foregroundDrawingType), | 612 TestDisplayItem(content, foregroundDrawingType), |
| 612 TestDisplayItem(content, foregroundDrawingType)); | 613 TestDisplayItem(content, foregroundDrawingType)); |
| 613 EXPECT_EQ(picture1, displayItemList().displayItems()[1].picture()); | 614 EXPECT_NE(picture1, displayItemList().displayItems()[1].picture()); |
| 614 EXPECT_EQ(picture2, displayItemList().displayItems()[2].picture()); | 615 EXPECT_NE(picture2, displayItemList().displayItems()[2].picture()); |
| 615 | 616 |
| 616 // Now the multicol becomes 3 columns and repaints. | 617 // Now the multicol becomes 3 columns and repaints. |
| 617 displayItemList().invalidate(multicol.displayItemClient()); | 618 displayItemList().invalidate(multicol.displayItemClient()); |
| 618 displayItemList().invalidate(content.displayItemClient()); | |
| 619 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); | 619 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); |
| 620 | 620 |
| 621 displayItemList().beginScope(multicol.displayItemClient()); | 621 displayItemList().beginScope(multicol.displayItemClient()); |
| 622 drawRect(context, content, foregroundDrawingType, rect1); | 622 drawRect(context, content, foregroundDrawingType, rect1); |
| 623 displayItemList().endScope(multicol.displayItemClient()); | 623 displayItemList().endScope(multicol.displayItemClient()); |
| 624 | 624 |
| 625 displayItemList().beginScope(multicol.displayItemClient()); | 625 displayItemList().beginScope(multicol.displayItemClient()); |
| 626 drawRect(context, content, foregroundDrawingType, rect2); | 626 drawRect(context, content, foregroundDrawingType, rect2); |
| 627 displayItemList().endScope(multicol.displayItemClient()); | 627 displayItemList().endScope(multicol.displayItemClient()); |
| 628 | 628 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 640 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, | 640 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, |
| 641 TestDisplayItem(multicol, backgroundDrawingType), | 641 TestDisplayItem(multicol, backgroundDrawingType), |
| 642 TestDisplayItem(content, foregroundDrawingType), | 642 TestDisplayItem(content, foregroundDrawingType), |
| 643 TestDisplayItem(content, foregroundDrawingType), | 643 TestDisplayItem(content, foregroundDrawingType), |
| 644 TestDisplayItem(content, foregroundDrawingType)); | 644 TestDisplayItem(content, foregroundDrawingType)); |
| 645 EXPECT_NE(picture1, displayItemList().displayItems()[1].picture()); | 645 EXPECT_NE(picture1, displayItemList().displayItems()[1].picture()); |
| 646 EXPECT_NE(picture2, displayItemList().displayItems()[2].picture()); | 646 EXPECT_NE(picture2, displayItemList().displayItems()[2].picture()); |
| 647 } | 647 } |
| 648 | 648 |
| 649 } // namespace blink | 649 } // namespace blink |
| OLD | NEW |