| 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" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 TestDisplayItem(container2, DisplayItem::EndSubsequence), | 509 TestDisplayItem(container2, DisplayItem::EndSubsequence), |
| 510 | 510 |
| 511 TestDisplayItem(container1, DisplayItem::BeginSubsequence), | 511 TestDisplayItem(container1, DisplayItem::BeginSubsequence), |
| 512 TestDisplayItem(container1, backgroundDrawingType), | 512 TestDisplayItem(container1, backgroundDrawingType), |
| 513 TestDisplayItem(content1, backgroundDrawingType), | 513 TestDisplayItem(content1, backgroundDrawingType), |
| 514 TestDisplayItem(content1, foregroundDrawingType), | 514 TestDisplayItem(content1, foregroundDrawingType), |
| 515 TestDisplayItem(container1, foregroundDrawingType), | 515 TestDisplayItem(container1, foregroundDrawingType), |
| 516 TestDisplayItem(container1, DisplayItem::EndSubsequence)); | 516 TestDisplayItem(container1, DisplayItem::EndSubsequence)); |
| 517 } | 517 } |
| 518 | 518 |
| 519 TEST_F(DisplayItemListTest, OutOfOrderNoCrash) |
| 520 { |
| 521 TestDisplayItemClient client("client"); |
| 522 GraphicsContext context(&displayItemList()); |
| 523 |
| 524 const DisplayItem::Type type1 = DisplayItem::DrawingFirst; |
| 525 const DisplayItem::Type type2 = static_cast<DisplayItem::Type>(DisplayItem::
DrawingFirst + 1); |
| 526 const DisplayItem::Type type3 = static_cast<DisplayItem::Type>(DisplayItem::
DrawingFirst + 2); |
| 527 const DisplayItem::Type type4 = static_cast<DisplayItem::Type>(DisplayItem::
DrawingFirst + 3); |
| 528 |
| 529 drawRect(context, client, type1, FloatRect(100, 100, 100, 100)); |
| 530 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); |
| 531 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); |
| 532 drawRect(context, client, type4, FloatRect(100, 100, 100, 100)); |
| 533 |
| 534 displayItemList().commitNewDisplayItems(); |
| 535 |
| 536 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); |
| 537 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); |
| 538 drawRect(context, client, type1, FloatRect(100, 100, 100, 100)); |
| 539 drawRect(context, client, type4, FloatRect(100, 100, 100, 100)); |
| 540 |
| 541 displayItemList().commitNewDisplayItems(); |
| 542 } |
| 543 |
| 519 TEST_F(DisplayItemListTest, CachedNestedSubsequenceUpdate) | 544 TEST_F(DisplayItemListTest, CachedNestedSubsequenceUpdate) |
| 520 { | 545 { |
| 521 TestDisplayItemClient container1("container1"); | 546 TestDisplayItemClient container1("container1"); |
| 522 TestDisplayItemClient content1("content1"); | 547 TestDisplayItemClient content1("content1"); |
| 523 TestDisplayItemClient container2("container2"); | 548 TestDisplayItemClient container2("container2"); |
| 524 TestDisplayItemClient content2("content2"); | 549 TestDisplayItemClient content2("content2"); |
| 525 GraphicsContext context(&displayItemList()); | 550 GraphicsContext context(&displayItemList()); |
| 526 | 551 |
| 527 { | 552 { |
| 528 SubsequenceRecorder r(context, container1); | 553 SubsequenceRecorder r(context, container1); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 765 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 741 displayItemList().commitNewDisplayItems(); | 766 displayItemList().commitNewDisplayItems(); |
| 742 | 767 |
| 743 // Empty clips should have been optimized out. | 768 // Empty clips should have been optimized out. |
| 744 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 769 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
| 745 TestDisplayItem(first, backgroundDrawingType), | 770 TestDisplayItem(first, backgroundDrawingType), |
| 746 TestDisplayItem(third, backgroundDrawingType)); | 771 TestDisplayItem(third, backgroundDrawingType)); |
| 747 } | 772 } |
| 748 | 773 |
| 749 } // namespace blink | 774 } // namespace blink |
| OLD | NEW |