| 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 "core/frame/VisualViewport.h" | 5 #include "core/frame/VisualViewport.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/BrowserControls.h" | 8 #include "core/frame/BrowserControls.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 ASSERT_EQ(smallest_height, document->View()->GetLayoutSize().Height()); | 2248 ASSERT_EQ(smallest_height, document->View()->GetLayoutSize().Height()); |
| 2249 | 2249 |
| 2250 const RasterInvalidationTracking* invalidation_tracking = | 2250 const RasterInvalidationTracking* invalidation_tracking = |
| 2251 document->GetLayoutView() | 2251 document->GetLayoutView() |
| 2252 ->Layer() | 2252 ->Layer() |
| 2253 ->GraphicsLayerBacking(document->GetLayoutView()) | 2253 ->GraphicsLayerBacking(document->GetLayoutView()) |
| 2254 ->GetRasterInvalidationTracking(); | 2254 ->GetRasterInvalidationTracking(); |
| 2255 // If no invalidations occured, this will be a nullptr. | 2255 // If no invalidations occured, this will be a nullptr. |
| 2256 ASSERT_TRUE(invalidation_tracking); | 2256 ASSERT_TRUE(invalidation_tracking); |
| 2257 | 2257 |
| 2258 const auto* raster_invalidations = | 2258 const auto* raster_invalidations = &invalidation_tracking->invalidations; |
| 2259 &invalidation_tracking->tracked_raster_invalidations; | |
| 2260 | 2259 |
| 2261 bool root_layer_scrolling = GetParam(); | 2260 bool root_layer_scrolling = GetParam(); |
| 2262 | 2261 |
| 2263 // Without root-layer-scrolling, the LayoutView is the size of the document | 2262 // Without root-layer-scrolling, the LayoutView is the size of the document |
| 2264 // content so invalidating it for background-attachment: fixed | 2263 // content so invalidating it for background-attachment: fixed |
| 2265 // overinvalidates as we should only need to invalidate the viewport size. | 2264 // overinvalidates as we should only need to invalidate the viewport size. |
| 2266 // With root-layer-scrolling, we should invalidate the entire viewport height. | 2265 // With root-layer-scrolling, we should invalidate the entire viewport height. |
| 2267 int expectedHeight = root_layer_scrolling ? page_height : 1000; | 2266 int expectedHeight = root_layer_scrolling ? page_height : 1000; |
| 2268 | 2267 |
| 2269 // The entire viewport should have been invalidated. | 2268 // The entire viewport should have been invalidated. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2280 | 2279 |
| 2281 document->View()->SetTracksPaintInvalidations(true); | 2280 document->View()->SetTracksPaintInvalidations(true); |
| 2282 web_view_impl->ResizeWithBrowserControls(WebSize(page_width, page_height), | 2281 web_view_impl->ResizeWithBrowserControls(WebSize(page_width, page_height), |
| 2283 browser_controls_height, true); | 2282 browser_controls_height, true); |
| 2284 | 2283 |
| 2285 invalidation_tracking = document->GetLayoutView() | 2284 invalidation_tracking = document->GetLayoutView() |
| 2286 ->Layer() | 2285 ->Layer() |
| 2287 ->GraphicsLayerBacking(document->GetLayoutView()) | 2286 ->GraphicsLayerBacking(document->GetLayoutView()) |
| 2288 ->GetRasterInvalidationTracking(); | 2287 ->GetRasterInvalidationTracking(); |
| 2289 ASSERT_TRUE(invalidation_tracking); | 2288 ASSERT_TRUE(invalidation_tracking); |
| 2290 raster_invalidations = &invalidation_tracking->tracked_raster_invalidations; | 2289 raster_invalidations = &invalidation_tracking->invalidations; |
| 2291 | 2290 |
| 2292 // Once again, the entire page should have been invalidated. | 2291 // Once again, the entire page should have been invalidated. |
| 2293 expectedHeight = root_layer_scrolling ? 480 : 1000; | 2292 expectedHeight = root_layer_scrolling ? 480 : 1000; |
| 2294 EXPECT_EQ(1u, raster_invalidations->size()); | 2293 EXPECT_EQ(1u, raster_invalidations->size()); |
| 2295 EXPECT_EQ(IntRect(0, 0, 640, expectedHeight), | 2294 EXPECT_EQ(IntRect(0, 0, 640, expectedHeight), |
| 2296 (*raster_invalidations)[0].rect); | 2295 (*raster_invalidations)[0].rect); |
| 2297 | 2296 |
| 2298 document->View()->SetTracksPaintInvalidations(false); | 2297 document->View()->SetTracksPaintInvalidations(false); |
| 2299 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); | 2298 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); |
| 2300 } | 2299 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2422 ASSERT_EQ(page_height, document->View()->GetLayoutSize().Height()); | 2421 ASSERT_EQ(page_height, document->View()->GetLayoutSize().Height()); |
| 2423 | 2422 |
| 2424 // The entire viewport should have been invalidated. | 2423 // The entire viewport should have been invalidated. |
| 2425 { | 2424 { |
| 2426 const RasterInvalidationTracking* invalidation_tracking = | 2425 const RasterInvalidationTracking* invalidation_tracking = |
| 2427 document->GetLayoutView() | 2426 document->GetLayoutView() |
| 2428 ->Layer() | 2427 ->Layer() |
| 2429 ->GraphicsLayerBacking() | 2428 ->GraphicsLayerBacking() |
| 2430 ->GetRasterInvalidationTracking(); | 2429 ->GetRasterInvalidationTracking(); |
| 2431 ASSERT_TRUE(invalidation_tracking); | 2430 ASSERT_TRUE(invalidation_tracking); |
| 2432 const auto* raster_invalidations = | 2431 const auto* raster_invalidations = &invalidation_tracking->invalidations; |
| 2433 &invalidation_tracking->tracked_raster_invalidations; | |
| 2434 ASSERT_EQ(1u, raster_invalidations->size()); | 2432 ASSERT_EQ(1u, raster_invalidations->size()); |
| 2435 EXPECT_EQ(IntRect(0, 0, page_width, largest_height), | 2433 EXPECT_EQ(IntRect(0, 0, page_width, largest_height), |
| 2436 (*raster_invalidations)[0].rect); | 2434 (*raster_invalidations)[0].rect); |
| 2437 } | 2435 } |
| 2438 | 2436 |
| 2439 document->View()->SetTracksPaintInvalidations(false); | 2437 document->View()->SetTracksPaintInvalidations(false); |
| 2440 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); | 2438 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); |
| 2441 } | 2439 } |
| 2442 | 2440 |
| 2443 // Make sure we don't crash when the visual viewport's height is 0. This can | 2441 // Make sure we don't crash when the visual viewport's height is 0. This can |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2455 " margin: 0px;" | 2453 " margin: 0px;" |
| 2456 " }" | 2454 " }" |
| 2457 " div { height:110vh; width: 110vw; }" | 2455 " div { height:110vh; width: 110vw; }" |
| 2458 "</style>" | 2456 "</style>" |
| 2459 "<div></div>", | 2457 "<div></div>", |
| 2460 base_url); | 2458 base_url); |
| 2461 } | 2459 } |
| 2462 | 2460 |
| 2463 } // namespace | 2461 } // namespace |
| 2464 } // namespace blink | 2462 } // namespace blink |
| OLD | NEW |