Chromium Code Reviews| 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 for crbug.com/526590 | |
|
pdr.
2015/09/02 23:13:12
No need for this or the comment "// Should not cra
Xianzhu
2015/09/02 23:21:44
Done.
| |
| 520 TEST_F(DisplayItemListTest, OutOfOrderNoCrash) | |
| 521 { | |
| 522 TestDisplayItemClient client("client"); | |
| 523 GraphicsContext context(&displayItemList()); | |
| 524 | |
| 525 const DisplayItem::Type type1 = DisplayItem::DrawingFirst; | |
| 526 const DisplayItem::Type type2 = static_cast<DisplayItem::Type>(DisplayItem:: DrawingFirst + 1); | |
| 527 const DisplayItem::Type type3 = static_cast<DisplayItem::Type>(DisplayItem:: DrawingFirst + 2); | |
| 528 const DisplayItem::Type type4 = static_cast<DisplayItem::Type>(DisplayItem:: DrawingFirst + 3); | |
| 529 | |
| 530 drawRect(context, client, type1, FloatRect(100, 100, 100, 100)); | |
| 531 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); | |
| 532 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); | |
| 533 drawRect(context, client, type4, FloatRect(100, 100, 100, 100)); | |
| 534 | |
| 535 displayItemList().commitNewDisplayItems(); | |
| 536 | |
| 537 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); | |
| 538 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); | |
| 539 drawRect(context, client, type1, FloatRect(100, 100, 100, 100)); | |
| 540 drawRect(context, client, type4, FloatRect(100, 100, 100, 100)); | |
| 541 | |
| 542 displayItemList().commitNewDisplayItems(); | |
| 543 // Should not crash. | |
| 544 } | |
| 545 | |
| 519 TEST_F(DisplayItemListTest, CachedNestedSubsequenceUpdate) | 546 TEST_F(DisplayItemListTest, CachedNestedSubsequenceUpdate) |
| 520 { | 547 { |
| 521 TestDisplayItemClient container1("container1"); | 548 TestDisplayItemClient container1("container1"); |
| 522 TestDisplayItemClient content1("content1"); | 549 TestDisplayItemClient content1("content1"); |
| 523 TestDisplayItemClient container2("container2"); | 550 TestDisplayItemClient container2("container2"); |
| 524 TestDisplayItemClient content2("content2"); | 551 TestDisplayItemClient content2("content2"); |
| 525 GraphicsContext context(&displayItemList()); | 552 GraphicsContext context(&displayItemList()); |
| 526 | 553 |
| 527 { | 554 { |
| 528 SubsequenceRecorder r(context, container1); | 555 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)); | 767 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 741 displayItemList().commitNewDisplayItems(); | 768 displayItemList().commitNewDisplayItems(); |
| 742 | 769 |
| 743 // Empty clips should have been optimized out. | 770 // Empty clips should have been optimized out. |
| 744 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 771 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
| 745 TestDisplayItem(first, backgroundDrawingType), | 772 TestDisplayItem(first, backgroundDrawingType), |
| 746 TestDisplayItem(third, backgroundDrawingType)); | 773 TestDisplayItem(third, backgroundDrawingType)); |
| 747 } | 774 } |
| 748 | 775 |
| 749 } // namespace blink | 776 } // namespace blink |
| OLD | NEW |