Title: [177154] trunk/Source
Revision
177154
Author
[email protected]
Date
2014-12-11 09:51:25 -0800 (Thu, 11 Dec 2014)

Log Message

Restore interface state when stopping optimized fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=139465

Reviewed by Simon Fraser.

* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(-[WebVideoFullscreenController fullscreenMayReturnToInline:]): add empty implementation.
* platform/ios/WebVideoFullscreenInterfaceAVKit.h: add declaration
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebVideoFullscreenInterfaceAVKit::enterFullscreen): restore interface context when optimized mode ends.
(WebVideoFullscreenInterfaceAVKit::setIsOptimized): restore interface context when optimized mode ends.
* UIProcess/API/APIUIClient.h:
(API::UIClient::fullscreenMayReturnToInline): added
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h: add declaration
* UIProcess/Cocoa/UIDelegate.h: add declaration
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate): check for responds to selector
(WebKit::UIDelegate::UIClient::fullscreenMayReturnToInline): added
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::fullscreenMayReturnToInline): added.
* UIProcess/WebPageProxy.h: add declaration
* UIProcess/ios/WebVideoFullscreenManagerProxy.h: add declaration
* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline): show the tab.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (177153 => 177154)


--- trunk/Source/WebCore/ChangeLog	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebCore/ChangeLog	2014-12-11 17:51:25 UTC (rev 177154)
@@ -1,3 +1,17 @@
+2014-12-09  Jeremy Jones  <[email protected]>
+
+        Restore interface state when stopping optimized fullscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=139465
+
+        Reviewed by Simon Fraser.
+
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (-[WebVideoFullscreenController fullscreenMayReturnToInline:]): add empty implementation.
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.h: add declaration
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (WebVideoFullscreenInterfaceAVKit::enterFullscreen): restore interface context when optimized mode ends.
+        (WebVideoFullscreenInterfaceAVKit::setIsOptimized): restore interface context when optimized mode ends.
+
 2014-12-11  Anders Carlsson  <[email protected]>
 
         Remove unused storage header includes

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (177153 => 177154)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2014-12-11 17:51:25 UTC (rev 177154)
@@ -72,6 +72,7 @@
 - (void)didEnterFullscreen;
 - (void)didExitFullscreen;
 - (void)didCleanupFullscreen;
+- (void)fullscreenMayReturnToInline;
 @end
 
 class WebVideoFullscreenControllerChangeObserver : public WebVideoFullscreenChangeObserver {
@@ -82,6 +83,7 @@
     virtual void didEnterFullscreen() override { [_target didEnterFullscreen]; }
     virtual void didExitFullscreen() override { [_target didExitFullscreen]; }
     virtual void didCleanupFullscreen() override { [_target didCleanupFullscreen]; }
+    virtual void fullscreenMayReturnToInline() override { [_target fullscreenMayReturnToInline]; }
 };
 
 @implementation WebVideoFullscreenController
@@ -179,6 +181,10 @@
     });
 }
 
+- (void)fullscreenMayReturnToInline
+{
+}
+
 @end
 
 #endif // __IPHONE_OS_VERSION_MIN_REQUIRED < 80000

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (177153 => 177154)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h	2014-12-11 17:51:25 UTC (rev 177154)
@@ -59,6 +59,7 @@
     virtual void didEnterFullscreen() = 0;
     virtual void didExitFullscreen() = 0;
     virtual void didCleanupFullscreen() = 0;
+    virtual void fullscreenMayReturnToInline() = 0;
 };
 
 class WebVideoFullscreenInterfaceAVKit

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (177153 => 177154)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2014-12-11 17:51:25 UTC (rev 177154)
@@ -907,8 +907,12 @@
                         protect = nullptr;
                     }
                 });
-            } stopCompletionHandler:^(AVPlayerViewControllerOptimizedFullscreenStopReason) {
+            } stopCompletionHandler:^(AVPlayerViewControllerOptimizedFullscreenStopReason reason) {
                 m_exitCompleted = true;
+                
+                if (m_fullscreenChangeObserver && reason == AVPlayerViewControllerOptimizedFullscreenStopReasonStopped)
+                    m_fullscreenChangeObserver->fullscreenMayReturnToInline();
+
                 if (m_exitRequested) {
                     [m_videoLayerContainer setBackgroundColor:[[getUIColorClass() clearColor] CGColor]];
                     [[m_playerViewController view] setBackgroundColor:[getUIColorClass() clearColor]];
@@ -1103,6 +1107,9 @@
     
     [m_window setHidden:m_mode & HTMLMediaElement::VideoFullscreenModeOptimized];
     
+    if (m_fullscreenChangeObserver && ~m_mode & HTMLMediaElement::VideoFullscreenModeOptimized)
+        m_fullscreenChangeObserver->fullscreenMayReturnToInline();
+
     if (!m_exitRequested || active)
         return;
     

Modified: trunk/Source/WebKit2/ChangeLog (177153 => 177154)


--- trunk/Source/WebKit2/ChangeLog	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-11 17:51:25 UTC (rev 177154)
@@ -1,3 +1,26 @@
+2014-12-09  Jeremy Jones  <[email protected]>
+
+        Restore interface state when stopping optimized fullscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=139465
+
+        Reviewed by Simon Fraser.
+
+        Implement fullscreenMayReturnToInline() to request the client application show the corresponding tab.
+
+        * UIProcess/API/APIUIClient.h:
+        (API::UIClient::fullscreenMayReturnToInline): added
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: add declaration
+        * UIProcess/Cocoa/UIDelegate.h: add declaration
+        * UIProcess/Cocoa/UIDelegate.mm:
+        (WebKit::UIDelegate::setDelegate): check for responds to selector
+        (WebKit::UIDelegate::UIClient::fullscreenMayReturnToInline): added
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::fullscreenMayReturnToInline): added.
+        * UIProcess/WebPageProxy.h: add declaration
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.h: add declaration
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline): show the tab.
+
 2014-12-11  Alexey Proskuryakov  <[email protected]>
 
         REGRESSION (Async Text Input): Text input method state is not reset when reloading a page

Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (177153 => 177154)


--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2014-12-11 17:51:25 UTC (rev 177154)
@@ -71,6 +71,7 @@
 
     virtual PassRefPtr<WebKit::WebPageProxy> createNewPage(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, const WebKit::NavigationActionData&) { return nullptr; }
     virtual void showPage(WebKit::WebPageProxy*) { }
+    virtual void fullscreenMayReturnToInline(WebKit::WebPageProxy*) { }
     virtual void close(WebKit::WebPageProxy*) { }
 
     virtual void takeFocus(WebKit::WebPageProxy*, WKFocusDirection) { }

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (177153 => 177154)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2014-12-11 17:51:25 UTC (rev 177154)
@@ -45,6 +45,7 @@
 - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame;
 
 - (void)_webViewClose:(WKWebView *)webView;
+- (void)_webViewFullscreenMayReturnToInline:(WKWebView *)webView;
 
 #if TARGET_OS_IPHONE
 - (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray *)defaultActions;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (177153 => 177154)


--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2014-12-11 17:51:25 UTC (rev 177154)
@@ -60,6 +60,7 @@
         // API::UIClient
         virtual PassRefPtr<WebKit::WebPageProxy> createNewPage(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, const WebKit::NavigationActionData&) override;
         virtual void close(WebKit::WebPageProxy*) override;
+        virtual void fullscreenMayReturnToInline(WebKit::WebPageProxy*) override;
         virtual void runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void ()> completionHandler) override;
         virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (bool)> completionHandler) override;
         virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (const WTF::String&)> completionHandler) override;
@@ -86,6 +87,7 @@
         bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1;
         bool webViewPrintFrame : 1;
         bool webViewClose : 1;
+        bool webViewFullscreenMayReturnToInline : 1;
 #if PLATFORM(IOS)
         bool webViewActionsForElementDefaultActions : 1;
         bool webViewDidNotHandleTapAsClickAtPoint : 1;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (177153 => 177154)


--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2014-12-11 17:51:25 UTC (rev 177154)
@@ -72,6 +72,7 @@
     m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded = [delegate respondsToSelector:@selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)];
     m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)];
     m_delegateMethods.webViewClose = [delegate respondsToSelector:@selector(_webViewClose:)];
+    m_delegateMethods.webViewFullscreenMayReturnToInline = [delegate respondsToSelector:@selector(_webViewFullscreenMayReturnToInline:)];
 #if PLATFORM(IOS)
     m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
     m_delegateMethods.webViewDidNotHandleTapAsClickAtPoint = [delegate respondsToSelector:@selector(_webView:didNotHandleTapAsClickAtPoint:)];
@@ -241,6 +242,18 @@
     [(id <WKUIDelegatePrivate>)delegate _webViewClose:m_uiDelegate.m_webView];
 }
 
+void UIDelegate::UIClient::fullscreenMayReturnToInline(WebKit::WebPageProxy*)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewFullscreenMayReturnToInline)
+        return;
+    
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return;
+    
+    [(id <WKUIDelegatePrivate>)delegate _webViewFullscreenMayReturnToInline:m_uiDelegate.m_webView];
+}
+    
 #if PLATFORM(IOS)
 RetainPtr<NSArray> UIDelegate::UIClient::actionsForElement(_WKActivatedElementInfo *elementInfo, RetainPtr<NSArray> defaultActions)
 {

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (177153 => 177154)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-12-11 17:51:25 UTC (rev 177154)
@@ -3089,6 +3089,11 @@
     m_uiClient->showPage(this);
 }
 
+void WebPageProxy::fullscreenMayReturnToInline()
+{
+    m_uiClient->fullscreenMayReturnToInline(this);
+}
+
 void WebPageProxy::closePage(bool stopResponsivenessTimer)
 {
     if (stopResponsivenessTimer)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (177153 => 177154)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-12-11 17:51:25 UTC (rev 177154)
@@ -268,6 +268,8 @@
     bool addsVisitedLinks() const { return m_addsVisitedLinks; }
     void setAddsVisitedLinks(bool addsVisitedLinks) { m_addsVisitedLinks = addsVisitedLinks; }
 
+    void fullscreenMayReturnToInline();
+
 #if ENABLE(INSPECTOR)
     WebInspectorProxy* inspector();
 #endif

Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h (177153 => 177154)


--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h	2014-12-11 17:51:25 UTC (rev 177154)
@@ -65,6 +65,7 @@
     virtual void didEnterFullscreen() override;
     virtual void didExitFullscreen() override;
     virtual void didCleanupFullscreen() override;
+    virtual void fullscreenMayReturnToInline() override;
     
     // FullscreenModel
     virtual void play() override;

Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (177153 => 177154)


--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm	2014-12-11 17:37:12 UTC (rev 177153)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm	2014-12-11 17:51:25 UTC (rev 177154)
@@ -128,6 +128,11 @@
     setExternalPlayback(enabled, type, localizedDeviceName);
 }
     
+void WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline()
+{
+    m_page->fullscreenMayReturnToInline();
+}
+
 void WebVideoFullscreenManagerProxy::requestExitFullscreen()
 {
     m_page->send(Messages::WebVideoFullscreenManager::RequestExitFullscreen(), m_page->pageID());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to