Bug 61956 - Remember the scroll position and restore after exiting full-screen mode.
Summary: Remember the scroll position and restore after exiting full-screen mode.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-06-02 13:23 PDT by Jer Noble
Modified: 2021-04-11 03:18 PDT (History)
6 users (show)

See Also:


Attachments
Patch (10.47 KB, patch)
2011-06-02 13:31 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (17.52 KB, patch)
2011-06-29 21:40 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (16.33 KB, patch)
2013-02-14 08:19 PST, Jer Noble
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2011-06-02 13:23:38 PDT
Remember the scroll position and restore after exiting full-screen mode.
Comment 1 Jer Noble 2011-06-02 13:28:01 PDT
<rdar://problem/9544461>
Comment 2 Jer Noble 2011-06-02 13:31:25 PDT
Created attachment 95797 [details]
Patch
Comment 3 Jer Noble 2011-06-22 16:57:40 PDT
Correction: <rdar://problem/9504664>
Comment 4 Adam Roben (:aroben) 2011-06-29 14:15:40 PDT
What about WebKit1 on Windows?
Comment 5 Jer Noble 2011-06-29 14:20:03 PDT
(In reply to comment #4)
> What about WebKit1 on Windows?

Actually, both WebKit1 & 2 on Windows would need more work.  Let me look into it.
Comment 6 Jer Noble 2011-06-29 21:40:48 PDT
Created attachment 99233 [details]
Patch
Comment 7 Darin Adler 2011-07-12 10:48:05 PDT
Comment on attachment 99233 [details]
Patch

What makes scroll position special? Is there any other state that needs to be saved and restored?
Comment 8 Eric Seidel (no email) 2012-02-16 13:57:20 PST
Who should review this 6 month old patch?  Should it be r-'d?
Comment 9 Jer Noble 2012-02-16 14:08:43 PST
(In reply to comment #7)
> (From update of attachment 99233 [details])
> What makes scroll position special? Is there any other state that needs to be saved and restored?

@Darin: Scroll position is modified when entering and exiting full-screen, which is what makes it special.  At this time, I'm not aware of any other state which needs saving in the same way.
Comment 10 Jer Noble 2013-02-13 16:41:25 PST
Turns out there's at least one more property which needs to be saved and restored: bug #106115.
Comment 11 Jer Noble 2013-02-14 08:19:24 PST
Created attachment 188356 [details]
Patch

Rebaselined
Comment 12 Simon Fraser (smfr) 2013-02-14 08:46:22 PST
What if the page scrolls while some element is in fullscreen?
Comment 13 Jer Noble 2013-02-14 09:07:13 PST
Generally speaking, this won't happen, as we set a 'overflow:hidden' rule on the document root.
Comment 14 Brad Dougherty 2013-06-13 11:14:14 PDT
This would be really helpful for Vimeo when people embed videos on their own pages.
Comment 15 Simon Fraser (smfr) 2013-07-08 11:02:15 PDT
Comment on attachment 188356 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=188356&action=review

> Source/WebKit2/ChangeLog:44
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Remember the scroll position and restore after exiting full-screen mode.
> +        https://bugs.webkit.org/show_bug.cgi?id=61956
> +
> +        Add support for two new FullScreenClient callbacks for saving and restoring the 
> +        full-screen frame's scroll position.
> +
> +        * UIProcess/win/WebView.cpp:
> +        (WebKit::WebView::fullScreenClientSaveScrollPosition):
> +        (WebKit::WebView::fullScreenClientRestoreScrollPosition):
> +        * UIProcess/win/WebView.h:
> +
> +2011-06-29  Jeremy Noble  <jer.noble@apple.com>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Remember the scroll position and restore after exiting full-screen mode.
> +        https://bugs.webkit.org/show_bug.cgi?id=61956
> +        <rdar://problem/9544461>
> +
> +        Call into the main FrameView to save the scroll position before swapping the
> +        WebView into the full-screen window, and restore the scroll position after 
> +        swapping the WebView back into the browser window.
> +
> +        * UIProcess/mac/WKFullScreenWindowController.mm:
> +        (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
> +        (-[WKFullScreenWindowController beganExitFullScreenAnimation]):
> +
> +        In WebKit2, this requires some communication between the WebProcess and the
> +        UIProcess, so add two new messages to WebFullScreenManager to be called by
> +        its proxy.
> +
> +        * UIProcess/WebFullScreenManagerProxy.h:
> +        * UIProcess/WebFullScreenManagerProxy.cpp:
> +        (WebKit::WebFullScreenManagerProxy::saveScrollPosition):
> +        (WebKit::WebFullScreenManagerProxy::restoreScrollPosition):
> +        * WebProcess/FullScreen/WebFullScreenManager.h:
> +        * WebProcess/FullScreen/WebFullScreenManager.messages.in:
> +        * WebProcess/FullScreen/WebFullScreenManager.cpp:
> +        (WebKit::WebFullScreenManager::saveScrollPosition):
> +        (WebKit::WebFullScreenManager::restoreScrollPosition):

Two changelogs!
Comment 16 Jer Noble 2013-07-09 15:59:37 PDT
Committed r152520: <http://trac.webkit.org/changeset/152520>
Comment 17 Rado 2021-04-11 03:18:29 PDT
Hi, this is still happening. Demo: https://codepen.io/matt-west/pen/hmqsF
Is it really resolved? Thanks.