New issue
Advanced search Search tips

Issue 625683 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Fullscreen scroll restoration applied before removing fullscreen styles

Project Member Reported by bokan@chromium.org, Jul 4 2016

Issue description

Version: 53.0.2783.2
OS: Linux (but likely reproduces on all)

What steps will reproduce the problem?
(1) Open a video on youtube.com
(2) Scroll down a bit and fullscreen the video
(3) Exit fullscreen

What is the expected output?
The page should exit fullscreen at the same scroll location as it was entered

What do you see instead?
The scroll offset is reset to the top of the page

Looks to me like Youtube applies a display: none style to the page content while the player is in fullscreen. It does so using this CSS selcetor:

body:-webkit-full-screen-ancestor>:not(:-webkit-full-screen-ancestor):not(:-webkit-full-screen), body :-webkit-full-screen-ancestor>:not(:-webkit-full-screen-ancestor):not(:-webkit-full-screen) {
  display: none!important
}

Disabling this on the #content element fixes the issue. Adding a synchronous updateAllLifecyclePhases between exiting fullscreen and restoring scroll also helps. Seems like the solution here is to move the scroll restoration to happen after the first layout/style update on exiting fullscreen.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jul 15 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d3fb3a358ce9c85bfd7bcda882a23179ac064775

commit d3fb3a358ce9c85bfd7bcda882a23179ac064775
Author: bokan <bokan@chromium.org>
Date: Fri Jul 15 20:54:04 2016

Wait until after layout when restoring scroll on exiting fullscreen.

Many pages can change while in fullscreen. For example, youtube applies
display:none to elements not in the fullscreen ancestor chain using CSS
selectors. This means that until we update style and layout, the page will not
be scrollable to the same extent (or at all) as it was when we entered
fullscreen.

The solution is to take note when we exit fullscreen and try to restore the
scale and scroll once the first layout after exiting fullscreen is completed.
This ensures the page is completely back to it's pre-fullscreen state.

BUG= 625683 

Review-Url: https://codereview.chromium.org/2122013003
Cr-Commit-Position: refs/heads/master@{#405854}

[modify] https://crrev.com/d3fb3a358ce9c85bfd7bcda882a23179ac064775/third_party/WebKit/Source/web/FullscreenController.cpp
[modify] https://crrev.com/d3fb3a358ce9c85bfd7bcda882a23179ac064775/third_party/WebKit/Source/web/FullscreenController.h
[modify] https://crrev.com/d3fb3a358ce9c85bfd7bcda882a23179ac064775/third_party/WebKit/Source/web/WebViewImpl.cpp
[modify] https://crrev.com/d3fb3a358ce9c85bfd7bcda882a23179ac064775/third_party/WebKit/Source/web/tests/WebViewTest.cpp
[add] https://crrev.com/d3fb3a358ce9c85bfd7bcda882a23179ac064775/third_party/WebKit/Source/web/tests/data/fullscreen_style.html

Comment 2 by bokan@chromium.org, Jul 18 2016

Status: Fixed (was: Assigned)

Sign in to add a comment