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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 647343003: Fix crash with fullscreen elements inside frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add assertion Created 6 years, 2 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 | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/fullscreen_iframe.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 5ecb87796e1a2f652ed1ccd84ee0c5881ff0cd26..d90a7bba9292f24d46f7001edecea1ec9ad17e29 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -6149,7 +6149,6 @@ TEST_F(WebFrameTest, FullscreenLayerSize)
webViewImpl->layout();
EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalWidth().toInt());
EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalHeight().toInt());
-
}
TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
@@ -6210,6 +6209,41 @@ TEST_F(WebFrameTest, FullscreenMainFrameScrollable)
ASSERT_TRUE(webScrollLayer->userScrollableVertical());
}
+TEST_F(WebFrameTest, FullscreenSubframe)
+{
+ FakeCompositingWebViewClient client;
+ registerMockedHttpURLLoad("fullscreen_iframe.html");
+ registerMockedHttpURLLoad("fullscreen_div.html");
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_iframe.html", true, 0, &client, configurePinchVirtualViewport);
+ int viewportWidth = 640;
+ int viewportHeight = 480;
+ client.m_screenInfo.rect.width = viewportWidth;
+ client.m_screenInfo.rect.height = viewportHeight;
+ webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
+ webViewImpl->layout();
+
+ Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()->firstChild())->frame()->document();
+ UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
+ Element* divFullscreen = document->getElementById("div1");
+ Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest);
+ webViewImpl->didEnterFullScreen();
+ webViewImpl->layout();
+
+ // Verify that the element is sized to the viewport.
+ RenderFullScreen* fullscreenRenderer = Fullscreen::from(*document).fullScreenRenderer();
+ EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalWidth().toInt());
+ EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalHeight().toInt());
+
+ // Verify it's updated after a device rotation.
+ client.m_screenInfo.rect.width = viewportHeight;
+ client.m_screenInfo.rect.height = viewportWidth;
+ webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
+ webViewImpl->layout();
+ EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalWidth().toInt());
+ EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalHeight().toInt());
+}
+
TEST_F(WebFrameTest, RenderBlockPercentHeightDescendants)
{
registerMockedHttpURLLoad("percent-height-descendants.html");
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/fullscreen_iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698