Commit 72018aa9 authored by aelias@chromium.org's avatar aelias@chromium.org

Disable scrolling for fullscreen elements by changing scroll layer size.

After https://codereview.chromium.org/476113004 CC depends on the
tree structure of scroll/clip layers to determine the viewport size, so
detaching them breaks fullscreen mode.  Switch to the other
approach of changing the scroll layer bounds.

BUG=410452

Review URL: https://codereview.chromium.org/558813003

git-svn-id: svn://svn.chromium.org/blink/trunk@181926 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent dd449375
......@@ -158,14 +158,13 @@ void ScrollingCoordinator::updateAfterCompositingChangeIfNeeded()
// The mainFrame view doesn't get included in the FrameTree below, so we
// update its size separately.
if (WebLayer* scrollingWebLayer = frameView ? toWebLayer(frameView->layerForScrolling()) : 0) {
scrollingWebLayer->setBounds(frameView->contentsSize());
// If there is a fullscreen element, set the scroll clip layer to 0 so main frame won't scroll.
// If there is a fullscreen element, set the scroll bounds to empty so the main frame won't scroll.
Document* mainFrameDocument = m_page->deprecatedLocalMainFrame()->document();
Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*mainFrameDocument);
if (fullscreenElement && fullscreenElement != mainFrameDocument->documentElement())
scrollingWebLayer->setScrollClipLayer(0);
scrollingWebLayer->setBounds(IntSize());
else
scrollingWebLayer->setScrollClipLayer(toWebLayer(frameView->layerForContainer()));
scrollingWebLayer->setBounds(frameView->contentsSize());
}
const FrameTree& tree = m_page->mainFrame()->tree();
......
......@@ -5748,17 +5748,17 @@ TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
webViewImpl->didEnterFullScreen();
webViewImpl->layout();
// Verify that the main frame is not scrollable.
// Verify that the main frame bounds are empty.
ASSERT_TRUE(Fullscreen::isFullScreen(*document));
WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platformLayer();
ASSERT_FALSE(webScrollLayer->scrollable());
ASSERT_EQ(WebSize(), webScrollLayer->bounds());
// Verify that the main frame is scrollable upon exiting fullscreen.
webViewImpl->didExitFullScreen();
webViewImpl->layout();
ASSERT_FALSE(Fullscreen::isFullScreen(*document));
webScrollLayer = webViewImpl->compositor()->scrollLayer()->platformLayer();
ASSERT_TRUE(webScrollLayer->scrollable());
ASSERT_NE(WebSize(), webScrollLayer->bounds());
}
TEST_F(WebFrameTest, FullscreenMainFrameScrollable)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment