Commit cd6bd64a authored by trchen@chromium.org's avatar trchen@chromium.org

Main frame should remain scrollable if the fullscreen element is the document

In a previous CL we disabled main frame impl-side scrolling if there is a
fullscreen element because the fullscreen element can balloon up scroll events
to the (invisible) main frame layer and cause weird artifacts.

However if the element that enter fullscreen is the main frame document itself,
we should allow it remain scrollable.

BUG=376699

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175089 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c88d0405
......@@ -159,8 +159,9 @@ void ScrollingCoordinator::updateAfterCompositingChange()
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.
Element* fullscreenElement = FullscreenElementStack::fullscreenElementFrom(*(m_page->mainFrame()->document()));
if (fullscreenElement)
Document* mainFrameDocument = m_page->mainFrame()->document();
Element* fullscreenElement = FullscreenElementStack::fullscreenElementFrom(*mainFrameDocument);
if (fullscreenElement && fullscreenElement != mainFrameDocument->documentElement())
scrollingWebLayer->setScrollClipLayer(0);
else
scrollingWebLayer->setScrollClipLayer(toWebLayer(frameView->layerForContainer()));
......
......@@ -5351,6 +5351,30 @@ TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
ASSERT_TRUE(webScrollLayer->scrollable());
}
TEST_F(WebFrameTest, FullscreenMainFrameScrollable)
{
FakeCompositingWebViewClient client;
registerMockedHttpURLLoad("fullscreen_div.html");
FrameTestHelpers::WebViewHelper webViewHelper;
int viewportWidth = 640;
int viewportHeight = 480;
WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_div.html", true, 0, &client, &configueCompositingWebView);
webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
webViewImpl->layout();
Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document();
WebCore::UserGestureIndicator gesture(WebCore::DefinitelyProcessingUserGesture);
document->documentElement()->webkitRequestFullscreen();
webViewImpl->willEnterFullScreen();
webViewImpl->didEnterFullScreen();
webViewImpl->layout();
// Verify that the main frame is still scrollable.
ASSERT_TRUE(WebCore::FullscreenElementStack::isFullScreen(*document));
WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platformLayer();
ASSERT_TRUE(webScrollLayer->scrollable());
}
TEST_F(WebFrameTest, RenderBlockPercentHeightDescendants)
{
registerMockedHttpURLLoad("percent-height-descendants.html");
......
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