| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/HTMLNames.h" | 5 #include "core/HTMLNames.h" |
| 6 #include "core/frame/FrameView.h" | 6 #include "core/frame/FrameView.h" |
| 7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/paint/PaintLayer.h" | 9 #include "core/paint/PaintLayer.h" |
| 10 #include "platform/graphics/GraphicsLayer.h" | 10 #include "platform/graphics/GraphicsLayer.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 EXPECT_EQ(IntRect(0, 0, 70, 140), (*rasterInvalidations)[1].rect); | 118 EXPECT_EQ(IntRect(0, 0, 70, 140), (*rasterInvalidations)[1].rect); |
| 119 EXPECT_EQ(PaintInvalidationBorderBoxChange, (*rasterInvalidations)[1].reason); | 119 EXPECT_EQ(PaintInvalidationBorderBoxChange, (*rasterInvalidations)[1].reason); |
| 120 document().view()->setTracksPaintInvalidations(false); | 120 document().view()->setTracksPaintInvalidations(false); |
| 121 } | 121 } |
| 122 | 122 |
| 123 TEST_F(BoxPaintInvalidatorTest, SubpixelChangeWithoutVisualRectChange) { | 123 TEST_F(BoxPaintInvalidatorTest, SubpixelChangeWithoutVisualRectChange) { |
| 124 ScopedSlimmingPaintInvalidationForTest scopedSlimmingPaintInvalidation(true); | 124 ScopedSlimmingPaintInvalidationForTest scopedSlimmingPaintInvalidation(true); |
| 125 | 125 |
| 126 Element* target = document().getElementById("target"); | 126 Element* target = document().getElementById("target"); |
| 127 LayoutObject* targetObject = target->layoutObject(); | 127 LayoutObject* targetObject = target->layoutObject(); |
| 128 EXPECT_EQ(LayoutRect(0, 0, 70, 140), | 128 EXPECT_EQ(LayoutRect(0, 0, 70, 140), targetObject->previousVisualRect()); |
| 129 targetObject->previousPaintInvalidationRect()); | |
| 130 | 129 |
| 131 // Should do full invalidation if new geometry has subpixels even if the paint | 130 // Should do full invalidation if new geometry has subpixels even if the paint |
| 132 // invalidation rect doesn't change. | 131 // invalidation rect doesn't change. |
| 133 document().view()->setTracksPaintInvalidations(true); | 132 document().view()->setTracksPaintInvalidations(true); |
| 134 target->setAttribute(HTMLNames::styleAttr, | 133 target->setAttribute(HTMLNames::styleAttr, |
| 135 "margin-top: 0.6px; width: 50px; height: 99.3px"); | 134 "margin-top: 0.6px; width: 50px; height: 99.3px"); |
| 136 document().view()->updateAllLifecyclePhases(); | 135 document().view()->updateAllLifecyclePhases(); |
| 137 EXPECT_EQ(LayoutRect(0, 0, 70, 140), | 136 EXPECT_EQ(LayoutRect(0, 0, 70, 140), targetObject->previousVisualRect()); |
| 138 targetObject->previousPaintInvalidationRect()); | |
| 139 const auto* rasterInvalidations = | 137 const auto* rasterInvalidations = |
| 140 &getRasterInvalidationTracking()->trackedRasterInvalidations; | 138 &getRasterInvalidationTracking()->trackedRasterInvalidations; |
| 141 EXPECT_EQ(1u, rasterInvalidations->size()); | 139 EXPECT_EQ(1u, rasterInvalidations->size()); |
| 142 EXPECT_EQ(IntRect(0, 0, 70, 140), (*rasterInvalidations)[0].rect); | 140 EXPECT_EQ(IntRect(0, 0, 70, 140), (*rasterInvalidations)[0].rect); |
| 143 EXPECT_EQ(PaintInvalidationLocationChange, (*rasterInvalidations)[0].reason); | 141 EXPECT_EQ(PaintInvalidationLocationChange, (*rasterInvalidations)[0].reason); |
| 144 document().view()->setTracksPaintInvalidations(false); | 142 document().view()->setTracksPaintInvalidations(false); |
| 145 | 143 |
| 146 document().view()->setTracksPaintInvalidations(true); | 144 document().view()->setTracksPaintInvalidations(true); |
| 147 target->setAttribute(HTMLNames::styleAttr, | 145 target->setAttribute(HTMLNames::styleAttr, |
| 148 "margin-top: 0.6px; width: 49.3px; height: 98.5px"); | 146 "margin-top: 0.6px; width: 49.3px; height: 98.5px"); |
| 149 document().view()->updateAllLifecyclePhases(); | 147 document().view()->updateAllLifecyclePhases(); |
| 150 EXPECT_EQ(LayoutRect(0, 0, 70, 140), | 148 EXPECT_EQ(LayoutRect(0, 0, 70, 140), targetObject->previousVisualRect()); |
| 151 targetObject->previousPaintInvalidationRect()); | |
| 152 rasterInvalidations = | 149 rasterInvalidations = |
| 153 &getRasterInvalidationTracking()->trackedRasterInvalidations; | 150 &getRasterInvalidationTracking()->trackedRasterInvalidations; |
| 154 EXPECT_EQ(1u, rasterInvalidations->size()); | 151 EXPECT_EQ(1u, rasterInvalidations->size()); |
| 155 EXPECT_EQ(IntRect(0, 0, 70, 140), (*rasterInvalidations)[0].rect); | 152 EXPECT_EQ(IntRect(0, 0, 70, 140), (*rasterInvalidations)[0].rect); |
| 156 EXPECT_EQ(PaintInvalidationBorderBoxChange, (*rasterInvalidations)[0].reason); | 153 EXPECT_EQ(PaintInvalidationBorderBoxChange, (*rasterInvalidations)[0].reason); |
| 157 document().view()->setTracksPaintInvalidations(false); | 154 document().view()->setTracksPaintInvalidations(false); |
| 158 } | 155 } |
| 159 | 156 |
| 160 TEST_F(BoxPaintInvalidatorTest, ResizeRotated) { | 157 TEST_F(BoxPaintInvalidatorTest, ResizeRotated) { |
| 161 ScopedSlimmingPaintInvalidationForTest scopedSlimmingPaintInvalidation(true); | 158 ScopedSlimmingPaintInvalidationForTest scopedSlimmingPaintInvalidation(true); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 document().view()->updateAllLifecyclePhases(); | 193 document().view()->updateAllLifecyclePhases(); |
| 197 const auto* rasterInvalidations = | 194 const auto* rasterInvalidations = |
| 198 &getRasterInvalidationTracking()->trackedRasterInvalidations; | 195 &getRasterInvalidationTracking()->trackedRasterInvalidations; |
| 199 EXPECT_EQ(1u, rasterInvalidations->size()); | 196 EXPECT_EQ(1u, rasterInvalidations->size()); |
| 200 EXPECT_EQ(IntRect(-43, 21, 107, 107), (*rasterInvalidations)[0].rect); | 197 EXPECT_EQ(IntRect(-43, 21, 107, 107), (*rasterInvalidations)[0].rect); |
| 201 EXPECT_EQ(PaintInvalidationBorderBoxChange, (*rasterInvalidations)[0].reason); | 198 EXPECT_EQ(PaintInvalidationBorderBoxChange, (*rasterInvalidations)[0].reason); |
| 202 document().view()->setTracksPaintInvalidations(false); | 199 document().view()->setTracksPaintInvalidations(false); |
| 203 } | 200 } |
| 204 | 201 |
| 205 } // namespace blink | 202 } // namespace blink |
| OLD | NEW |