Chromium Code Reviews
DescriptionFix scroll restoration when exiting fullscreen mode.
There's two problems in Chrome/Blink that cause the existing scroll restoration
not to work on desktop platforms:
In Blink, when entering fullscreen mode, FullscreenController saves the current
scroll offset so that it can restore it later. However, this was done in
FullscreenController::didEnterFullScreen, which is called only after WebViewImpl
is resized, meaning that the scroll offset may already be wiped out.
In Chrome, we explicitly send a WasResized message to ensure that the renderer
is notified of the fullscreen change in cases where toggling fullscreen doesn't
actually change the renderer's size (e.g. going from tab fullscreen to browser
fullscreen). However, this means that the renderer gets two separate resize
events for the fullscreen toggle: one that toggles fullscreen and another for
the size change. Thus, Blink tries to restore the scroll offset before the
renderer is resized which might then clamp that scroll offset.
For the first issue, I've moved the scroll offset saving logic into
FullscreenController::enterFullScreenForElement which is called before sending
the request IPC to the browser.
For the second issue, I added a will_cause_resize parameter to
WebContents::ExitFullscreen that tells the method whether exiting fullscreen will
potentially cause a window resize. Based on this, WebContents can choose to
explicitly send the WasResized only in cases where it will not occur otherwise.
This ensures the Resize message includes both the fullscreen state change and
size change in one message.
BUG=142427
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Committed: https://crrev.com/ece34a8262550f0c24f9883c5b4eb903b270aa17
Cr-Commit-Position: refs/heads/master@{#372146}
Patch Set 1 #
Total comments: 4
Patch Set 2 : Made explicit resize based on param in WebContents #Patch Set 3 : Nit: remove unused includes #Patch Set 4 : Added Test #Patch Set 5 : Fix build break #Patch Set 6 : Fix more platform-specific compile breaks #Patch Set 7 : Trying to fix test broken on Mac #
Total comments: 8
Patch Set 8 : Rebase #Patch Set 9 : Addressed comments from scheib@ #
Total comments: 10
Patch Set 10 : Addressed comments from avi@ #
Total comments: 12
Patch Set 11 : Addressed pkasting@'s comments #Patch Set 12 : Nit: Inlined arguments in fullscreen_controller #Patch Set 13 : Rebase #Patch Set 14 : Rebase #Patch Set 15 : Rebase #Patch Set 16 : Accidentally made will_cause_resize always false in previous cleanup. Fixed #Messages
Total messages: 74 (25 generated)
|