| 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 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 FloatRect(100, 100, 300, 300)); | 2106 FloatRect(100, 100, 300, 300)); |
| 2107 DrawRect(context, first, kForegroundDrawingType, | 2107 DrawRect(context, first, kForegroundDrawingType, |
| 2108 FloatRect(100, 100, 300, 300)); | 2108 FloatRect(100, 100, 300, 300)); |
| 2109 GetPaintController().CommitNewDisplayItems(); | 2109 GetPaintController().CommitNewDisplayItems(); |
| 2110 DrawRect(context, first, kBackgroundDrawingType, | 2110 DrawRect(context, first, kBackgroundDrawingType, |
| 2111 FloatRect(100, 100, 300, 300)); | 2111 FloatRect(100, 100, 300, 300)); |
| 2112 GetPaintController().CommitNewDisplayItems(); | 2112 GetPaintController().CommitNewDisplayItems(); |
| 2113 } | 2113 } |
| 2114 | 2114 |
| 2115 void TestNoopPairsInSubsequence() { | 2115 void TestNoopPairsInSubsequence() { |
| 2116 EXPECT_FALSE(GetPaintController().LastDisplayItemIsSubsequenceEnd()); |
| 2117 |
| 2116 FakeDisplayItemClient container("container"); | 2118 FakeDisplayItemClient container("container"); |
| 2117 GraphicsContext context(GetPaintController()); | 2119 GraphicsContext context(GetPaintController()); |
| 2118 | 2120 |
| 2119 { | 2121 { |
| 2120 SubsequenceRecorder r(context, container); | 2122 SubsequenceRecorder r(context, container); |
| 2121 DrawRect(context, container, kBackgroundDrawingType, | 2123 DrawRect(context, container, kBackgroundDrawingType, |
| 2122 FloatRect(100, 100, 100, 100)); | 2124 FloatRect(100, 100, 100, 100)); |
| 2123 } | 2125 } |
| 2124 GetPaintController().CommitNewDisplayItems(); | 2126 GetPaintController().CommitNewDisplayItems(); |
| 2125 | 2127 |
| 2126 EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( | 2128 EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( |
| 2127 context, container)); | 2129 context, container)); |
| 2128 { | 2130 { |
| 2129 // Generate some no-op pairs which should not affect under-invalidation | 2131 // Generate some no-op pairs which should not affect under-invalidation |
| 2130 // checking. | 2132 // checking. |
| 2131 ClipRecorder r1(context, container, kClipType, IntRect(1, 1, 9, 9)); | 2133 ClipRecorder r1(context, container, kClipType, IntRect(1, 1, 9, 9)); |
| 2132 ClipRecorder r2(context, container, kClipType, IntRect(1, 1, 2, 2)); | 2134 ClipRecorder r2(context, container, kClipType, IntRect(1, 1, 2, 2)); |
| 2133 ClipRecorder r3(context, container, kClipType, IntRect(1, 1, 3, 3)); | 2135 ClipRecorder r3(context, container, kClipType, IntRect(1, 1, 3, 3)); |
| 2134 ClipPathRecorder r4(context, container, Path()); | 2136 ClipPathRecorder r4(context, container, Path()); |
| 2135 } | 2137 } |
| 2136 { | 2138 { |
| 2137 EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( | 2139 EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( |
| 2138 context, container)); | 2140 context, container)); |
| 2139 SubsequenceRecorder r(context, container); | 2141 SubsequenceRecorder r(context, container); |
| 2140 DrawRect(context, container, kBackgroundDrawingType, | 2142 DrawRect(context, container, kBackgroundDrawingType, |
| 2141 FloatRect(100, 100, 100, 100)); | 2143 FloatRect(100, 100, 100, 100)); |
| 2142 } | 2144 } |
| 2145 EXPECT_TRUE(GetPaintController().LastDisplayItemIsSubsequenceEnd()); |
| 2146 |
| 2143 GetPaintController().CommitNewDisplayItems(); | 2147 GetPaintController().CommitNewDisplayItems(); |
| 2144 | 2148 |
| 2145 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 2149 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 2146 DisplayItemClient::EndShouldKeepAliveAllClients(); | 2150 DisplayItemClient::EndShouldKeepAliveAllClients(); |
| 2147 #endif | 2151 #endif |
| 2148 } | 2152 } |
| 2149 | 2153 |
| 2150 void TestChangeDrawingInSubsequence() { | 2154 void TestChangeDrawingInSubsequence() { |
| 2151 FakeDisplayItemClient first("first"); | 2155 FakeDisplayItemClient first("first"); |
| 2152 GraphicsContext context(GetPaintController()); | 2156 GraphicsContext context(GetPaintController()); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2360 } | 2364 } |
| 2361 | 2365 |
| 2362 TEST_F(PaintControllerUnderInvalidationTest, | 2366 TEST_F(PaintControllerUnderInvalidationTest, |
| 2363 FoldCompositingDrawingInSubsequence) { | 2367 FoldCompositingDrawingInSubsequence) { |
| 2364 TestFoldCompositingDrawingInSubsequence(); | 2368 TestFoldCompositingDrawingInSubsequence(); |
| 2365 } | 2369 } |
| 2366 | 2370 |
| 2367 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) | 2371 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
| 2368 | 2372 |
| 2369 } // namespace blink | 2373 } // namespace blink |
| OLD | NEW |