| Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| index a7f8e65fea310bcb907693b82ea68472ce516063..19a54e3b8cc8bfdfe3543abb8a51958e2fec86e3 100644
|
| --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
|
| @@ -65,7 +65,6 @@
|
| #include "core/html/ImageDocument.h"
|
| #include "core/input/EventHandler.h"
|
| #include "core/layout/HitTestResult.h"
|
| -#include "core/layout/LayoutFullScreen.h"
|
| #include "core/layout/api/LayoutViewItem.h"
|
| #include "core/layout/compositing/PaintLayerCompositor.h"
|
| #include "core/loader/DocumentLoader.h"
|
| @@ -7473,6 +7472,36 @@ TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) {
|
| EXPECT_LT(frameView->maximumScrollOffset().width(), 0);
|
| }
|
|
|
| +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, nullptr, configureAndroid);
|
| + webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
|
| + webViewImpl->updateAllLifecyclePhases();
|
| +
|
| + Document* document = webViewImpl->mainFrameImpl()->frame()->document();
|
| + UserGestureIndicator gesture(DocumentUserGestureToken::create(document));
|
| + Element* divFullscreen = document->getElementById("div1");
|
| + Fullscreen::requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest);
|
| + webViewImpl->didEnterFullscreen();
|
| + ASSERT_EQ(Fullscreen::fullscreenElement(*document), divFullscreen);
|
| +
|
| + // Sanity check. We should have both in our stack.
|
| + ASSERT_EQ(document->topLayerElements().size(), 2UL);
|
| +
|
| + Fullscreen::exitFullscreen(*document);
|
| + webViewImpl->didExitFullscreen();
|
| +
|
| + ASSERT_EQ(document->topLayerElements().size(), 0UL);
|
| +}
|
| +
|
| TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) {
|
| FakeCompositingWebViewClient client;
|
| registerMockedHttpURLLoad("fullscreen_div.html");
|
| @@ -7493,11 +7522,12 @@ TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) {
|
| Fullscreen::requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest);
|
| webViewImpl->didEnterFullscreen();
|
| webViewImpl->updateAllLifecyclePhases();
|
| - EXPECT_EQ(Fullscreen::currentFullScreenElementFrom(*document), divFullscreen);
|
| + EXPECT_EQ(Fullscreen::fullscreenElement(*document), divFullscreen);
|
|
|
| // Verify that the element is sized to the viewport.
|
| - LayoutFullScreen* fullscreenLayoutObject =
|
| - Fullscreen::from(*document).fullScreenLayoutObject();
|
| + Element* fullscreenElement = Fullscreen::fullscreenElement(*document);
|
| + LayoutBox* fullscreenLayoutObject =
|
| + toLayoutBox(fullscreenElement->layoutObject());
|
| EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
|
| EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
|
|
|
| @@ -7530,7 +7560,7 @@ TEST_F(WebFrameTest, FullscreenLayerNonScrollable) {
|
| webViewImpl->updateAllLifecyclePhases();
|
|
|
| // Verify that the viewports are nonscrollable.
|
| - EXPECT_EQ(Fullscreen::currentFullScreenElementFrom(*document), divFullscreen);
|
| + EXPECT_EQ(Fullscreen::fullscreenElement(*document), divFullscreen);
|
| FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView();
|
| WebLayer* layoutViewportScrollLayer =
|
| webViewImpl->compositor()->scrollLayer()->platformLayer();
|
| @@ -7547,7 +7577,7 @@ TEST_F(WebFrameTest, FullscreenLayerNonScrollable) {
|
| // Verify that the viewports are scrollable upon exiting fullscreen.
|
| webViewImpl->didExitFullscreen();
|
| webViewImpl->updateAllLifecyclePhases();
|
| - EXPECT_EQ(Fullscreen::currentFullScreenElementFrom(*document), nullptr);
|
| + EXPECT_EQ(Fullscreen::fullscreenElement(*document), nullptr);
|
| ASSERT_TRUE(layoutViewportScrollLayer->userScrollableHorizontal());
|
| ASSERT_TRUE(layoutViewportScrollLayer->userScrollableVertical());
|
| ASSERT_TRUE(visualViewportScrollLayer->userScrollableHorizontal());
|
| @@ -7574,7 +7604,7 @@ TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) {
|
| webViewImpl->updateAllLifecyclePhases();
|
|
|
| // Verify that the main frame is still scrollable.
|
| - EXPECT_EQ(Fullscreen::currentFullScreenElementFrom(*document),
|
| + EXPECT_EQ(Fullscreen::fullscreenElement(*document),
|
| document->documentElement());
|
| WebLayer* webScrollLayer =
|
| webViewImpl->compositor()->scrollLayer()->platformLayer();
|
| @@ -7615,8 +7645,9 @@ TEST_P(ParameterizedWebFrameTest, FullscreenSubframe) {
|
| webViewImpl->updateAllLifecyclePhases();
|
|
|
| // Verify that the element is sized to the viewport.
|
| - LayoutFullScreen* fullscreenLayoutObject =
|
| - Fullscreen::from(*document).fullScreenLayoutObject();
|
| + Element* fullscreenElement = Fullscreen::fullscreenElement(*document);
|
| + LayoutBox* fullscreenLayoutObject =
|
| + toLayoutBox(fullscreenElement->layoutObject());
|
| EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
|
| EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
|
|
|
|
|