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/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 &invalidationTracking->trackedRasterInvalidations; | 2449 &invalidationTracking->trackedRasterInvalidations; |
2450 ASSERT_EQ(1u, rasterInvalidations->size()); | 2450 ASSERT_EQ(1u, rasterInvalidations->size()); |
2451 EXPECT_EQ(IntRect(0, 0, pageWidth, largestHeight), | 2451 EXPECT_EQ(IntRect(0, 0, pageWidth, largestHeight), |
2452 (*rasterInvalidations)[0].rect); | 2452 (*rasterInvalidations)[0].rect); |
2453 } | 2453 } |
2454 | 2454 |
2455 document->view()->setTracksPaintInvalidations(false); | 2455 document->view()->setTracksPaintInvalidations(false); |
2456 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); | 2456 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); |
2457 } | 2457 } |
2458 | 2458 |
| 2459 // Make sure we don't crash when the visual viewport's height is 0. This can |
| 2460 // happen transiently in autoresize mode and cause a crash. This test passes if |
| 2461 // it doesn't crash. |
| 2462 TEST_P(VisualViewportTest, AutoResizeNoHeightUsesMinimumHeight) { |
| 2463 initializeWithDesktopSettings(); |
| 2464 webViewImpl()->resizeWithBrowserControls(WebSize(0, 0), 0, false); |
| 2465 webViewImpl()->enableAutoResizeMode(WebSize(25, 25), WebSize(100, 100)); |
| 2466 WebURL baseURL = URLTestHelpers::toKURL("http://example.com/"); |
| 2467 FrameTestHelpers::loadHTMLString(webViewImpl()->mainFrame(), |
| 2468 "<!DOCTYPE html>" |
| 2469 "<style>" |
| 2470 " body {" |
| 2471 " margin: 0px;" |
| 2472 " }" |
| 2473 " div { height:110vh; width: 110vw; }" |
| 2474 "</style>" |
| 2475 "<div></div>", |
| 2476 baseURL); |
| 2477 } |
| 2478 |
2459 } // namespace | 2479 } // namespace |
OLD | NEW |