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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 drawRect(context, client, drawingType, bound); | 116 drawRect(context, client, drawingType, bound); |
117 } | 117 } |
118 | 118 |
119 enum TestConfigurations { | 119 enum TestConfigurations { |
120 SPv1, | 120 SPv1, |
121 SPv2, | 121 SPv2, |
122 UnderInvalidationCheckingSPv1, | 122 UnderInvalidationCheckingSPv1, |
123 UnderInvalidationCheckingSPv2, | 123 UnderInvalidationCheckingSPv2, |
124 }; | 124 }; |
125 | 125 |
126 // Tests using this class will be tested with under-invalidation-checking enable
d and disabled. | 126 // Tests using this class will be tested with under-invalidation-checking |
| 127 // enabled and disabled. |
127 class PaintControllerTest | 128 class PaintControllerTest |
128 : public PaintControllerTestBase, | 129 : public PaintControllerTestBase, |
129 public testing::WithParamInterface<TestConfigurations> { | 130 public testing::WithParamInterface<TestConfigurations> { |
130 public: | 131 public: |
131 PaintControllerTest() | 132 PaintControllerTest() |
132 : m_rootPaintPropertyClient("root"), | 133 : m_rootPaintPropertyClient("root"), |
133 m_rootPaintChunkId(m_rootPaintPropertyClient, | 134 m_rootPaintChunkId(m_rootPaintPropertyClient, |
134 DisplayItem::kUninitializedType) {} | 135 DisplayItem::kUninitializedType) {} |
135 | 136 |
136 protected: | 137 protected: |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 TestDisplayItem(first, foregroundDrawingType), | 384 TestDisplayItem(first, foregroundDrawingType), |
384 TestDisplayItem(unaffected, backgroundDrawingType), | 385 TestDisplayItem(unaffected, backgroundDrawingType), |
385 TestDisplayItem(unaffected, foregroundDrawingType)); | 386 TestDisplayItem(unaffected, foregroundDrawingType)); |
386 | 387 |
387 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 388 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
388 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 389 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
389 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, | 390 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, |
390 UnorderedElementsAre( | 391 UnorderedElementsAre( |
391 FloatRect(100, 100, 100, 100), // Old bounds of |first|. | 392 FloatRect(100, 100, 100, 100), // Old bounds of |first|. |
392 FloatRect(100, 100, 100, 100))); // New bounds of |first|. | 393 FloatRect(100, 100, 100, 100))); // New bounds of |first|. |
393 // No need to invalidate r
aster of |second| because the client (|first|) which swapped order | 394 // No need to invalidate raster of |second|, because the client (|first|) |
394 // with it has been invalidated. | 395 // which swapped order with it has been invalidated. |
395 } | 396 } |
396 } | 397 } |
397 | 398 |
398 TEST_P(PaintControllerTest, UpdateNewItemInMiddle) { | 399 TEST_P(PaintControllerTest, UpdateNewItemInMiddle) { |
399 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); | 400 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); |
400 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); | 401 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); |
401 FakeDisplayItemClient third("third", LayoutRect(125, 100, 200, 50)); | 402 FakeDisplayItemClient third("third", LayoutRect(125, 100, 200, 50)); |
402 GraphicsContext context(getPaintController()); | 403 GraphicsContext context(getPaintController()); |
403 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 404 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
404 getPaintController().updateCurrentPaintChunkProperties( | 405 getPaintController().updateCurrentPaintChunkProperties( |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 TestDisplayItem(container1, foregroundDrawingType), | 866 TestDisplayItem(container1, foregroundDrawingType), |
866 TestDisplayItem(container2, backgroundDrawingType), | 867 TestDisplayItem(container2, backgroundDrawingType), |
867 TestDisplayItem(content2, backgroundDrawingType), | 868 TestDisplayItem(content2, backgroundDrawingType), |
868 TestDisplayItem(content2, foregroundDrawingType), | 869 TestDisplayItem(content2, foregroundDrawingType), |
869 TestDisplayItem(container2, foregroundDrawingType)); | 870 TestDisplayItem(container2, foregroundDrawingType)); |
870 | 871 |
871 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 872 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
872 getPaintController().updateCurrentPaintChunkProperties( | 873 getPaintController().updateCurrentPaintChunkProperties( |
873 &m_rootPaintChunkId, PaintChunkProperties()); | 874 &m_rootPaintChunkId, PaintChunkProperties()); |
874 | 875 |
875 // Simulate the situation when container1 e.g. gets a z-index that is now grea
ter than container2, | 876 // Simulate the situation when |container1| gets a z-index that is greater |
| 877 // than that of |container2|. |
876 drawRect(context, container2, backgroundDrawingType, | 878 drawRect(context, container2, backgroundDrawingType, |
877 FloatRect(100, 200, 100, 100)); | 879 FloatRect(100, 200, 100, 100)); |
878 drawRect(context, content2, backgroundDrawingType, | 880 drawRect(context, content2, backgroundDrawingType, |
879 FloatRect(100, 200, 50, 200)); | 881 FloatRect(100, 200, 50, 200)); |
880 drawRect(context, content2, foregroundDrawingType, | 882 drawRect(context, content2, foregroundDrawingType, |
881 FloatRect(100, 200, 50, 200)); | 883 FloatRect(100, 200, 50, 200)); |
882 drawRect(context, container2, foregroundDrawingType, | 884 drawRect(context, container2, foregroundDrawingType, |
883 FloatRect(100, 200, 100, 100)); | 885 FloatRect(100, 200, 100, 100)); |
884 drawRect(context, container1, backgroundDrawingType, | 886 drawRect(context, container1, backgroundDrawingType, |
885 FloatRect(100, 100, 100, 100)); | 887 FloatRect(100, 100, 100, 100)); |
(...skipping 13 matching lines...) Expand all Loading... |
899 TestDisplayItem(container1, backgroundDrawingType), | 901 TestDisplayItem(container1, backgroundDrawingType), |
900 TestDisplayItem(content1, backgroundDrawingType), | 902 TestDisplayItem(content1, backgroundDrawingType), |
901 TestDisplayItem(content1, foregroundDrawingType), | 903 TestDisplayItem(content1, foregroundDrawingType), |
902 TestDisplayItem(container1, foregroundDrawingType)); | 904 TestDisplayItem(container1, foregroundDrawingType)); |
903 | 905 |
904 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 906 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
905 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 907 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
906 EXPECT_THAT( | 908 EXPECT_THAT( |
907 getPaintController().paintChunks()[0].rasterInvalidationRects, | 909 getPaintController().paintChunks()[0].rasterInvalidationRects, |
908 UnorderedElementsAre( | 910 UnorderedElementsAre( |
909 FloatRect( | 911 FloatRect(100, 200, 100, 100), // Bounds of |container2| which was |
910 100, 200, 100, | 912 // moved behind |container1|. |
911 100), // Bounds of |container2| which was moved behind |contain
er1|. | 913 FloatRect(100, 200, 50, 200))); // Bounds of |content2| which was |
912 FloatRect( | 914 // moved along with |container2|. |
913 100, 200, 50, | |
914 200))); // Bounds of |content2| which was moved along with |con
tainer2|. | |
915 } | 915 } |
916 } | 916 } |
917 | 917 |
918 TEST_P(PaintControllerTest, UpdateSwapOrderWithChildrenAndInvalidation) { | 918 TEST_P(PaintControllerTest, UpdateSwapOrderWithChildrenAndInvalidation) { |
919 FakeDisplayItemClient container1("container1", | 919 FakeDisplayItemClient container1("container1", |
920 LayoutRect(100, 100, 100, 100)); | 920 LayoutRect(100, 100, 100, 100)); |
921 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); | 921 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); |
922 FakeDisplayItemClient container2("container2", | 922 FakeDisplayItemClient container2("container2", |
923 LayoutRect(100, 200, 100, 100)); | 923 LayoutRect(100, 200, 100, 100)); |
924 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); | 924 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); |
(...skipping 27 matching lines...) Expand all Loading... |
952 TestDisplayItem(container1, foregroundDrawingType), | 952 TestDisplayItem(container1, foregroundDrawingType), |
953 TestDisplayItem(container2, backgroundDrawingType), | 953 TestDisplayItem(container2, backgroundDrawingType), |
954 TestDisplayItem(content2, backgroundDrawingType), | 954 TestDisplayItem(content2, backgroundDrawingType), |
955 TestDisplayItem(content2, foregroundDrawingType), | 955 TestDisplayItem(content2, foregroundDrawingType), |
956 TestDisplayItem(container2, foregroundDrawingType)); | 956 TestDisplayItem(container2, foregroundDrawingType)); |
957 | 957 |
958 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 958 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
959 getPaintController().updateCurrentPaintChunkProperties( | 959 getPaintController().updateCurrentPaintChunkProperties( |
960 &m_rootPaintChunkId, PaintChunkProperties()); | 960 &m_rootPaintChunkId, PaintChunkProperties()); |
961 | 961 |
962 // Simulate the situation when container1 e.g. gets a z-index that is now grea
ter than container2. | 962 // Simulate the situation when |container1| gets a z-index that is greater |
963 // and container1 is invalidated. | 963 // than that of |container2|, and |container1| is invalidated. |
964 container1.setDisplayItemsUncached(); | 964 container1.setDisplayItemsUncached(); |
965 drawRect(context, container2, backgroundDrawingType, | 965 drawRect(context, container2, backgroundDrawingType, |
966 FloatRect(100, 200, 100, 100)); | 966 FloatRect(100, 200, 100, 100)); |
967 drawRect(context, content2, backgroundDrawingType, | 967 drawRect(context, content2, backgroundDrawingType, |
968 FloatRect(100, 200, 50, 200)); | 968 FloatRect(100, 200, 50, 200)); |
969 drawRect(context, content2, foregroundDrawingType, | 969 drawRect(context, content2, foregroundDrawingType, |
970 FloatRect(100, 200, 50, 200)); | 970 FloatRect(100, 200, 50, 200)); |
971 drawRect(context, container2, foregroundDrawingType, | 971 drawRect(context, container2, foregroundDrawingType, |
972 FloatRect(100, 200, 100, 100)); | 972 FloatRect(100, 200, 100, 100)); |
973 drawRect(context, container1, backgroundDrawingType, | 973 drawRect(context, container1, backgroundDrawingType, |
(...skipping 14 matching lines...) Expand all Loading... |
988 TestDisplayItem(container1, backgroundDrawingType), | 988 TestDisplayItem(container1, backgroundDrawingType), |
989 TestDisplayItem(content1, backgroundDrawingType), | 989 TestDisplayItem(content1, backgroundDrawingType), |
990 TestDisplayItem(content1, foregroundDrawingType), | 990 TestDisplayItem(content1, foregroundDrawingType), |
991 TestDisplayItem(container1, foregroundDrawingType)); | 991 TestDisplayItem(container1, foregroundDrawingType)); |
992 | 992 |
993 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 993 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
994 EXPECT_EQ(1u, getPaintController().paintChunks().size()); | 994 EXPECT_EQ(1u, getPaintController().paintChunks().size()); |
995 EXPECT_THAT( | 995 EXPECT_THAT( |
996 getPaintController().paintChunks()[0].rasterInvalidationRects, | 996 getPaintController().paintChunks()[0].rasterInvalidationRects, |
997 UnorderedElementsAre( | 997 UnorderedElementsAre( |
998 FloatRect(100, 100, 100, 100), // Old bounds of |container1|. | 998 FloatRect(100, 100, 100, 100), // Old bounds of |container1|. |
999 FloatRect(100, 100, 100, 100), // New bounds of |container1|. | 999 FloatRect(100, 100, 100, 100), // New bounds of |container1|. |
1000 FloatRect( | 1000 FloatRect(100, 200, 100, 100), // Bounds of |container2| which was |
1001 100, 200, 100, | 1001 // moved behind |container1|. |
1002 100), // Bounds of |container2| which was moved behind |contain
er1|. | 1002 FloatRect(100, 200, 50, 200))); // Bounds of |content2| which was |
1003 FloatRect( | 1003 // moved along with |container2|. |
1004 100, 200, 50, | |
1005 200))); // Bounds of |content2| which was moved along with |con
tainer2|. | |
1006 } | 1004 } |
1007 } | 1005 } |
1008 | 1006 |
1009 TEST_P(PaintControllerTest, CachedSubsequenceSwapOrder) { | 1007 TEST_P(PaintControllerTest, CachedSubsequenceSwapOrder) { |
1010 FakeDisplayItemClient container1("container1", | 1008 FakeDisplayItemClient container1("container1", |
1011 LayoutRect(100, 100, 100, 100)); | 1009 LayoutRect(100, 100, 100, 100)); |
1012 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); | 1010 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); |
1013 FakeDisplayItemClient container2("container2", | 1011 FakeDisplayItemClient container2("container2", |
1014 LayoutRect(100, 200, 100, 100)); | 1012 LayoutRect(100, 200, 100, 100)); |
1015 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); | 1013 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), | 1075 EXPECT_EQ(PaintChunk::Id(container1, backgroundDrawingType), |
1078 getPaintController().paintChunks()[0].id); | 1076 getPaintController().paintChunks()[0].id); |
1079 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), | 1077 EXPECT_EQ(PaintChunk::Id(container2, backgroundDrawingType), |
1080 getPaintController().paintChunks()[1].id); | 1078 getPaintController().paintChunks()[1].id); |
1081 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, | 1079 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, |
1082 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1080 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); |
1083 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRects, | 1081 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRects, |
1084 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); | 1082 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); |
1085 } | 1083 } |
1086 | 1084 |
1087 // Simulate the situation when container1 e.g. gets a z-index that is now grea
ter than container2. | 1085 // Simulate the situation when |container1| gets a z-index that is greater tha
n |
| 1086 // that of |container2|. |
1088 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 1087 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
1089 // When under-invalidation-checking is enabled, useCachedSubsequenceIfPossib
le is forced off, | 1088 // When under-invalidation-checking is enabled, |
1090 // and the client is expected to create the same painting as in the previous
paint. | 1089 // useCachedSubsequenceIfPossible is forced off, and the client is expected |
| 1090 // to create the same painting as in the previous paint. |
1091 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | 1091 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( |
1092 context, container2)); | 1092 context, container2)); |
1093 { | 1093 { |
1094 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1094 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1095 PaintChunk::Id id(container2, backgroundDrawingType); | 1095 PaintChunk::Id id(container2, backgroundDrawingType); |
1096 getPaintController().updateCurrentPaintChunkProperties( | 1096 getPaintController().updateCurrentPaintChunkProperties( |
1097 &id, container2Properties); | 1097 &id, container2Properties); |
1098 } | 1098 } |
1099 SubsequenceRecorder r(context, container2); | 1099 SubsequenceRecorder r(context, container2); |
1100 drawRect(context, container2, backgroundDrawingType, | 1100 drawRect(context, container2, backgroundDrawingType, |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 drawRect(context, content2, foregroundDrawingType, | 1449 drawRect(context, content2, foregroundDrawingType, |
1450 FloatRect(100, 200, 50, 200)); | 1450 FloatRect(100, 200, 50, 200)); |
1451 } | 1451 } |
1452 // Repaint container1 with foreground only. | 1452 // Repaint container1 with foreground only. |
1453 { | 1453 { |
1454 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | 1454 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( |
1455 context, container1)); | 1455 context, container1)); |
1456 SubsequenceRecorder r(context, container1); | 1456 SubsequenceRecorder r(context, container1); |
1457 // Use cached subsequence of content1. | 1457 // Use cached subsequence of content1. |
1458 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 1458 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
1459 // When under-invalidation-checking is enabled, useCachedSubsequenceIfPoss
ible is forced off, | 1459 // When under-invalidation-checking is enabled, |
1460 // and the client is expected to create the same painting as in the previo
us paint. | 1460 // useCachedSubsequenceIfPossible is forced off, and the client is |
| 1461 // expected to create the same painting as in the previous paint. |
1461 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | 1462 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( |
1462 context, content1)); | 1463 context, content1)); |
1463 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1464 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
1464 PaintChunk::Id id(content1, backgroundDrawingType); | 1465 PaintChunk::Id id(content1, backgroundDrawingType); |
1465 getPaintController().updateCurrentPaintChunkProperties( | 1466 getPaintController().updateCurrentPaintChunkProperties( |
1466 &id, content1Properties); | 1467 &id, content1Properties); |
1467 } | 1468 } |
1468 SubsequenceRecorder r(context, content1); | 1469 SubsequenceRecorder r(context, content1); |
1469 drawRect(context, content1, backgroundDrawingType, | 1470 drawRect(context, content1, backgroundDrawingType, |
1470 FloatRect(100, 100, 50, 200)); | 1471 FloatRect(100, 100, 50, 200)); |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 SubsequenceRecorder::useCachedSubsequenceIfPossible(context, container)); | 1926 SubsequenceRecorder::useCachedSubsequenceIfPossible(context, container)); |
1926 getPaintController().commitNewDisplayItems(LayoutSize()); | 1927 getPaintController().commitNewDisplayItems(LayoutSize()); |
1927 EXPECT_FALSE( | 1928 EXPECT_FALSE( |
1928 getPaintController().paintArtifact().isSuitableForGpuRasterization()); | 1929 getPaintController().paintArtifact().isSuitableForGpuRasterization()); |
1929 | 1930 |
1930 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 1931 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
1931 DisplayItemClient::endShouldKeepAliveAllClients(); | 1932 DisplayItemClient::endShouldKeepAliveAllClients(); |
1932 #endif | 1933 #endif |
1933 } | 1934 } |
1934 | 1935 |
1935 // Temporarily disabled (pref regressions due to GPU veto stickiness: http://crb
ug.com/603969). | 1936 // Temporarily disabled (pref regressions due to GPU veto stickiness: |
| 1937 // http://crbug.com/603969). |
1936 TEST_F(PaintControllerTestBase, | 1938 TEST_F(PaintControllerTestBase, |
1937 DISABLED_IsNotSuitableForGpuRasterizationConcaveClipPath) { | 1939 DISABLED_IsNotSuitableForGpuRasterizationConcaveClipPath) { |
1938 Path path; | 1940 Path path; |
1939 path.addLineTo(FloatPoint(50, 50)); | 1941 path.addLineTo(FloatPoint(50, 50)); |
1940 path.addLineTo(FloatPoint(100, 0)); | 1942 path.addLineTo(FloatPoint(100, 0)); |
1941 path.addLineTo(FloatPoint(50, 100)); | 1943 path.addLineTo(FloatPoint(50, 100)); |
1942 path.closeSubpath(); | 1944 path.closeSubpath(); |
1943 | 1945 |
1944 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); | 1946 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); |
1945 GraphicsContext context(getPaintController()); | 1947 GraphicsContext context(getPaintController()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 { | 2021 { |
2020 SubsequenceRecorder r(context, container); | 2022 SubsequenceRecorder r(context, container); |
2021 drawRect(context, container, backgroundDrawingType, | 2023 drawRect(context, container, backgroundDrawingType, |
2022 FloatRect(100, 100, 100, 100)); | 2024 FloatRect(100, 100, 100, 100)); |
2023 } | 2025 } |
2024 getPaintController().commitNewDisplayItems(); | 2026 getPaintController().commitNewDisplayItems(); |
2025 | 2027 |
2026 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | 2028 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( |
2027 context, container)); | 2029 context, container)); |
2028 { | 2030 { |
2029 // Generate some no-op pairs which should not affect under-invalidation ch
ecking. | 2031 // Generate some no-op pairs which should not affect under-invalidation |
| 2032 // checking. |
2030 ClipRecorder r1(context, container, clipType, IntRect(1, 1, 9, 9)); | 2033 ClipRecorder r1(context, container, clipType, IntRect(1, 1, 9, 9)); |
2031 ClipRecorder r2(context, container, clipType, IntRect(1, 1, 2, 2)); | 2034 ClipRecorder r2(context, container, clipType, IntRect(1, 1, 2, 2)); |
2032 ClipRecorder r3(context, container, clipType, IntRect(1, 1, 3, 3)); | 2035 ClipRecorder r3(context, container, clipType, IntRect(1, 1, 3, 3)); |
2033 ClipPathRecorder r4(context, container, Path()); | 2036 ClipPathRecorder r4(context, container, Path()); |
2034 } | 2037 } |
2035 { | 2038 { |
2036 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( | 2039 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible( |
2037 context, container)); | 2040 context, container)); |
2038 SubsequenceRecorder r(context, container); | 2041 SubsequenceRecorder r(context, container); |
2039 drawRect(context, container, backgroundDrawingType, | 2042 drawRect(context, container, backgroundDrawingType, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 | 2209 |
2207 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { | 2210 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawing) { |
2208 EXPECT_DEATH(testChangeDrawing(), "under-invalidation: display item changed"); | 2211 EXPECT_DEATH(testChangeDrawing(), "under-invalidation: display item changed"); |
2209 } | 2212 } |
2210 | 2213 |
2211 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawing) { | 2214 TEST_F(PaintControllerUnderInvalidationTest, MoreDrawing) { |
2212 EXPECT_DEATH(testMoreDrawing(), ""); | 2215 EXPECT_DEATH(testMoreDrawing(), ""); |
2213 } | 2216 } |
2214 | 2217 |
2215 TEST_F(PaintControllerUnderInvalidationTest, LessDrawing) { | 2218 TEST_F(PaintControllerUnderInvalidationTest, LessDrawing) { |
2216 // We don't detect under-invalidation in this case, and PaintController can al
so handle the case gracefully. | 2219 // We don't detect under-invalidation in this case, and PaintController can |
2217 // However, less-drawing at a time often means more-drawing at another time so
eventually we'll detect | 2220 // also handle the case gracefully. However, less drawing at one time often |
2218 // such under-invalidations. | 2221 // means more-drawing at another time, so eventually we'll detect such |
| 2222 // under-invalidations. |
2219 testLessDrawing(); | 2223 testLessDrawing(); |
2220 } | 2224 } |
2221 | 2225 |
2222 TEST_F(PaintControllerUnderInvalidationTest, NoopPairsInSubsequence) { | 2226 TEST_F(PaintControllerUnderInvalidationTest, NoopPairsInSubsequence) { |
2223 // This should not die. | 2227 // This should not die. |
2224 testNoopPairsInSubsequence(); | 2228 testNoopPairsInSubsequence(); |
2225 } | 2229 } |
2226 | 2230 |
2227 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawingInSubsequence) { | 2231 TEST_F(PaintControllerUnderInvalidationTest, ChangeDrawingInSubsequence) { |
2228 EXPECT_DEATH(testChangeDrawingInSubsequence(), | 2232 EXPECT_DEATH(testChangeDrawingInSubsequence(), |
(...skipping 13 matching lines...) Expand all Loading... |
2242 "display item changed"); | 2246 "display item changed"); |
2243 } | 2247 } |
2244 | 2248 |
2245 TEST_F(PaintControllerUnderInvalidationTest, ChangeNonCacheableInSubsequence) { | 2249 TEST_F(PaintControllerUnderInvalidationTest, ChangeNonCacheableInSubsequence) { |
2246 EXPECT_DEATH(testChangeNonCacheableInSubsequence(), | 2250 EXPECT_DEATH(testChangeNonCacheableInSubsequence(), |
2247 "\"\\(In cached subsequence of container\\)\" " | 2251 "\"\\(In cached subsequence of container\\)\" " |
2248 "under-invalidation: display item changed"); | 2252 "under-invalidation: display item changed"); |
2249 } | 2253 } |
2250 | 2254 |
2251 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { | 2255 TEST_F(PaintControllerUnderInvalidationTest, InvalidationInSubsequence) { |
2252 // We allow invalidated display item clients as long as they would produce the
same display items. | 2256 // We allow invalidated display item clients as long as they would produce the |
2253 // The cases of changed display items are tested by other test cases. | 2257 // same display items. The cases of changed display items are tested by other |
| 2258 // test cases. |
2254 testInvalidationInSubsequence(); | 2259 testInvalidationInSubsequence(); |
2255 } | 2260 } |
2256 | 2261 |
2257 TEST_F(PaintControllerUnderInvalidationTest, | 2262 TEST_F(PaintControllerUnderInvalidationTest, |
2258 FoldCompositingDrawingInSubsequence) { | 2263 FoldCompositingDrawingInSubsequence) { |
2259 testFoldCompositingDrawingInSubsequence(); | 2264 testFoldCompositingDrawingInSubsequence(); |
2260 } | 2265 } |
2261 | 2266 |
2262 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) | 2267 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
2263 | 2268 |
2264 } // namespace blink | 2269 } // namespace blink |
OLD | NEW |