| 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 "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
| 6 | 6 |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/paint/ClipPathDisplayItem.h" | 9 #include "platform/graphics/paint/ClipPathDisplayItem.h" |
| 10 #include "platform/graphics/paint/ClipPathRecorder.h" | 10 #include "platform/graphics/paint/ClipPathRecorder.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 void TearDown() override | 46 void TearDown() override |
| 47 { | 47 { |
| 48 m_featuresBackup.restore(); | 48 m_featuresBackup.restore(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 std::unique_ptr<PaintController> m_paintController; | 52 std::unique_ptr<PaintController> m_paintController; |
| 53 RuntimeEnabledFeatures::Backup m_featuresBackup; | 53 RuntimeEnabledFeatures::Backup m_featuresBackup; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 const DisplayItem::Type foregroundDrawingType = static_cast<DisplayItem::Type>(D
isplayItem::DrawingPaintPhaseFirst + 4); | 56 const DisplayItem::Type foregroundDrawingType = static_cast<DisplayItem::Type>(D
isplayItem::kDrawingPaintPhaseFirst + 4); |
| 57 const DisplayItem::Type backgroundDrawingType = DisplayItem::DrawingPaintPhaseFi
rst; | 57 const DisplayItem::Type backgroundDrawingType = DisplayItem::kDrawingPaintPhaseF
irst; |
| 58 const DisplayItem::Type clipType = DisplayItem::ClipFirst; | 58 const DisplayItem::Type clipType = DisplayItem::kClipFirst; |
| 59 | 59 |
| 60 class TestDisplayItem final : public DisplayItem { | 60 class TestDisplayItem final : public DisplayItem { |
| 61 public: | 61 public: |
| 62 TestDisplayItem(const FakeDisplayItemClient& client, Type type) : DisplayIte
m(client, type, sizeof(*this)) { } | 62 TestDisplayItem(const FakeDisplayItemClient& client, Type type) : DisplayIte
m(client, type, sizeof(*this)) { } |
| 63 | 63 |
| 64 void replay(GraphicsContext&) const final { ASSERT_NOT_REACHED(); } | 64 void replay(GraphicsContext&) const final { ASSERT_NOT_REACHED(); } |
| 65 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const f
inal { ASSERT_NOT_REACHED(); } | 65 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const f
inal { ASSERT_NOT_REACHED(); } |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 #ifndef NDEBUG | 68 #ifndef NDEBUG |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 UnderInvalidationCheckingSPv1, | 108 UnderInvalidationCheckingSPv1, |
| 109 UnderInvalidationCheckingSPv2, | 109 UnderInvalidationCheckingSPv2, |
| 110 #endif | 110 #endif |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 // Tests using this class will be tested with under-invalidation-checking enable
d and disabled. | 113 // Tests using this class will be tested with under-invalidation-checking enable
d and disabled. |
| 114 class PaintControllerTest : public PaintControllerTestBase, public testing::With
ParamInterface<TestConfigurations> { | 114 class PaintControllerTest : public PaintControllerTestBase, public testing::With
ParamInterface<TestConfigurations> { |
| 115 public: | 115 public: |
| 116 PaintControllerTest() | 116 PaintControllerTest() |
| 117 : m_rootPaintPropertyClient("root") | 117 : m_rootPaintPropertyClient("root") |
| 118 , m_rootPaintChunkId(m_rootPaintPropertyClient, DisplayItem::Uninitializ
edType) | 118 , m_rootPaintChunkId(m_rootPaintPropertyClient, DisplayItem::kUninitiali
zedType) |
| 119 { } | 119 { } |
| 120 | 120 |
| 121 protected: | 121 protected: |
| 122 void SetUp() override | 122 void SetUp() override |
| 123 { | 123 { |
| 124 switch (GetParam()) { | 124 switch (GetParam()) { |
| 125 case SPv1: | 125 case SPv1: |
| 126 break; | 126 break; |
| 127 case SPv2: | 127 case SPv2: |
| 128 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); | 128 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 } | 803 } |
| 804 SubsequenceRecorder r(context, container2); | 804 SubsequenceRecorder r(context, container2); |
| 805 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200,
100, 100)); | 805 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200,
100, 100)); |
| 806 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 5
0, 200)); | 806 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
| 807 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); | 807 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
| 808 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200,
100, 100)); | 808 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200,
100, 100)); |
| 809 } | 809 } |
| 810 getPaintController().commitNewDisplayItems(); | 810 getPaintController().commitNewDisplayItems(); |
| 811 | 811 |
| 812 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 12, | 812 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 12, |
| 813 TestDisplayItem(container1, DisplayItem::Subsequence), | 813 TestDisplayItem(container1, DisplayItem::kSubsequence), |
| 814 TestDisplayItem(container1, backgroundDrawingType), | 814 TestDisplayItem(container1, backgroundDrawingType), |
| 815 TestDisplayItem(content1, backgroundDrawingType), | 815 TestDisplayItem(content1, backgroundDrawingType), |
| 816 TestDisplayItem(content1, foregroundDrawingType), | 816 TestDisplayItem(content1, foregroundDrawingType), |
| 817 TestDisplayItem(container1, foregroundDrawingType), | 817 TestDisplayItem(container1, foregroundDrawingType), |
| 818 TestDisplayItem(container1, DisplayItem::EndSubsequence), | 818 TestDisplayItem(container1, DisplayItem::kEndSubsequence), |
| 819 | 819 |
| 820 TestDisplayItem(container2, DisplayItem::Subsequence), | 820 TestDisplayItem(container2, DisplayItem::kSubsequence), |
| 821 TestDisplayItem(container2, backgroundDrawingType), | 821 TestDisplayItem(container2, backgroundDrawingType), |
| 822 TestDisplayItem(content2, backgroundDrawingType), | 822 TestDisplayItem(content2, backgroundDrawingType), |
| 823 TestDisplayItem(content2, foregroundDrawingType), | 823 TestDisplayItem(content2, foregroundDrawingType), |
| 824 TestDisplayItem(container2, foregroundDrawingType), | 824 TestDisplayItem(container2, foregroundDrawingType), |
| 825 TestDisplayItem(container2, DisplayItem::EndSubsequence)); | 825 TestDisplayItem(container2, DisplayItem::kEndSubsequence)); |
| 826 | 826 |
| 827 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 827 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 828 EXPECT_EQ(2u, getPaintController().paintChunks().size()); | 828 EXPECT_EQ(2u, getPaintController().paintChunks().size()); |
| 829 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); | 829 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); |
| 830 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); | 830 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); |
| 831 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 831 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( |
| 832 FloatRect(LayoutRect::infiniteIntRect()))); | 832 FloatRect(LayoutRect::infiniteIntRect()))); |
| 833 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre( | 833 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre( |
| 834 FloatRect(LayoutRect::infiniteIntRect()))); | 834 FloatRect(LayoutRect::infiniteIntRect()))); |
| 835 } | 835 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 EXPECT_EQ(12, numCachedNewItems()); | 870 EXPECT_EQ(12, numCachedNewItems()); |
| 871 #if DCHECK_IS_ON() | 871 #if DCHECK_IS_ON() |
| 872 EXPECT_EQ(1, numSequentialMatches()); | 872 EXPECT_EQ(1, numSequentialMatches()); |
| 873 EXPECT_EQ(1, numOutOfOrderMatches()); | 873 EXPECT_EQ(1, numOutOfOrderMatches()); |
| 874 EXPECT_EQ(5, numIndexedItems()); | 874 EXPECT_EQ(5, numIndexedItems()); |
| 875 #endif | 875 #endif |
| 876 | 876 |
| 877 getPaintController().commitNewDisplayItems(); | 877 getPaintController().commitNewDisplayItems(); |
| 878 | 878 |
| 879 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 12, | 879 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 12, |
| 880 TestDisplayItem(container2, DisplayItem::Subsequence), | 880 TestDisplayItem(container2, DisplayItem::kSubsequence), |
| 881 TestDisplayItem(container2, backgroundDrawingType), | 881 TestDisplayItem(container2, backgroundDrawingType), |
| 882 TestDisplayItem(content2, backgroundDrawingType), | 882 TestDisplayItem(content2, backgroundDrawingType), |
| 883 TestDisplayItem(content2, foregroundDrawingType), | 883 TestDisplayItem(content2, foregroundDrawingType), |
| 884 TestDisplayItem(container2, foregroundDrawingType), | 884 TestDisplayItem(container2, foregroundDrawingType), |
| 885 TestDisplayItem(container2, DisplayItem::EndSubsequence), | 885 TestDisplayItem(container2, DisplayItem::kEndSubsequence), |
| 886 | 886 |
| 887 TestDisplayItem(container1, DisplayItem::Subsequence), | 887 TestDisplayItem(container1, DisplayItem::kSubsequence), |
| 888 TestDisplayItem(container1, backgroundDrawingType), | 888 TestDisplayItem(container1, backgroundDrawingType), |
| 889 TestDisplayItem(content1, backgroundDrawingType), | 889 TestDisplayItem(content1, backgroundDrawingType), |
| 890 TestDisplayItem(content1, foregroundDrawingType), | 890 TestDisplayItem(content1, foregroundDrawingType), |
| 891 TestDisplayItem(container1, foregroundDrawingType), | 891 TestDisplayItem(container1, foregroundDrawingType), |
| 892 TestDisplayItem(container1, DisplayItem::EndSubsequence)); | 892 TestDisplayItem(container1, DisplayItem::kEndSubsequence)); |
| 893 | 893 |
| 894 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 894 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 895 DisplayItemClient::endShouldKeepAliveAllClients(); | 895 DisplayItemClient::endShouldKeepAliveAllClients(); |
| 896 #endif | 896 #endif |
| 897 | 897 |
| 898 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 898 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 899 EXPECT_EQ(2u, getPaintController().paintChunks().size()); | 899 EXPECT_EQ(2u, getPaintController().paintChunks().size()); |
| 900 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); | 900 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); |
| 901 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); | 901 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[1].id); |
| 902 // Swapping order of chunks should not invalidate anything. | 902 // Swapping order of chunks should not invalidate anything. |
| 903 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre()); | 903 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre()); |
| 904 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre()); | 904 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre()); |
| 905 } | 905 } |
| 906 } | 906 } |
| 907 | 907 |
| 908 TEST_P(PaintControllerTest, OutOfOrderNoCrash) | 908 TEST_P(PaintControllerTest, OutOfOrderNoCrash) |
| 909 { | 909 { |
| 910 FakeDisplayItemClient client("client"); | 910 FakeDisplayItemClient client("client"); |
| 911 GraphicsContext context(getPaintController()); | 911 GraphicsContext context(getPaintController()); |
| 912 | 912 |
| 913 const DisplayItem::Type type1 = DisplayItem::DrawingFirst; | 913 const DisplayItem::Type type1 = DisplayItem::kDrawingFirst; |
| 914 const DisplayItem::Type type2 = static_cast<DisplayItem::Type>(DisplayItem::
DrawingFirst + 1); | 914 const DisplayItem::Type type2 = static_cast<DisplayItem::Type>(DisplayItem::
kDrawingFirst + 1); |
| 915 const DisplayItem::Type type3 = static_cast<DisplayItem::Type>(DisplayItem::
DrawingFirst + 2); | 915 const DisplayItem::Type type3 = static_cast<DisplayItem::Type>(DisplayItem::
kDrawingFirst + 2); |
| 916 const DisplayItem::Type type4 = static_cast<DisplayItem::Type>(DisplayItem::
DrawingFirst + 3); | 916 const DisplayItem::Type type4 = static_cast<DisplayItem::Type>(DisplayItem::
kDrawingFirst + 3); |
| 917 | 917 |
| 918 drawRect(context, client, type1, FloatRect(100, 100, 100, 100)); | 918 drawRect(context, client, type1, FloatRect(100, 100, 100, 100)); |
| 919 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); | 919 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); |
| 920 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); | 920 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); |
| 921 drawRect(context, client, type4, FloatRect(100, 100, 100, 100)); | 921 drawRect(context, client, type4, FloatRect(100, 100, 100, 100)); |
| 922 | 922 |
| 923 getPaintController().commitNewDisplayItems(); | 923 getPaintController().commitNewDisplayItems(); |
| 924 | 924 |
| 925 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); | 925 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); |
| 926 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); | 926 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 content2Properties.effect = EffectPaintPropertyNode::create(null
ptr, 0.8); | 983 content2Properties.effect = EffectPaintPropertyNode::create(null
ptr, 0.8); |
| 984 getPaintController().updateCurrentPaintChunkProperties(&id, cont
ent2Properties); | 984 getPaintController().updateCurrentPaintChunkProperties(&id, cont
ent2Properties); |
| 985 } | 985 } |
| 986 SubsequenceRecorder r(context, content2); | 986 SubsequenceRecorder r(context, content2); |
| 987 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 20
0, 50, 200)); | 987 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 20
0, 50, 200)); |
| 988 } | 988 } |
| 989 } | 989 } |
| 990 getPaintController().commitNewDisplayItems(); | 990 getPaintController().commitNewDisplayItems(); |
| 991 | 991 |
| 992 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 14, | 992 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 14, |
| 993 TestDisplayItem(container1, DisplayItem::Subsequence), | 993 TestDisplayItem(container1, DisplayItem::kSubsequence), |
| 994 TestDisplayItem(container1, backgroundDrawingType), | 994 TestDisplayItem(container1, backgroundDrawingType), |
| 995 TestDisplayItem(content1, DisplayItem::Subsequence), | 995 TestDisplayItem(content1, DisplayItem::kSubsequence), |
| 996 TestDisplayItem(content1, backgroundDrawingType), | 996 TestDisplayItem(content1, backgroundDrawingType), |
| 997 TestDisplayItem(content1, foregroundDrawingType), | 997 TestDisplayItem(content1, foregroundDrawingType), |
| 998 TestDisplayItem(content1, DisplayItem::EndSubsequence), | 998 TestDisplayItem(content1, DisplayItem::kEndSubsequence), |
| 999 TestDisplayItem(container1, foregroundDrawingType), | 999 TestDisplayItem(container1, foregroundDrawingType), |
| 1000 TestDisplayItem(container1, DisplayItem::EndSubsequence), | 1000 TestDisplayItem(container1, DisplayItem::kEndSubsequence), |
| 1001 | 1001 |
| 1002 TestDisplayItem(container2, DisplayItem::Subsequence), | 1002 TestDisplayItem(container2, DisplayItem::kSubsequence), |
| 1003 TestDisplayItem(container2, backgroundDrawingType), | 1003 TestDisplayItem(container2, backgroundDrawingType), |
| 1004 TestDisplayItem(content2, DisplayItem::Subsequence), | 1004 TestDisplayItem(content2, DisplayItem::kSubsequence), |
| 1005 TestDisplayItem(content2, backgroundDrawingType), | 1005 TestDisplayItem(content2, backgroundDrawingType), |
| 1006 TestDisplayItem(content2, DisplayItem::EndSubsequence), | 1006 TestDisplayItem(content2, DisplayItem::kEndSubsequence), |
| 1007 TestDisplayItem(container2, DisplayItem::EndSubsequence)); | 1007 TestDisplayItem(container2, DisplayItem::kEndSubsequence)); |
| 1008 | 1008 |
| 1009 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1009 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1010 EXPECT_EQ(5u, getPaintController().paintChunks().size()); | 1010 EXPECT_EQ(5u, getPaintController().paintChunks().size()); |
| 1011 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); | 1011 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), getPaintCon
troller().paintChunks()[0].id); |
| 1012 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), getPaintContr
oller().paintChunks()[1].id); | 1012 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), getPaintContr
oller().paintChunks()[1].id); |
| 1013 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), getPaintCon
troller().paintChunks()[2].id); | 1013 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), getPaintCon
troller().paintChunks()[2].id); |
| 1014 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[3].id); | 1014 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), getPaintCon
troller().paintChunks()[3].id); |
| 1015 EXPECT_EQ(PaintChunk::Id(content2, backgroundDrawingType), getPaintContr
oller().paintChunks()[4].id); | 1015 EXPECT_EQ(PaintChunk::Id(content2, backgroundDrawingType), getPaintContr
oller().paintChunks()[4].id); |
| 1016 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1016 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); |
| 1017 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1017 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRect
s, UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 EXPECT_EQ(4, numCachedNewItems()); | 1068 EXPECT_EQ(4, numCachedNewItems()); |
| 1069 #if DCHECK_IS_ON() | 1069 #if DCHECK_IS_ON() |
| 1070 EXPECT_EQ(1, numSequentialMatches()); | 1070 EXPECT_EQ(1, numSequentialMatches()); |
| 1071 EXPECT_EQ(0, numOutOfOrderMatches()); | 1071 EXPECT_EQ(0, numOutOfOrderMatches()); |
| 1072 EXPECT_EQ(2, numIndexedItems()); | 1072 EXPECT_EQ(2, numIndexedItems()); |
| 1073 #endif | 1073 #endif |
| 1074 | 1074 |
| 1075 getPaintController().commitNewDisplayItems(); | 1075 getPaintController().commitNewDisplayItems(); |
| 1076 | 1076 |
| 1077 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 10, | 1077 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 10, |
| 1078 TestDisplayItem(content2, DisplayItem::Subsequence), | 1078 TestDisplayItem(content2, DisplayItem::kSubsequence), |
| 1079 TestDisplayItem(content2, foregroundDrawingType), | 1079 TestDisplayItem(content2, foregroundDrawingType), |
| 1080 TestDisplayItem(content2, DisplayItem::EndSubsequence), | 1080 TestDisplayItem(content2, DisplayItem::kEndSubsequence), |
| 1081 | 1081 |
| 1082 TestDisplayItem(container1, DisplayItem::Subsequence), | 1082 TestDisplayItem(container1, DisplayItem::kSubsequence), |
| 1083 TestDisplayItem(content1, DisplayItem::Subsequence), | 1083 TestDisplayItem(content1, DisplayItem::kSubsequence), |
| 1084 TestDisplayItem(content1, backgroundDrawingType), | 1084 TestDisplayItem(content1, backgroundDrawingType), |
| 1085 TestDisplayItem(content1, foregroundDrawingType), | 1085 TestDisplayItem(content1, foregroundDrawingType), |
| 1086 TestDisplayItem(content1, DisplayItem::EndSubsequence), | 1086 TestDisplayItem(content1, DisplayItem::kEndSubsequence), |
| 1087 TestDisplayItem(container1, foregroundDrawingType), | 1087 TestDisplayItem(container1, foregroundDrawingType), |
| 1088 TestDisplayItem(container1, DisplayItem::EndSubsequence)); | 1088 TestDisplayItem(container1, DisplayItem::kEndSubsequence)); |
| 1089 | 1089 |
| 1090 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1090 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1091 EXPECT_EQ(3u, getPaintController().paintChunks().size()); | 1091 EXPECT_EQ(3u, getPaintController().paintChunks().size()); |
| 1092 EXPECT_EQ(PaintChunk::Id(content2, foregroundDrawingType), getPaintContr
oller().paintChunks()[0].id); | 1092 EXPECT_EQ(PaintChunk::Id(content2, foregroundDrawingType), getPaintContr
oller().paintChunks()[0].id); |
| 1093 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), getPaintContr
oller().paintChunks()[1].id); | 1093 EXPECT_EQ(PaintChunk::Id(content1, backgroundDrawingType), getPaintContr
oller().paintChunks()[1].id); |
| 1094 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), getPaintCon
troller().paintChunks()[2].id); | 1094 EXPECT_EQ(PaintChunk::Id(container1, foregroundDrawingType), getPaintCon
troller().paintChunks()[2].id); |
| 1095 // This is a new chunk. | 1095 // This is a new chunk. |
| 1096 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( | 1096 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRect
s, UnorderedElementsAre( |
| 1097 FloatRect(LayoutRect::infiniteIntRect()))); | 1097 FloatRect(LayoutRect::infiniteIntRect()))); |
| 1098 // This chunk didn't change. | 1098 // This chunk didn't change. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 1274 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 1275 { | 1275 { |
| 1276 ClipPathRecorder clipRecorder(context, second, Path()); | 1276 ClipPathRecorder clipRecorder(context, second, Path()); |
| 1277 drawRect(context, second, backgroundDrawingType, FloatRect(0, 0, 100, 10
0)); | 1277 drawRect(context, second, backgroundDrawingType, FloatRect(0, 0, 100, 10
0)); |
| 1278 } | 1278 } |
| 1279 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 1279 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 1280 | 1280 |
| 1281 getPaintController().commitNewDisplayItems(); | 1281 getPaintController().commitNewDisplayItems(); |
| 1282 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 5, | 1282 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 5, |
| 1283 TestDisplayItem(first, backgroundDrawingType), | 1283 TestDisplayItem(first, backgroundDrawingType), |
| 1284 TestDisplayItem(second, DisplayItem::BeginClipPath), | 1284 TestDisplayItem(second, DisplayItem::kBeginClipPath), |
| 1285 TestDisplayItem(second, backgroundDrawingType), | 1285 TestDisplayItem(second, backgroundDrawingType), |
| 1286 TestDisplayItem(second, DisplayItem::EndClipPath), | 1286 TestDisplayItem(second, DisplayItem::kEndClipPath), |
| 1287 TestDisplayItem(third, backgroundDrawingType)); | 1287 TestDisplayItem(third, backgroundDrawingType)); |
| 1288 | 1288 |
| 1289 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 1289 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 1290 { | 1290 { |
| 1291 ClipRecorder clipRecorder(context, second, clipType, IntRect(1, 1, 2, 2)
); | 1291 ClipRecorder clipRecorder(context, second, clipType, IntRect(1, 1, 2, 2)
); |
| 1292 // Do not draw anything for second. | 1292 // Do not draw anything for second. |
| 1293 } | 1293 } |
| 1294 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 1294 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 1295 getPaintController().commitNewDisplayItems(); | 1295 getPaintController().commitNewDisplayItems(); |
| 1296 | 1296 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 TEST_F(PaintControllerUnderInvalidationTest, FoldCompositingDrawingInSubsequence
) | 1759 TEST_F(PaintControllerUnderInvalidationTest, FoldCompositingDrawingInSubsequence
) |
| 1760 { | 1760 { |
| 1761 testFoldCompositingDrawingInSubsequence(); | 1761 testFoldCompositingDrawingInSubsequence(); |
| 1762 } | 1762 } |
| 1763 | 1763 |
| 1764 #endif // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) | 1764 #endif // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
| 1765 | 1765 |
| 1766 } // namespace blink | 1766 } // namespace blink |
| OLD | NEW |