Title: [209747] trunk/Source
Revision
209747
Author
[email protected]
Date
2016-12-12 16:45:37 -0800 (Mon, 12 Dec 2016)

Log Message

[iOS] MediaDocument "Done" button should navigate the page back
https://bugs.webkit.org/show_bug.cgi?id=165779

Reviewed by Sam Weinig.

Source/WebCore:

Detect if the exit from fullscreen was caused by the Done button,
and if so, tell the page to navigate back.

Unfortunately this is not yet testable. It's waiting on the
UI-based device testing in development by the media team.

* platform/cocoa/WebVideoFullscreenModel.h: Add a finishedWithMedia parameter to
requestFullscreenMode, to indicate if the change in mode is associated with
the closing of the media document.
* platform/cocoa/WebVideoFullscreenModelVideoElement.h:
* platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
(WebVideoFullscreenModelVideoElement::requestFullscreenMode): If we're a media
document, and we say we're finished with the media, tell the document
to navigate back a page.
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(WebVideoFullscreenControllerContext::requestFullscreenMode):
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):

Source/WebKit2:

* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
(WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
* WebProcess/cocoa/WebVideoFullscreenManager.h:
* WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::requestFullscreenMode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209746 => 209747)


--- trunk/Source/WebCore/ChangeLog	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebCore/ChangeLog	2016-12-13 00:45:37 UTC (rev 209747)
@@ -1,3 +1,29 @@
+2016-12-12  Dean Jackson  <[email protected]>
+
+        [iOS] MediaDocument "Done" button should navigate the page back
+        https://bugs.webkit.org/show_bug.cgi?id=165779
+
+        Reviewed by Sam Weinig.
+
+        Detect if the exit from fullscreen was caused by the Done button,
+        and if so, tell the page to navigate back.
+
+        Unfortunately this is not yet testable. It's waiting on the
+        UI-based device testing in development by the media team.
+
+        * platform/cocoa/WebVideoFullscreenModel.h: Add a finishedWithMedia parameter to
+        requestFullscreenMode, to indicate if the change in mode is associated with
+        the closing of the media document.
+        * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
+        * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
+        (WebVideoFullscreenModelVideoElement::requestFullscreenMode): If we're a media
+        document, and we say we're finished with the media, tell the document
+        to navigate back a page.
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (WebVideoFullscreenControllerContext::requestFullscreenMode):
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
+
 2016-12-12  Zalan Bujtas  <[email protected]>
 
         Infinite recursion when viewport is set to the size of the content but the content overflows the viewport.

Modified: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h (209746 => 209747)


--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h	2016-12-13 00:45:37 UTC (rev 209747)
@@ -43,7 +43,7 @@
     virtual void addClient(WebVideoFullscreenModelClient&) = 0;
     virtual void removeClient(WebVideoFullscreenModelClient&)= 0;
 
-    virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) = 0;
+    virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false) = 0;
     virtual void setVideoLayerFrame(FloatRect) = 0;
     enum VideoGravity { VideoGravityResize, VideoGravityResizeAspect, VideoGravityResizeAspectFill };
     virtual void setVideoLayerGravity(VideoGravity) = 0;

Modified: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h (209746 => 209747)


--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h	2016-12-13 00:45:37 UTC (rev 209747)
@@ -64,7 +64,7 @@
 
     WEBCORE_EXPORT void addClient(WebVideoFullscreenModelClient&) override;
     WEBCORE_EXPORT void removeClient(WebVideoFullscreenModelClient&) override;
-    WEBCORE_EXPORT void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) override;
+    WEBCORE_EXPORT void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false) override;
     WEBCORE_EXPORT void setVideoLayerFrame(FloatRect) override;
     WEBCORE_EXPORT void setVideoLayerGravity(VideoGravity) override;
     WEBCORE_EXPORT void fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode) override;

Modified: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm (209746 => 209747)


--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm	2016-12-13 00:45:37 UTC (rev 209747)
@@ -28,6 +28,8 @@
 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 #import "WebVideoFullscreenModelVideoElement.h"
 
+#import "DOMWindow.h"
+#import "History.h"
 #import "Logging.h"
 #import "MediaControlsHost.h"
 #import "WebPlaybackSessionModelMediaElement.h"
@@ -134,10 +136,19 @@
     m_videoElement->waitForPreparedForInlineThen(completionHandler);
 }
 
-void WebVideoFullscreenModelVideoElement::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+void WebVideoFullscreenModelVideoElement::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
 {
     if (m_videoElement && m_videoElement->fullscreenMode() != mode)
         m_videoElement->setFullscreenMode(mode);
+
+    if (m_videoElement && finishedWithMedia && mode == MediaPlayerEnums::VideoFullscreenModeNone) {
+        if (m_videoElement->document().isMediaDocument()) {
+            if (DOMWindow* window = m_videoElement->document().domWindow()) {
+                if (History* history = window->history())
+                    history->back();
+            }
+        }
+    }
 }
 
 void WebVideoFullscreenModelVideoElement::setVideoLayerFrame(FloatRect rect)

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (209746 => 209747)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2016-12-13 00:45:37 UTC (rev 209747)
@@ -179,7 +179,7 @@
     // WebVideoFullscreenModel
     void addClient(WebVideoFullscreenModelClient&) override;
     void removeClient(WebVideoFullscreenModelClient&) override;
-    void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) override;
+    void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false) override;
     void setVideoLayerFrame(FloatRect) override;
     void setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity) override;
     void fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode) override;
@@ -444,13 +444,13 @@
     m_fullscreenClients.remove(&client);
 }
 
-void WebVideoFullscreenControllerContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+void WebVideoFullscreenControllerContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
 {
     ASSERT(isUIThread());
     RefPtr<WebVideoFullscreenControllerContext> protectedThis(this);
-    WebThreadRun([protectedThis, this, mode] {
+    WebThreadRun([protectedThis, this, mode, finishedWithMedia] {
         if (m_fullscreenModel)
-            m_fullscreenModel->requestFullscreenMode(mode);
+            m_fullscreenModel->requestFullscreenMode(mode, finishedWithMedia);
     });
 }
 

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (209746 => 209747)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2016-12-13 00:45:37 UTC (rev 209747)
@@ -982,9 +982,8 @@
     if (webPlaybackSessionModel() && (reason == ExitFullScreenReason::DoneButtonTapped || reason == ExitFullScreenReason::RemoteControlStopEventReceived))
         webPlaybackSessionModel()->pause();
     
+    m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, reason == ExitFullScreenReason::DoneButtonTapped);
 
-    m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone);
-
     if (!m_watchdogTimer.isActive())
         m_watchdogTimer.startOneShot(DefaultWatchdogTimerInterval);
 

Modified: trunk/Source/WebKit2/ChangeLog (209746 => 209747)


--- trunk/Source/WebKit2/ChangeLog	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebKit2/ChangeLog	2016-12-13 00:45:37 UTC (rev 209747)
@@ -1,3 +1,19 @@
+2016-12-12  Dean Jackson  <[email protected]>
+
+        [iOS] MediaDocument "Done" button should navigate the page back
+        https://bugs.webkit.org/show_bug.cgi?id=165779
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
+        (WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
+        * WebProcess/cocoa/WebVideoFullscreenManager.h:
+        * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
+        * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+        (WebKit::WebVideoFullscreenManager::requestFullscreenMode):
+
 2016-12-12  Tim Horton  <[email protected]>
 
         Provide SPI to avoid blocking on painting when coming into view

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h (209746 => 209747)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h	2016-12-13 00:45:37 UTC (rev 209747)
@@ -79,7 +79,7 @@
     // WebVideoFullscreenModel
     void addClient(WebCore::WebVideoFullscreenModelClient&) override;
     void removeClient(WebCore::WebVideoFullscreenModelClient&) override;
-    void requestFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
+    void requestFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false) override;
     void setVideoLayerFrame(WebCore::FloatRect) override;
     void setVideoLayerGravity(VideoGravity) override;
     void fullscreenModeChanged(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
@@ -147,7 +147,7 @@
 #endif
 
     // Messages to WebVideoFullscreenManager
-    void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+    void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false);
     void didSetupFullscreen(uint64_t contextId);
     void didExitFullscreen(uint64_t contextId);
     void didEnterFullscreen(uint64_t contextId);

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (209746 => 209747)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm	2016-12-13 00:45:37 UTC (rev 209747)
@@ -136,10 +136,10 @@
     m_clients.remove(&client);
 }
 
-void WebVideoFullscreenModelContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+void WebVideoFullscreenModelContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
 {
     if (m_manager)
-        m_manager->requestFullscreenMode(m_contextId, mode);
+        m_manager->requestFullscreenMode(m_contextId, mode, finishedWithMedia);
 }
 
 void WebVideoFullscreenModelContext::setVideoLayerFrame(WebCore::FloatRect frame)
@@ -435,9 +435,9 @@
 
 #pragma mark Messages to WebVideoFullscreenManager
 
-void WebVideoFullscreenManagerProxy::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
+void WebVideoFullscreenManagerProxy::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
 {
-    m_page->send(Messages::WebVideoFullscreenManager::RequestFullscreenMode(contextId, mode), m_page->pageID());
+    m_page->send(Messages::WebVideoFullscreenManager::RequestFullscreenMode(contextId, mode, finishedWithMedia), m_page->pageID());
 }
 
 void WebVideoFullscreenManagerProxy::didSetupFullscreen(uint64_t contextId)

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h (209746 => 209747)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h	2016-12-13 00:45:37 UTC (rev 209747)
@@ -133,7 +133,7 @@
     void videoDimensionsChanged(uint64_t contextId, const WebCore::FloatSize&);
 
     // Messages from WebVideoFullscreenManagerProxy
-    void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+    void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia);
     void didSetupFullscreen(uint64_t contextId);
     void didExitFullscreen(uint64_t contextId);
     void didEnterFullscreen(uint64_t contextId);

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in (209746 => 209747)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in	2016-12-13 00:45:37 UTC (rev 209747)
@@ -22,7 +22,7 @@
 
 #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 messages -> WebVideoFullscreenManager {
-    RequestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
+    RequestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool finishedWithMedia)
     DidSetupFullscreen(uint64_t contextId)
     DidExitFullscreen(uint64_t contextId)
     DidEnterFullscreen(uint64_t contextId)

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (209746 => 209747)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm	2016-12-13 00:37:40 UTC (rev 209746)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm	2016-12-13 00:45:37 UTC (rev 209747)
@@ -291,9 +291,9 @@
 
 #pragma mark Messages from WebVideoFullscreenManagerProxy:
 
-void WebVideoFullscreenManager::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
+void WebVideoFullscreenManager::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
 {
-    ensureModel(contextId).requestFullscreenMode(mode);
+    ensureModel(contextId).requestFullscreenMode(mode, finishedWithMedia);
 }
 
 void WebVideoFullscreenManager::fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to