Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1021)

Issue 1488653002: Fix scroll restoration when exiting fullscreen mode. (Closed)

Created:
5 years ago by bokan
Modified:
4 years, 10 months ago
CC:
blink-reviews, chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, jam, nasko+codewatch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+151 lines, -59 lines) Patch
M chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/chrome_bubble_manager.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/chrome_bubble_manager.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/exclusive_access/fullscreen_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +13 lines, -10 lines 0 comments Download
M chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc View 1 2 3 4 5 6 7 8 9 2 chunks +60 lines, -0 lines 0 comments Download
M components/guest_view/browser/guest_view_base.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/frame_host/render_frame_host_delegate.h View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -1 line 0 comments Download
M content/browser/frame_host/render_frame_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M content/browser/web_contents/web_contents_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 chunks +26 lines, -18 lines 0 comments Download
M content/public/browser/screen_orientation_provider.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M content/public/browser/screen_orientation_provider.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M content/public/browser/web_contents.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +4 lines, -1 line 0 comments Download
M content/public/browser/web_contents_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -1 line 0 comments Download
M content/shell/browser/blink_test_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/web/FullscreenController.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/web/FullscreenController.cpp View 1 2 3 4 5 6 7 4 chunks +14 lines, -8 lines 0 comments Download
M ui/views/controls/webview/webview.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/views/controls/webview/webview.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/views/controls/webview/webview_unittest.cc View 1 2 3 4 5 6 7 5 chunks +6 lines, -6 lines 0 comments Download

Messages

Total messages: 74 (25 generated)
bokan
Hi Vincent, I'm wondering if this is the right fix on the Chromium side? I ...
5 years ago (2015-11-30 16:24:59 UTC) #2
scheib
Tests aren't in a good position for this span of code logic. Browser tests have ...
5 years ago (2015-12-01 00:30:18 UTC) #3
bokan
https://codereview.chromium.org/1488653002/diff/1/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/1/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode225 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:225: // Ensure web contents exit fullscreen state by sending ...
5 years ago (2015-12-01 20:46:10 UTC) #4
bokan
On 2015/12/01 00:30:18, scheib wrote: > Tests aren't in a good position for this span ...
5 years ago (2015-12-01 20:49:44 UTC) #5
bokan
On 2015/12/01 20:49:44, bokan wrote: > On 2015/12/01 00:30:18, scheib wrote: > > Tests aren't ...
5 years ago (2015-12-02 20:11:19 UTC) #6
bokan
On 2015/12/02 20:11:19, bokan wrote: > On 2015/12/01 20:49:44, bokan wrote: > > On 2015/12/01 ...
5 years ago (2015-12-02 23:26:33 UTC) #7
scheib
OK, I like this direction. Check if you can unit test this with src/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc -- ...
5 years ago (2015-12-03 19:58:57 UTC) #8
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488653002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488653002/40001
5 years ago (2015-12-04 21:31:05 UTC) #10
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: cast_shell_android on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_android/builds/87910)
5 years ago (2015-12-04 21:48:30 UTC) #12
bokan
Added a test, PTAL
5 years ago (2015-12-08 23:44:38 UTC) #15
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488653002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488653002/80001
5 years ago (2015-12-08 23:49:05 UTC) #16
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_arm64_dbg_recipe/builds/155032) android_chromium_gn_compile_dbg on ...
5 years ago (2015-12-09 00:13:57 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488653002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488653002/100001
5 years ago (2015-12-09 13:48:43 UTC) #20
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromium_gn_compile_rel/builds/168505)
5 years ago (2015-12-09 14:11:17 UTC) #22
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488653002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488653002/120001
5 years ago (2015-12-09 14:37:26 UTC) #24
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/152676)
5 years ago (2015-12-09 16:53:17 UTC) #27
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488653002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488653002/140001
5 years ago (2015-12-09 20:24:10 UTC) #29
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_gn_chromeos_rel on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_gn_chromeos_rel/builds/117974)
5 years ago (2015-12-09 21:26:56 UTC) #31
bokan
Your calendar has you as back from OOO, PTAL if you have a chance.
5 years ago (2015-12-14 18:20:19 UTC) #32
bokan
Friendly post-holiday ping
4 years, 11 months ago (2016-01-04 18:34:12 UTC) #33
blink-reviews
OK, see it and sorry for delay. It will be first code review I do ...
4 years, 11 months ago (2016-01-04 20:34:59 UTC) #34
chromium-reviews
OK, see it and sorry for delay. It will be first code review I do ...
4 years, 11 months ago (2016-01-04 20:35:00 UTC) #35
scheib
LGTM with suggested comments: https://codereview.chromium.org/1488653002/diff/140001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/140001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode275 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:275: web_contents->ExitFullscreen(IsFullscreenCausedByTab()); For readability please use ...
4 years, 11 months ago (2016-01-04 22:26:48 UTC) #36
bokan
https://codereview.chromium.org/1488653002/diff/140001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/140001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode275 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:275: web_contents->ExitFullscreen(IsFullscreenCausedByTab()); On 2016/01/04 22:26:48, scheib wrote: > For readability ...
4 years, 11 months ago (2016-01-05 15:37:11 UTC) #37
bokan
Adding OWNERs: +lfg@ for guest_view_base.cc +rockot@ for tab_capture_registry.cc +pkasting@ for chrome/browser/ui/* +avi@ for content/* and ...
4 years, 11 months ago (2016-01-05 15:46:34 UTC) #40
lfg
guest_view_base.cc lgtm
4 years, 11 months ago (2016-01-05 16:10:33 UTC) #42
Avi (use Gerrit)
https://codereview.chromium.org/1488653002/diff/200001/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc File chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc (right): https://codereview.chromium.org/1488653002/diff/200001/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc#newcode762 chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc:762: nit: no need for a newline here https://codereview.chromium.org/1488653002/diff/200001/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc#newcode779 chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc:779: ...
4 years, 11 months ago (2016-01-05 16:17:57 UTC) #43
Ken Rockot(use gerrit already)
tab_capture_registry.cc lgtm
4 years, 11 months ago (2016-01-05 16:47:54 UTC) #44
bokan
https://codereview.chromium.org/1488653002/diff/200001/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc File chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc (right): https://codereview.chromium.org/1488653002/diff/200001/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc#newcode762 chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc:762: On 2016/01/05 16:17:57, Avi wrote: > nit: no need ...
4 years, 11 months ago (2016-01-05 17:15:48 UTC) #45
Avi (use Gerrit)
Thanks! LGTM
4 years, 11 months ago (2016-01-05 17:24:40 UTC) #46
Peter Kasting
LGTM https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:277: web_contents->ExitFullscreen(will_cause_resize); Nit: Inline: web_contents->ExitFullscreen(IsFullscreenCausedByTab()); Then remove the {} ...
4 years, 11 months ago (2016-01-05 20:34:26 UTC) #47
bokan
https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:277: web_contents->ExitFullscreen(will_cause_resize); On 2016/01/05 20:34:26, Peter Kasting wrote: > Nit: ...
4 years, 11 months ago (2016-01-06 17:48:32 UTC) #48
Peter Kasting
https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:277: web_contents->ExitFullscreen(will_cause_resize); On 2016/01/06 17:48:32, bokan wrote: > On 2016/01/05 ...
4 years, 11 months ago (2016-01-06 20:00:28 UTC) #49
scheib
https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:277: web_contents->ExitFullscreen(will_cause_resize); On 2016/01/06 20:00:28, Peter Kasting wrote: > On ...
4 years, 11 months ago (2016-01-06 21:21:01 UTC) #50
Peter Kasting
https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:277: web_contents->ExitFullscreen(will_cause_resize); On 2016/01/06 21:21:01, scheib wrote: > On 2016/01/06 ...
4 years, 11 months ago (2016-01-06 21:26:04 UTC) #51
bokan
https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:277: web_contents->ExitFullscreen(will_cause_resize); On 2016/01/06 21:26:04, Peter Kasting wrote: > On ...
4 years, 11 months ago (2016-01-06 21:40:57 UTC) #52
Peter Kasting
https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:277: web_contents->ExitFullscreen(will_cause_resize); On 2016/01/06 21:40:57, bokan wrote: > On 2016/01/06 ...
4 years, 11 months ago (2016-01-06 21:56:41 UTC) #53
bokan
On 2016/01/06 21:56:41, Peter Kasting wrote: > https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc > File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): > > https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 ...
4 years, 11 months ago (2016-01-06 22:01:17 UTC) #54
Peter Kasting
Well, this isn't something where the style guide has guidance, so I'm definitely not going ...
4 years, 11 months ago (2016-01-06 22:05:09 UTC) #55
scheib
https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc File chrome/browser/ui/exclusive_access/fullscreen_controller.cc (right): https://codereview.chromium.org/1488653002/diff/220001/chrome/browser/ui/exclusive_access/fullscreen_controller.cc#newcode277 chrome/browser/ui/exclusive_access/fullscreen_controller.cc:277: web_contents->ExitFullscreen(will_cause_resize); On 2016/01/06 21:56:41, Peter Kasting wrote: > On ...
4 years, 11 months ago (2016-01-06 22:06:56 UTC) #56
Peter Kasting
On 2016/01/06 22:06:56, scheib wrote: > Peter please say "Just do it this way" or ...
4 years, 11 months ago (2016-01-06 22:11:06 UTC) #57
bokan
I think scheib@'s compromise strikes a good balance so I'll go with that :). Thanks ...
4 years, 11 months ago (2016-01-06 22:16:55 UTC) #58
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488653002/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488653002/260001
4 years, 11 months ago (2016-01-06 22:17:15 UTC) #61
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/148918)
4 years, 11 months ago (2016-01-06 23:23:22 UTC) #63
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488653002/340001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488653002/340001
4 years, 10 months ago (2016-01-28 13:46:53 UTC) #67
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/172765)
4 years, 10 months ago (2016-01-28 16:23:28 UTC) #69
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1488653002/340001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1488653002/340001
4 years, 10 months ago (2016-01-28 16:25:15 UTC) #71
commit-bot: I haz the power
Committed patchset #16 (id:340001)
4 years, 10 months ago (2016-01-28 19:49:56 UTC) #72
commit-bot: I haz the power
4 years, 10 months ago (2016-01-28 19:50:57 UTC) #74
Message was sent while issue was closed.
Patchset 16 (id:??) landed as
https://crrev.com/ece34a8262550f0c24f9883c5b4eb903b270aa17
Cr-Commit-Position: refs/heads/master@{#372146}

Powered by Google App Engine
This is Rietveld 408576698