Title: [152665] branches/safari-537-branch/Source

Diff

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (152664 => 152665)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-15 23:10:56 UTC (rev 152665)
@@ -1,5 +1,23 @@
 2013-07-15  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r152520
+
+    2013-07-09  Jer Noble  <jer.no...@apple.com>
+
+            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-15  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r152459
 
     2013-07-08  Ruth Fong  <ruth_f...@apple.com>

Modified: branches/safari-537-branch/Source/WebCore/platform/graphics/win/FullScreenController.cpp (152664 => 152665)


--- branches/safari-537-branch/Source/WebCore/platform/graphics/win/FullScreenController.cpp	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebCore/platform/graphics/win/FullScreenController.cpp	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h (152664 => 152665)


--- branches/safari-537-branch/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebCore/platform/graphics/win/FullScreenControllerClient.h	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit/mac/ChangeLog (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit/mac/ChangeLog	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit/mac/ChangeLog	2013-07-15 23:10:56 UTC (rev 152665)
@@ -1,3 +1,24 @@
+2013-07-15  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r152520
+
+    2013-07-09  Jeremy Noble  <jer.no...@apple.com>
+
+            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-12  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r152571

Modified: branches/safari-537-branch/Source/WebKit/mac/WebView/WebFullScreenController.h (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit/mac/WebView/WebFullScreenController.h	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit/mac/WebView/WebFullScreenController.h	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit/mac/WebView/WebFullScreenController.mm (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit/mac/WebView/WebFullScreenController.mm	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit/mac/WebView/WebFullScreenController.mm	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit/win/ChangeLog (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit/win/ChangeLog	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit/win/ChangeLog	2013-07-15 23:10:56 UTC (rev 152665)
@@ -1,3 +1,22 @@
+2013-07-15  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r152520
+
+    2013-07-09  Jer Noble  <jer.no...@apple.com>
+
+            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  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r152065

Modified: branches/safari-537-branch/Source/WebKit/win/WebView.cpp (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit/win/WebView.cpp	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit/win/WebView.cpp	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit/win/WebView.h (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit/win/WebView.h	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit/win/WebView.h	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit2/ChangeLog (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-15 23:10:56 UTC (rev 152665)
@@ -1,5 +1,39 @@
 2013-07-15  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r152520
+
+    2013-07-09  Jer Noble  <jer.no...@apple.com>
+
+            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-15  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r152316
 
     2013-07-02  Ada Chan  <adac...@apple.com>

Modified: branches/safari-537-branch/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.cpp	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit2/UIProcess/WebFullScreenManagerProxy.h	2013-07-15 23:10:56 UTC (rev 152665)
@@ -77,6 +77,8 @@
     void didExitFullScreen();
     void setAnimatingFullScreen(bool);
     void requestExitFullScreen();
+    void saveScrollPosition();
+    void restoreScrollPosition();
 
 private:
     explicit WebFullScreenManagerProxy(WebPageProxy*);

Modified: branches/safari-537-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2013-07-15 23:10:56 UTC (rev 152665)
@@ -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: branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in (152664 => 152665)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in	2013-07-15 23:08:06 UTC (rev 152664)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.messages.in	2013-07-15 23:10:56 UTC (rev 152665)
@@ -28,5 +28,7 @@
     WillExitFullScreen()
     DidExitFullScreen()
     SetAnimatingFullScreen(bool animating)
+    SaveScrollPosition()
+    RestoreScrollPosition()
 }
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to