| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "core/frame/FrameView.h" | 5 #include "core/frame/FrameView.h" |
| 6 #include "core/layout/LayoutTestHelper.h" | 6 #include "core/layout/LayoutTestHelper.h" |
| 7 #include "core/layout/LayoutView.h" | 7 #include "core/layout/LayoutView.h" |
| 8 #include "core/paint/PaintLayer.h" | 8 #include "core/paint/PaintLayer.h" |
| 9 #include "platform/graphics/GraphicsLayer.h" | 9 #include "platform/graphics/GraphicsLayer.h" |
| 10 #include "platform/graphics/paint/RasterInvalidationTracking.h" | 10 #include "platform/graphics/paint/RasterInvalidationTracking.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 TEST_P(PaintInvalidationTest, DelayedFullPaintInvalidation) { | 167 TEST_P(PaintInvalidationTest, DelayedFullPaintInvalidation) { |
| 168 EnableCompositing(); | 168 EnableCompositing(); |
| 169 SetBodyInnerHTML( | 169 SetBodyInnerHTML( |
| 170 "<style>body { margin: 0 }</style>" | 170 "<style>body { margin: 0 }</style>" |
| 171 "<div style='height: 4000px'></div>" | 171 "<div style='height: 4000px'></div>" |
| 172 "<div id='target' style='width: 100px; height: 100px; background: blue'>" | 172 "<div id='target' style='width: 100px; height: 100px; background: blue'>" |
| 173 "</div>"); | 173 "</div>"); |
| 174 | 174 |
| 175 auto* target = GetLayoutObjectByElementId("target"); | 175 auto* target = GetLayoutObjectByElementId("target"); |
| 176 target->SetShouldDoFullPaintInvalidationWithoutGeometryChange( | 176 target->SetShouldDoFullPaintInvalidationWithoutGeometryChange( |
| 177 kPaintInvalidationDelayedFull); | 177 PaintInvalidationReason::kDelayedFull); |
| 178 EXPECT_EQ(kPaintInvalidationDelayedFull, | 178 EXPECT_EQ(PaintInvalidationReason::kDelayedFull, |
| 179 target->FullPaintInvalidationReason()); | 179 target->FullPaintInvalidationReason()); |
| 180 EXPECT_FALSE(target->NeedsPaintOffsetAndVisualRectUpdate()); | 180 EXPECT_FALSE(target->NeedsPaintOffsetAndVisualRectUpdate()); |
| 181 | 181 |
| 182 GetDocument().View()->SetTracksPaintInvalidations(true); | 182 GetDocument().View()->SetTracksPaintInvalidations(true); |
| 183 GetDocument().View()->UpdateAllLifecyclePhases(); | 183 GetDocument().View()->UpdateAllLifecyclePhases(); |
| 184 EXPECT_EQ(nullptr, GetRasterInvalidationTracking()); | 184 EXPECT_EQ(nullptr, GetRasterInvalidationTracking()); |
| 185 EXPECT_EQ(kPaintInvalidationDelayedFull, | 185 EXPECT_EQ(PaintInvalidationReason::kDelayedFull, |
| 186 target->FullPaintInvalidationReason()); | 186 target->FullPaintInvalidationReason()); |
| 187 EXPECT_FALSE(target->NeedsPaintOffsetAndVisualRectUpdate()); | 187 EXPECT_FALSE(target->NeedsPaintOffsetAndVisualRectUpdate()); |
| 188 GetDocument().View()->SetTracksPaintInvalidations(false); | 188 GetDocument().View()->SetTracksPaintInvalidations(false); |
| 189 | 189 |
| 190 GetDocument().View()->SetTracksPaintInvalidations(true); | 190 GetDocument().View()->SetTracksPaintInvalidations(true); |
| 191 // Scroll target into view. | 191 // Scroll target into view. |
| 192 GetDocument().domWindow()->scrollTo(0, 4000); | 192 GetDocument().domWindow()->scrollTo(0, 4000); |
| 193 GetDocument().View()->UpdateAllLifecyclePhases(); | 193 GetDocument().View()->UpdateAllLifecyclePhases(); |
| 194 const auto& raster_invalidations = | 194 const auto& raster_invalidations = |
| 195 GetRasterInvalidationTracking()->invalidations; | 195 GetRasterInvalidationTracking()->invalidations; |
| 196 ASSERT_EQ(1u, raster_invalidations.size()); | 196 ASSERT_EQ(1u, raster_invalidations.size()); |
| 197 EXPECT_EQ(kPaintInvalidationNone, target->FullPaintInvalidationReason()); | 197 EXPECT_EQ(PaintInvalidationReason::kNone, |
| 198 target->FullPaintInvalidationReason()); |
| 198 EXPECT_EQ(IntRect(0, 4000, 100, 100), raster_invalidations[0].rect); | 199 EXPECT_EQ(IntRect(0, 4000, 100, 100), raster_invalidations[0].rect); |
| 199 EXPECT_EQ(kPaintInvalidationFull, raster_invalidations[0].reason); | 200 EXPECT_EQ(PaintInvalidationReason::kFull, raster_invalidations[0].reason); |
| 200 EXPECT_FALSE(target->NeedsPaintOffsetAndVisualRectUpdate()); | 201 EXPECT_FALSE(target->NeedsPaintOffsetAndVisualRectUpdate()); |
| 201 GetDocument().View()->SetTracksPaintInvalidations(false); | 202 GetDocument().View()->SetTracksPaintInvalidations(false); |
| 202 }; | 203 }; |
| 203 | 204 |
| 204 } // namespace | 205 } // namespace |
| 205 | 206 |
| 206 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |