Title: [152520] trunk/Source
Revision
152520
Author
[email protected]
Date
2013-07-09 15:58:45 -0700 (Tue, 09 Jul 2013)

Log Message

Reviewed by Simon Fraser.

Source/WebCore:

Remember the scroll position and restore after exiting full-screen mode.
https://bugs.webkit.org/show_bug.cgi?id=61956

No new tests, adds a client callback used by WebKit and WebKit2 win.

* platform/graphics/win/FullScreenController.cpp:
(FullScreenController::enterFullScreen):
(FullScreenController::exitFullScreen):
* platform/graphics/win/FullScreenControllerClient.h:

Source/WebKit/mac:

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.

* WebView/WebFullScreenController.h:
* WebView/WebFullScreenController.mm:
(-[WebFullScreenController windowDidEnterFullscreen:]): Save the scroll position.
(-[WebFullScreenController exitFullscreen]): Restore the scroll position.

Source/WebKit/win:

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
scroll position of the full-screen frame.

* WebView.cpp:
(WebView::fullScreenClientSaveScrollPosition):
(WebView::fullScreenClientRestoreScrollPosition):
* WebView.h:

Source/WebKit2:

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152519 => 152520)


--- trunk/Source/WebCore/ChangeLog	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebCore/ChangeLog	2013-07-09 22:58:45 UTC (rev 152520)
@@ -1,3 +1,17 @@
+2013-07-09  Jer Noble  <[email protected]>
+
+        Reviewed by Simon Fraser.
+
+        Remember the scroll position and restore after exiting full-screen mode.
+        https://bugs.webkit.org/show_bug.cgi?id=61956
+
+        No new tests, adds a client callback used by WebKit and WebKit2 win.
+
+        * platform/graphics/win/FullScreenController.cpp:
+        (FullScreenController::enterFullScreen):
+        (FullScreenController::exitFullScreen):
+        * platform/graphics/win/FullScreenControllerClient.h:
+
 2013-07-09  Jeff Miller  <[email protected]>
 
         AuthenticationMac.mm does not handle NSURLAuthenticationMethodNegotiate in WebCore::mac()

Modified: trunk/Source/WebCore/platform/graphics/win/FullScreenController.cpp (152519 => 152520)


--- trunk/Source/WebCore/platform/graphics/win/FullScreenController.cpp	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebCore/platform/graphics/win/FullScreenController.cpp	2013-07-09 22:58:45 UTC (rev 152520)
@@ -124,6 +124,8 @@
     m_private->m_isFullScreen = true;
     m_private->m_isEnteringFullScreen = true;
 
+    m_private->m_client->fullScreenClientSaveScrollPosition();
+
     m_private->m_originalHost = m_private->m_client->fullScreenClientParentWindow();
     RECT originalFrame = {0, 0, 0, 0};
     ::GetClientRect(m_private->m_client->fullScreenClientWindow(), &originalFrame);
@@ -178,6 +180,7 @@
 
     ::SetWindowPos(m_private->m_client->fullScreenClientWindow(), 0, m_private->m_originalFrame.x(), m_private->m_originalFrame.y(), m_private->m_originalFrame.width(), m_private->m_originalFrame.height(), SWP_NOACTIVATE | SWP_NOZORDER);
 
+    m_private->m_client->fullScreenClientRestoreScrollPosition();
     m_private->m_client->fullScreenClientDidExitFullScreen();
     m_private->m_client->fullScreenClientForceRepaint();
 }

Modified: trunk/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h (152519 => 152520)


--- trunk/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h	2013-07-09 22:58:45 UTC (rev 152520)
@@ -40,6 +40,8 @@
     virtual void fullScreenClientWillExitFullScreen() = 0;
     virtual void fullScreenClientDidExitFullScreen() = 0;
     virtual void fullScreenClientForceRepaint() = 0;
+    virtual void fullScreenClientSaveScrollPosition() = 0;
+    virtual void fullScreenClientRestoreScrollPosition() = 0;
 protected:
     virtual ~FullScreenControllerClient() { }
 };

Modified: trunk/Source/WebKit/mac/ChangeLog (152519 => 152520)


--- trunk/Source/WebKit/mac/ChangeLog	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-07-09 22:58:45 UTC (rev 152520)
@@ -1,3 +1,20 @@
+2013-07-09  Jeremy Noble  <[email protected]>
+
+        Reviewed by Simon Fraser.
+
+        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.
+
+        * WebView/WebFullScreenController.h:
+        * WebView/WebFullScreenController.mm:
+        (-[WebFullScreenController windowDidEnterFullscreen:]): Save the scroll position.
+        (-[WebFullScreenController exitFullscreen]): Restore the scroll position.
+
 2013-07-04  Yongjun Zhang  <[email protected]>
 
         Add a method to get unreachable URL from WebFrame.

Modified: trunk/Source/WebKit/mac/WebView/WebFullScreenController.h (152519 => 152520)


--- trunk/Source/WebKit/mac/WebView/WebFullScreenController.h	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit/mac/WebView/WebFullScreenController.h	2013-07-09 22:58:45 UTC (rev 152520)
@@ -25,6 +25,7 @@
 
 #if ENABLE(FULLSCREEN_API)
 
+#import <WebCore/IntPoint.h>
 #import <wtf/OwnPtr.h>
 #import <wtf/RefPtr.h>
 #import <wtf/RetainPtr.h>
@@ -49,6 +50,7 @@
     RetainPtr<NSWindow> _backgroundWindow;
     NSRect _initialFrame;
     NSRect _finalFrame;
+    WebCore::IntPoint _scrollPosition;
 
     BOOL _isEnteringFullScreen;
     BOOL _isExitingFullScreen;

Modified: trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm (152519 => 152520)


--- trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit/mac/WebView/WebFullScreenController.mm	2013-07-09 22:58:45 UTC (rev 152520)
@@ -33,6 +33,8 @@
 #import <WebCore/Document.h>
 #import <WebCore/Element.h>
 #import <WebCore/FloatRect.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
 #import <WebCore/HTMLElement.h>
 #import <WebCore/IntRect.h>
 #import <WebCore/Page.h>
@@ -236,6 +238,7 @@
         [_webViewPlaceholder.get() setWantsLayer:YES];
     }
     [[_webViewPlaceholder.get() layer] setContents:(id)webViewContents.get()];
+    _scrollPosition = [_webView _mainCoreFrame]->view()->scrollPosition();
     [self _swapView:_webView with:_webViewPlaceholder.get()];
     
     // Then insert the WebView into the full screen window
@@ -364,6 +367,7 @@
     
     NSResponder *firstResponder = [[self window] firstResponder];
     [self _swapView:_webViewPlaceholder.get() with:_webView];
+    [_webView _mainCoreFrame]->view()->setScrollPosition(_scrollPosition);
     [[_webView window] makeResponder:firstResponder firstResponderIfDescendantOfView:_webView];
     
     NSRect windowBounds = [[self window] frame];

Modified: trunk/Source/WebKit/win/ChangeLog (152519 => 152520)


--- trunk/Source/WebKit/win/ChangeLog	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit/win/ChangeLog	2013-07-09 22:58:45 UTC (rev 152520)
@@ -1,3 +1,18 @@
+2013-07-09  Jer Noble  <[email protected]>
+
+        Reviewed by Simon Fraser.
+
+        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 
+        scroll position of the full-screen frame.
+
+        * WebView.cpp:
+        (WebView::fullScreenClientSaveScrollPosition):
+        (WebView::fullScreenClientRestoreScrollPosition):
+        * WebView.h:
+
 2013-07-01  Jochen Eisinger  <[email protected]>
 
         Remove support for consumable user gestures

Modified: trunk/Source/WebKit/win/WebView.cpp (152519 => 152520)


--- trunk/Source/WebKit/win/WebView.cpp	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit/win/WebView.cpp	2013-07-09 22:58:45 UTC (rev 152520)
@@ -6913,6 +6913,20 @@
     m_fullscreenController->repaintCompleted();
 }
 
+void WebView::fullScreenClientSaveScrollPosition()
+{
+    if (Frame* coreFrame = core(m_mainFrame))
+        if (FrameView* view = coreFrame->view())
+            m_scrollPosition = view->scrollPosition();
+}
+
+void WebView::fullScreenClientRestoreScrollPosition()
+{
+    if (Frame* coreFrame = core(m_mainFrame))
+        if (FrameView* view = coreFrame->view())
+            view->setScrollPosition(m_scrollPosition);
+}
+
 #endif
 // Used by TextInputController in DumpRenderTree
 

Modified: trunk/Source/WebKit/win/WebView.h (152519 => 152520)


--- trunk/Source/WebKit/win/WebView.h	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit/win/WebView.h	2013-07-09 22:58:45 UTC (rev 152520)
@@ -1067,6 +1067,8 @@
     virtual void fullScreenClientWillExitFullScreen();
     virtual void fullScreenClientDidExitFullScreen();
     virtual void fullScreenClientForceRepaint();
+    virtual void fullScreenClientSaveScrollPosition();
+    virtual void fullScreenClientRestoreScrollPosition();
 #endif
 
     ULONG m_refCount;
@@ -1167,6 +1169,7 @@
 #if ENABLE(FULLSCREEN_API)
     RefPtr<WebCore::Element> m_fullScreenElement;
     OwnPtr<WebCore::FullScreenController> m_fullscreenController;
+    WebCore::IntPoint m_scrollPosition;
 #endif
 };
 

Modified: trunk/Source/WebKit2/ChangeLog (152519 => 152520)


--- trunk/Source/WebKit2/ChangeLog	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit2/ChangeLog	2013-07-09 22:58:45 UTC (rev 152520)
@@ -1,3 +1,33 @@
+2013-07-09  Jer Noble  <[email protected]>
+
+        Reviewed by Simon Fraser.
+
+        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):
+
 2013-07-07  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Runtime critical warning when unloading a module that failed to load

Modified: trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp (152519 => 152520)


--- trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp	2013-07-09 22:58:45 UTC (rev 152520)
@@ -93,6 +93,16 @@
     supports = !withKeyboard;
 }
 
+void WebFullScreenManagerProxy::saveScrollPosition()
+{
+    m_page->process()->send(Messages::WebFullScreenManager::SaveScrollPosition(), m_page->pageID());
+}
+
+void WebFullScreenManagerProxy::restoreScrollPosition()
+{
+    m_page->process()->send(Messages::WebFullScreenManager::RestoreScrollPosition(), m_page->pageID());
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h (152519 => 152520)


--- trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h	2013-07-09 22:58:45 UTC (rev 152520)
@@ -77,6 +77,8 @@
     void didExitFullScreen();
     void setAnimatingFullScreen(bool);
     void requestExitFullScreen();
+    void saveScrollPosition();
+    void restoreScrollPosition();
 
 private:
     explicit WebFullScreenManagerProxy(WebPageProxy*);

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (152519 => 152520)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2013-07-09 22:58:45 UTC (rev 152520)
@@ -228,6 +228,7 @@
     [[self window] setAutodisplay:NO];
 
     NSResponder *webWindowFirstResponder = [[_webView window] firstResponder];
+    [self _manager]->saveScrollPosition();
     [[self window] setFrame:screenFrame display:NO];
 
     // Painting is normally suspended when the WKView is removed from the window, but this is
@@ -386,6 +387,7 @@
     [self _manager]->didExitFullScreen();
     [self _manager]->setAnimatingFullScreen(false);
     [self _page]->scalePage(_savedScale, IntPoint());
+    [self _manager]->restoreScrollPosition();
     [self _page]->forceRepaint(VoidCallback::create(self, completeFinishExitFullScreenAnimationAfterRepaint));
 }
 

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp (152519 => 152520)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2013-07-09 22:58:45 UTC (rev 152520)
@@ -29,10 +29,13 @@
 
 #include "Connection.h"
 #include "WebCoreArgumentCoders.h"
+#include "WebFrame.h"
 #include "WebFullScreenManagerProxyMessages.h"
 #include "WebPage.h"
 #include <WebCore/Color.h>
 #include <WebCore/Element.h>
+#include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
 #include <WebCore/Page.h>
 #include <WebCore/RenderLayer.h>
 #include <WebCore/RenderLayerBacking.h>
@@ -151,6 +154,16 @@
     m_page->injectedBundleFullScreenClient().closeFullScreen(m_page.get());
 }
 
+void WebFullScreenManager::saveScrollPosition()
+{
+    m_scrollPosition = m_page->corePage()->mainFrame()->view()->scrollPosition();
+}
+
+void WebFullScreenManager::restoreScrollPosition()
+{
+    m_page->corePage()->mainFrame()->view()->setScrollPosition(m_scrollPosition);
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h (152519 => 152520)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2013-07-09 22:58:45 UTC (rev 152520)
@@ -71,11 +71,14 @@
 
     void setAnimatingFullScreen(bool);
     void requestExitFullScreen();
+    void saveScrollPosition();
+    void restoreScrollPosition();
 
     void didReceiveWebFullScreenManagerMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&);
 
     WebCore::IntRect m_initialFrame;
     WebCore::IntRect m_finalFrame;
+    WebCore::IntPoint m_scrollPosition;
     RefPtr<WebPage> m_page;
     RefPtr<WebCore::Element> m_element;
 };

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in (152519 => 152520)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in	2013-07-09 22:47:21 UTC (rev 152519)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in	2013-07-09 22:58:45 UTC (rev 152520)
@@ -28,5 +28,7 @@
     WillExitFullScreen()
     DidExitFullScreen()
     SetAnimatingFullScreen(bool animating)
+    SaveScrollPosition()
+    RestoreScrollPosition()
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to