Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index 4e49576834b10337ae437e990eba63c3004b9feb..0329cfb8c9768e93cefe9c88aae2e6320ef1713b 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -68,7 +68,6 @@ |
#include "core/page/EventHandler.h" |
#include "core/page/Page.h" |
#include "core/rendering/HitTestResult.h" |
-#include "core/rendering/RenderFullScreen.h" |
#include "core/rendering/RenderView.h" |
#include "core/rendering/compositing/RenderLayerCompositor.h" |
#include "core/testing/NullExecutionContext.h" |
@@ -6172,6 +6171,39 @@ TEST_F(WebFrameTest, DISABLED_FrameViewScrollAccountsForTopControls) |
EXPECT_POINT_EQ(IntPoint(50, 51), frameView->maximumScrollPosition()); |
} |
+TEST_F(WebFrameTest, FullscreenCleanTopLayerAndFullscreenStack) |
+{ |
+ FakeCompositingWebViewClient client; |
+ registerMockedHttpURLLoad("fullscreen_div.html"); |
+ FrameTestHelpers::WebViewHelper webViewHelper; |
+ int viewportWidth = 640; |
+ int viewportHeight = 480; |
+ client.m_screenInfo.rect.width = viewportWidth; |
+ client.m_screenInfo.rect.height = viewportHeight; |
+ WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_div.html", true, 0, &client, configurePinchVirtualViewport); |
+ webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); |
+ webViewImpl->layout(); |
+ |
+ UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
+ Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); |
+ Fullscreen& fullscreen = Fullscreen::from(*document); |
+ |
+ Element* divFullscreen = document->getElementById("div1"); |
+ fullscreen.requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest); |
+ webViewImpl->didEnterFullScreen(); |
+ ASSERT_TRUE(Fullscreen::isFullScreen(*document)); |
+ |
+ // Sanity check. We should have both in our stack. |
+ ASSERT_EQ(fullscreen.fullScreenElementStack().size(), 1UL); |
+ ASSERT_EQ(document->topLayerElements().size(), 2UL); |
+ |
+ fullscreen.exitFullscreen(); |
+ webViewImpl->didExitFullScreen(); |
+ |
+ ASSERT_EQ(fullscreen.fullScreenElementStack().size(), 0UL); |
+ ASSERT_EQ(document->topLayerElements().size(), 0UL); |
+} |
+ |
TEST_F(WebFrameTest, FullscreenLayerSize) |
{ |
FakeCompositingWebViewClient client; |
@@ -6194,7 +6226,8 @@ TEST_F(WebFrameTest, FullscreenLayerSize) |
ASSERT_TRUE(Fullscreen::isFullScreen(*document)); |
// Verify that the element is sized to the viewport. |
- RenderFullScreen* fullscreenRenderer = Fullscreen::from(*document).fullScreenRenderer(); |
+ Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*document); |
+ RenderBox* fullscreenRenderer = toRenderBox(fullscreenElement->renderer()); |
EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalWidth().toInt()); |
EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalHeight().toInt()); |
@@ -6293,7 +6326,8 @@ TEST_F(WebFrameTest, FullscreenSubframe) |
webViewImpl->layout(); |
// Verify that the element is sized to the viewport. |
- RenderFullScreen* fullscreenRenderer = Fullscreen::from(*document).fullScreenRenderer(); |
+ Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*document); |
+ RenderBox* fullscreenRenderer = toRenderBox(fullscreenElement->renderer()); |
EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalWidth().toInt()); |
EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalHeight().toInt()); |