Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1266)

Unified Diff: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp

Issue 2616893004: Fix crash with viewport units when using auto resize mode. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
index 626598fb95e5e0cb6b0b88439bc6dcd5c084b9de..75484716c77f289197f6cc2da31ba8c2eeefb1a8 100644
--- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -2456,4 +2456,24 @@ TEST_P(VisualViewportTest, InvalidateLayoutViewWhenDocumentSmallerThanView) {
RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls);
}
+// Make sure we don't crash when the visual viewport's height is 0. This can
+// happen transiently in autoresize mode and cause a crash. This test passes if
+// it doesn't crash.
+TEST_P(VisualViewportTest, AutoResizeNoHeightUsesMinimumHeight) {
+ initializeWithDesktopSettings();
+ webViewImpl()->resizeWithBrowserControls(WebSize(0, 0), 0, false);
+ webViewImpl()->enableAutoResizeMode(WebSize(25, 25), WebSize(100, 100));
+ WebURL baseURL = URLTestHelpers::toKURL("http://example.com/");
+ FrameTestHelpers::loadHTMLString(webViewImpl()->mainFrame(),
+ "<!DOCTYPE html>"
+ "<style>"
+ " body {"
+ " margin: 0px;"
+ " }"
+ " div { height:110vh; width: 110vw; }"
+ "</style>"
+ "<div></div>",
+ baseURL);
+}
+
} // namespace
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698