Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "platform/graphics/paint/ClipRecorder.h" 11 #include "platform/graphics/paint/ClipRecorder.h"
12 #include "platform/graphics/paint/CompositingRecorder.h" 12 #include "platform/graphics/paint/CompositingRecorder.h"
13 #include "platform/graphics/paint/DrawingDisplayItem.h" 13 #include "platform/graphics/paint/DrawingDisplayItem.h"
14 #include "platform/graphics/paint/DrawingRecorder.h" 14 #include "platform/graphics/paint/DrawingRecorder.h"
15 #include "platform/graphics/paint/SubsequenceRecorder.h" 15 #include "platform/graphics/paint/SubsequenceRecorder.h"
16 #include "platform/testing/FakeDisplayItemClient.h" 16 #include "platform/testing/FakeDisplayItemClient.h"
17 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include <memory> 19 #include <memory>
20 20
21 #define CDL_SUPPORTS_SUITABLE_FOR_GPU_RASTERIZATION 0
22
21 using testing::UnorderedElementsAre; 23 using testing::UnorderedElementsAre;
22 24
23 namespace blink { 25 namespace blink {
24 26
25 class PaintControllerTestBase : public testing::Test { 27 class PaintControllerTestBase : public testing::Test {
26 public: 28 public:
27 PaintControllerTestBase() : m_paintController(PaintController::create()) {} 29 PaintControllerTestBase() : m_paintController(PaintController::create()) {}
28 30
29 IntRect visualRect(const PaintArtifact& paintArtifact, size_t index) { 31 IntRect visualRect(const PaintArtifact& paintArtifact, size_t index) {
30 return paintArtifact.getDisplayItemList().visualRect(index); 32 return paintArtifact.getDisplayItemList().visualRect(index);
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 FloatRect(100, 100, 150, 150)); 813 FloatRect(100, 100, 150, 150));
812 drawRect(context, second, backgroundDrawingType, 814 drawRect(context, second, backgroundDrawingType,
813 FloatRect(100, 100, 150, 150)); 815 FloatRect(100, 100, 150, 150));
814 getPaintController().commitNewDisplayItems(); 816 getPaintController().commitNewDisplayItems();
815 817
816 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, 818 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
817 TestDisplayItem(first, backgroundDrawingType), 819 TestDisplayItem(first, backgroundDrawingType),
818 TestDisplayItem(second, backgroundDrawingType)); 820 TestDisplayItem(second, backgroundDrawingType));
819 EXPECT_TRUE(getPaintController().clientCacheIsValid(first)); 821 EXPECT_TRUE(getPaintController().clientCacheIsValid(first));
820 EXPECT_TRUE(getPaintController().clientCacheIsValid(second)); 822 EXPECT_TRUE(getPaintController().clientCacheIsValid(second));
821 const SkPicture* firstPicture = 823 const CdlPicture* firstPicture =
822 static_cast<const DrawingDisplayItem&>( 824 static_cast<const DrawingDisplayItem&>(
823 getPaintController().getDisplayItemList()[0]) 825 getPaintController().getDisplayItemList()[0])
824 .picture(); 826 .picture();
825 const SkPicture* secondPicture = 827 const CdlPicture* secondPicture =
826 static_cast<const DrawingDisplayItem&>( 828 static_cast<const DrawingDisplayItem&>(
827 getPaintController().getDisplayItemList()[1]) 829 getPaintController().getDisplayItemList()[1])
828 .picture(); 830 .picture();
829 831
830 first.setDisplayItemsUncached(); 832 first.setDisplayItemsUncached();
831 EXPECT_FALSE(getPaintController().clientCacheIsValid(first)); 833 EXPECT_FALSE(getPaintController().clientCacheIsValid(first));
832 EXPECT_TRUE(getPaintController().clientCacheIsValid(second)); 834 EXPECT_TRUE(getPaintController().clientCacheIsValid(second));
833 835
834 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 836 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
835 getPaintController().updateCurrentPaintChunkProperties( 837 getPaintController().updateCurrentPaintChunkProperties(
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 drawRect(context, content, foregroundDrawingType, rect1); 1612 drawRect(context, content, foregroundDrawingType, rect1);
1611 drawRect(context, content, foregroundDrawingType, rect2); 1613 drawRect(context, content, foregroundDrawingType, rect2);
1612 getPaintController().endSkippingCache(); 1614 getPaintController().endSkippingCache();
1613 1615
1614 getPaintController().commitNewDisplayItems(); 1616 getPaintController().commitNewDisplayItems();
1615 1617
1616 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, 1618 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3,
1617 TestDisplayItem(multicol, backgroundDrawingType), 1619 TestDisplayItem(multicol, backgroundDrawingType),
1618 TestDisplayItem(content, foregroundDrawingType), 1620 TestDisplayItem(content, foregroundDrawingType),
1619 TestDisplayItem(content, foregroundDrawingType)); 1621 TestDisplayItem(content, foregroundDrawingType));
1620 sk_sp<const SkPicture> picture1 = 1622 sk_sp<const CdlPicture> picture1 =
1621 sk_ref_sp(static_cast<const DrawingDisplayItem&>( 1623 sk_ref_sp(static_cast<const DrawingDisplayItem&>(
1622 getPaintController().getDisplayItemList()[1]) 1624 getPaintController().getDisplayItemList()[1])
1623 .picture()); 1625 .picture());
1624 sk_sp<const SkPicture> picture2 = 1626 sk_sp<const CdlPicture> picture2 =
1625 sk_ref_sp(static_cast<const DrawingDisplayItem&>( 1627 sk_ref_sp(static_cast<const DrawingDisplayItem&>(
1626 getPaintController().getDisplayItemList()[2]) 1628 getPaintController().getDisplayItemList()[2])
1627 .picture()); 1629 .picture());
1628 EXPECT_NE(picture1, picture2); 1630 EXPECT_NE(picture1, picture2);
1629 1631
1630 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1632 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1631 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 1633 EXPECT_EQ(1u, getPaintController().paintChunks().size());
1632 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 1634 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
1633 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); 1635 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect())));
1634 1636
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 drawRect(context, content, foregroundDrawingType, rect2); 1735 drawRect(context, content, foregroundDrawingType, rect2);
1734 getPaintController().endSkippingCache(); 1736 getPaintController().endSkippingCache();
1735 drawRect(context, content, foregroundDrawingType, rect3); 1737 drawRect(context, content, foregroundDrawingType, rect3);
1736 1738
1737 getPaintController().commitNewDisplayItems(); 1739 getPaintController().commitNewDisplayItems();
1738 1740
1739 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, 1741 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3,
1740 TestDisplayItem(content, backgroundDrawingType), 1742 TestDisplayItem(content, backgroundDrawingType),
1741 TestDisplayItem(content, foregroundDrawingType), 1743 TestDisplayItem(content, foregroundDrawingType),
1742 TestDisplayItem(content, foregroundDrawingType)); 1744 TestDisplayItem(content, foregroundDrawingType));
1743 sk_sp<const SkPicture> picture0 = 1745 sk_sp<const CdlPicture> picture0 =
1744 sk_ref_sp(static_cast<const DrawingDisplayItem&>( 1746 sk_ref_sp(static_cast<const DrawingDisplayItem&>(
1745 getPaintController().getDisplayItemList()[0]) 1747 getPaintController().getDisplayItemList()[0])
1746 .picture()); 1748 .picture());
1747 sk_sp<const SkPicture> picture1 = 1749 sk_sp<const CdlPicture> picture1 =
1748 sk_ref_sp(static_cast<const DrawingDisplayItem&>( 1750 sk_ref_sp(static_cast<const DrawingDisplayItem&>(
1749 getPaintController().getDisplayItemList()[1]) 1751 getPaintController().getDisplayItemList()[1])
1750 .picture()); 1752 .picture());
1751 sk_sp<const SkPicture> picture2 = 1753 sk_sp<const CdlPicture> picture2 =
1752 sk_ref_sp(static_cast<const DrawingDisplayItem&>( 1754 sk_ref_sp(static_cast<const DrawingDisplayItem&>(
1753 getPaintController().getDisplayItemList()[2]) 1755 getPaintController().getDisplayItemList()[2])
1754 .picture()); 1756 .picture());
1755 EXPECT_NE(picture1, picture2); 1757 EXPECT_NE(picture1, picture2);
1756 1758
1757 // Content's cache is invalid because it has display items skipped cache. 1759 // Content's cache is invalid because it has display items skipped cache.
1758 EXPECT_FALSE(getPaintController().clientCacheIsValid(content)); 1760 EXPECT_FALSE(getPaintController().clientCacheIsValid(content));
1759 EXPECT_EQ(PaintInvalidationFull, content.getPaintInvalidationReason()); 1761 EXPECT_EQ(PaintInvalidationFull, content.getPaintInvalidationReason());
1760 1762
1761 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1763 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 1886
1885 DrawingRecorder drawingRecorder(context, client, type, 1887 DrawingRecorder drawingRecorder(context, client, type,
1886 FloatRect(0, 0, 100, 100)); 1888 FloatRect(0, 0, 100, 100));
1887 SkPath path; 1889 SkPath path;
1888 path.moveTo(0, 0); 1890 path.moveTo(0, 0);
1889 path.lineTo(0, 100); 1891 path.lineTo(0, 100);
1890 path.lineTo(50, 50); 1892 path.lineTo(50, 50);
1891 path.lineTo(100, 100); 1893 path.lineTo(100, 100);
1892 path.lineTo(100, 0); 1894 path.lineTo(100, 0);
1893 path.close(); 1895 path.close();
1894 SkPaint paint; 1896 CdlPaint paint;
1895 paint.setAntiAlias(true); 1897 paint.setAntiAlias(true);
1896 for (unsigned i = 0; i < count; i++) 1898 for (unsigned i = 0; i < count; i++)
1897 context.drawPath(path, paint); 1899 context.drawPath(path, paint);
1898 } 1900 }
1899 1901
1900 TEST_F(PaintControllerTestBase, IsSuitableForGpuRasterizationSinglePath) { 1902 TEST_F(PaintControllerTestBase, IsSuitableForGpuRasterizationSinglePath) {
1903 #if CDL_SUPPORTS_SUITABLE_FOR_GPU_RASTERIZATION
1901 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); 1904 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100));
1902 GraphicsContext context(getPaintController()); 1905 GraphicsContext context(getPaintController());
1903 drawPath(context, client, backgroundDrawingType, 1); 1906 drawPath(context, client, backgroundDrawingType, 1);
1904 getPaintController().commitNewDisplayItems(LayoutSize()); 1907 getPaintController().commitNewDisplayItems(LayoutSize());
1905 EXPECT_TRUE( 1908 EXPECT_TRUE(
1906 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 1909 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1910 #endif
1907 } 1911 }
1908 1912
1909 TEST_F(PaintControllerTestBase, 1913 TEST_F(PaintControllerTestBase,
1910 IsNotSuitableForGpuRasterizationSinglePictureManyPaths) { 1914 IsNotSuitableForGpuRasterizationSinglePictureManyPaths) {
1915 #if CDL_SUPPORTS_SUITABLE_FOR_GPU_RASTERIZATION
1911 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); 1916 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100));
1912 GraphicsContext context(getPaintController()); 1917 GraphicsContext context(getPaintController());
1913 1918
1914 drawPath(context, client, backgroundDrawingType, 50); 1919 drawPath(context, client, backgroundDrawingType, 50);
1915 getPaintController().commitNewDisplayItems(LayoutSize()); 1920 getPaintController().commitNewDisplayItems(LayoutSize());
1916 EXPECT_FALSE( 1921 EXPECT_FALSE(
1917 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 1922 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1923 #endif
1918 } 1924 }
1919 1925
1920 TEST_F(PaintControllerTestBase, 1926 TEST_F(PaintControllerTestBase,
1921 IsNotSuitableForGpuRasterizationMultiplePicturesSinglePathEach) { 1927 IsNotSuitableForGpuRasterizationMultiplePicturesSinglePathEach) {
1928 #if CDL_SUPPORTS_SUITABLE_FOR_GPU_RASTERIZATION
1922 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); 1929 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100));
1923 GraphicsContext context(getPaintController()); 1930 GraphicsContext context(getPaintController());
1924 getPaintController().beginSkippingCache(); 1931 getPaintController().beginSkippingCache();
1925 1932
1926 for (int i = 0; i < 50; ++i) 1933 for (int i = 0; i < 50; ++i)
1927 drawPath(context, client, backgroundDrawingType, 50); 1934 drawPath(context, client, backgroundDrawingType, 50);
1928 1935
1929 getPaintController().endSkippingCache(); 1936 getPaintController().endSkippingCache();
1930 getPaintController().commitNewDisplayItems(LayoutSize()); 1937 getPaintController().commitNewDisplayItems(LayoutSize());
1931 EXPECT_FALSE( 1938 EXPECT_FALSE(
1932 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 1939 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1940 #endif
1933 } 1941 }
1934 1942
1935 TEST_F(PaintControllerTestBase, 1943 TEST_F(PaintControllerTestBase,
1936 IsNotSuitableForGpuRasterizationSinglePictureManyPathsTwoPaints) { 1944 IsNotSuitableForGpuRasterizationSinglePictureManyPathsTwoPaints) {
1945 #if CDL_SUPPORTS_SUITABLE_FOR_GPU_RASTERIZATION
1937 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); 1946 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100));
1938 1947
1939 { 1948 {
1940 GraphicsContext context(getPaintController()); 1949 GraphicsContext context(getPaintController());
1941 drawPath(context, client, backgroundDrawingType, 50); 1950 drawPath(context, client, backgroundDrawingType, 50);
1942 getPaintController().commitNewDisplayItems(LayoutSize()); 1951 getPaintController().commitNewDisplayItems(LayoutSize());
1943 EXPECT_FALSE( 1952 EXPECT_FALSE(
1944 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 1953 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1945 } 1954 }
1946 1955
1947 client.setDisplayItemsUncached(); 1956 client.setDisplayItemsUncached();
1948 1957
1949 { 1958 {
1950 GraphicsContext context(getPaintController()); 1959 GraphicsContext context(getPaintController());
1951 drawPath(context, client, backgroundDrawingType, 50); 1960 drawPath(context, client, backgroundDrawingType, 50);
1952 getPaintController().commitNewDisplayItems(LayoutSize()); 1961 getPaintController().commitNewDisplayItems(LayoutSize());
1953 EXPECT_FALSE( 1962 EXPECT_FALSE(
1954 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 1963 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1955 } 1964 }
1965 #endif
1956 } 1966 }
1957 1967
1958 TEST_F(PaintControllerTestBase, 1968 TEST_F(PaintControllerTestBase,
1959 IsNotSuitableForGpuRasterizationSinglePictureManyPathsCached) { 1969 IsNotSuitableForGpuRasterizationSinglePictureManyPathsCached) {
1970 #if CDL_SUPPORTS_SUITABLE_FOR_GPU_RASTERIZATION
1960 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); 1971 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100));
1961 1972
1962 { 1973 {
1963 GraphicsContext context(getPaintController()); 1974 GraphicsContext context(getPaintController());
1964 drawPath(context, client, backgroundDrawingType, 50); 1975 drawPath(context, client, backgroundDrawingType, 50);
1965 getPaintController().commitNewDisplayItems(LayoutSize()); 1976 getPaintController().commitNewDisplayItems(LayoutSize());
1966 EXPECT_FALSE( 1977 EXPECT_FALSE(
1967 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 1978 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1968 } 1979 }
1969 1980
1970 { 1981 {
1971 GraphicsContext context(getPaintController()); 1982 GraphicsContext context(getPaintController());
1972 drawPath(context, client, backgroundDrawingType, 50); 1983 drawPath(context, client, backgroundDrawingType, 50);
1973 getPaintController().commitNewDisplayItems(LayoutSize()); 1984 getPaintController().commitNewDisplayItems(LayoutSize());
1974 EXPECT_FALSE( 1985 EXPECT_FALSE(
1975 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 1986 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1976 } 1987 }
1988 #endif
1977 } 1989 }
1978 1990
1979 TEST_F( 1991 TEST_F(
1980 PaintControllerTestBase, 1992 PaintControllerTestBase,
1981 IsNotSuitableForGpuRasterizationSinglePictureManyPathsCachedSubsequence) { 1993 IsNotSuitableForGpuRasterizationSinglePictureManyPathsCachedSubsequence) {
1994 #if CDL_SUPPORTS_SUITABLE_FOR_GPU_RASTERIZATION
1982 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); 1995 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100));
1983 FakeDisplayItemClient container("container", LayoutRect(0, 0, 200, 100)); 1996 FakeDisplayItemClient container("container", LayoutRect(0, 0, 200, 100));
1984 1997
1985 GraphicsContext context(getPaintController()); 1998 GraphicsContext context(getPaintController());
1986 { 1999 {
1987 SubsequenceRecorder subsequenceRecorder(context, container); 2000 SubsequenceRecorder subsequenceRecorder(context, container);
1988 drawPath(context, client, backgroundDrawingType, 50); 2001 drawPath(context, client, backgroundDrawingType, 50);
1989 } 2002 }
1990 getPaintController().commitNewDisplayItems(LayoutSize()); 2003 getPaintController().commitNewDisplayItems(LayoutSize());
1991 EXPECT_FALSE( 2004 EXPECT_FALSE(
1992 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 2005 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1993 2006
1994 EXPECT_TRUE( 2007 EXPECT_TRUE(
1995 SubsequenceRecorder::useCachedSubsequenceIfPossible(context, container)); 2008 SubsequenceRecorder::useCachedSubsequenceIfPossible(context, container));
1996 getPaintController().commitNewDisplayItems(LayoutSize()); 2009 getPaintController().commitNewDisplayItems(LayoutSize());
1997 EXPECT_FALSE( 2010 EXPECT_FALSE(
1998 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 2011 getPaintController().paintArtifact().isSuitableForGpuRasterization());
1999 2012
2000 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 2013 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
2001 DisplayItemClient::endShouldKeepAliveAllClients(); 2014 DisplayItemClient::endShouldKeepAliveAllClients();
2002 #endif 2015 #endif
2016 #endif
2003 } 2017 }
2004 2018
2005 // Temporarily disabled (pref regressions due to GPU veto stickiness: 2019 // Temporarily disabled (pref regressions due to GPU veto stickiness:
2006 // http://crbug.com/603969). 2020 // http://crbug.com/603969).
2007 TEST_F(PaintControllerTestBase, 2021 TEST_F(PaintControllerTestBase,
2008 DISABLED_IsNotSuitableForGpuRasterizationConcaveClipPath) { 2022 DISABLED_IsNotSuitableForGpuRasterizationConcaveClipPath) {
2023 #if CDL_SUPPORTS_SUITABLE_FOR_GPU_RASTERIZATION
2009 Path path; 2024 Path path;
2010 path.addLineTo(FloatPoint(50, 50)); 2025 path.addLineTo(FloatPoint(50, 50));
2011 path.addLineTo(FloatPoint(100, 0)); 2026 path.addLineTo(FloatPoint(100, 0));
2012 path.addLineTo(FloatPoint(50, 100)); 2027 path.addLineTo(FloatPoint(50, 100));
2013 path.closeSubpath(); 2028 path.closeSubpath();
2014 2029
2015 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100)); 2030 FakeDisplayItemClient client("test client", LayoutRect(0, 0, 200, 100));
2016 GraphicsContext context(getPaintController()); 2031 GraphicsContext context(getPaintController());
2017 2032
2018 // Run twice for empty/non-empty m_currentPaintArtifact coverage. 2033 // Run twice for empty/non-empty m_currentPaintArtifact coverage.
2019 for (int i = 0; i < 2; ++i) { 2034 for (int i = 0; i < 2; ++i) {
2020 for (int j = 0; j < 50; ++j) 2035 for (int j = 0; j < 50; ++j)
2021 getPaintController().createAndAppend<BeginClipPathDisplayItem>(client, 2036 getPaintController().createAndAppend<BeginClipPathDisplayItem>(client,
2022 path); 2037 path);
2023 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 2038 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100));
2024 for (int j = 0; j < 50; ++j) 2039 for (int j = 0; j < 50; ++j)
2025 getPaintController().createAndAppend<EndClipPathDisplayItem>(client); 2040 getPaintController().createAndAppend<EndClipPathDisplayItem>(client);
2026 getPaintController().commitNewDisplayItems(LayoutSize()); 2041 getPaintController().commitNewDisplayItems(LayoutSize());
2027 EXPECT_FALSE( 2042 EXPECT_FALSE(
2028 getPaintController().paintArtifact().isSuitableForGpuRasterization()); 2043 getPaintController().paintArtifact().isSuitableForGpuRasterization());
2029 } 2044 }
2045 #endif
2030 } 2046 }
2031 2047
2032 // Death tests don't work properly on Android. 2048 // Death tests don't work properly on Android.
2033 #if defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) 2049 #if defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID)
2034 2050
2035 class PaintControllerUnderInvalidationTest : public PaintControllerTestBase { 2051 class PaintControllerUnderInvalidationTest : public PaintControllerTestBase {
2036 protected: 2052 protected:
2037 void SetUp() override { 2053 void SetUp() override {
2038 PaintControllerTestBase::SetUp(); 2054 PaintControllerTestBase::SetUp();
2039 RuntimeEnabledFeatures::setPaintUnderInvalidationCheckingEnabled(true); 2055 RuntimeEnabledFeatures::setPaintUnderInvalidationCheckingEnabled(true);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 } 2343 }
2328 2344
2329 TEST_F(PaintControllerUnderInvalidationTest, 2345 TEST_F(PaintControllerUnderInvalidationTest,
2330 FoldCompositingDrawingInSubsequence) { 2346 FoldCompositingDrawingInSubsequence) {
2331 testFoldCompositingDrawingInSubsequence(); 2347 testFoldCompositingDrawingInSubsequence();
2332 } 2348 }
2333 2349
2334 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) 2350 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID)
2335 2351
2336 } // namespace blink 2352 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698