Changeset 209747 in webkit


Ignore:
Timestamp:
Dec 12, 2016, 4:45:37 PM (9 years ago)
Author:
dino@apple.com
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):

Location:
trunk/Source
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209745 r209747  
     12016-12-12  Dean Jackson  <dino@apple.com>
     2
     3        [iOS] MediaDocument "Done" button should navigate the page back
     4        https://bugs.webkit.org/show_bug.cgi?id=165779
     5
     6        Reviewed by Sam Weinig.
     7
     8        Detect if the exit from fullscreen was caused by the Done button,
     9        and if so, tell the page to navigate back.
     10
     11        Unfortunately this is not yet testable. It's waiting on the
     12        UI-based device testing in development by the media team.
     13
     14        * platform/cocoa/WebVideoFullscreenModel.h: Add a finishedWithMedia parameter to
     15        requestFullscreenMode, to indicate if the change in mode is associated with
     16        the closing of the media document.
     17        * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
     18        * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
     19        (WebVideoFullscreenModelVideoElement::requestFullscreenMode): If we're a media
     20        document, and we say we're finished with the media, tell the document
     21        to navigate back a page.
     22        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
     23        (WebVideoFullscreenControllerContext::requestFullscreenMode):
     24        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
     25        (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
     26
    1272016-12-12  Zalan Bujtas  <zalan@apple.com>
    228
  • trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h

    r205365 r209747  
    4444    virtual void removeClient(WebVideoFullscreenModelClient&)= 0;
    4545
    46     virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) = 0;
     46    virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false) = 0;
    4747    virtual void setVideoLayerFrame(FloatRect) = 0;
    4848    enum VideoGravity { VideoGravityResize, VideoGravityResizeAspect, VideoGravityResizeAspectFill };
  • trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h

    r206245 r209747  
    6565    WEBCORE_EXPORT void addClient(WebVideoFullscreenModelClient&) override;
    6666    WEBCORE_EXPORT void removeClient(WebVideoFullscreenModelClient&) override;
    67     WEBCORE_EXPORT void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) override;
     67    WEBCORE_EXPORT void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false) override;
    6868    WEBCORE_EXPORT void setVideoLayerFrame(FloatRect) override;
    6969    WEBCORE_EXPORT void setVideoLayerGravity(VideoGravity) override;
  • trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm

    r205365 r209747  
    2929#import "WebVideoFullscreenModelVideoElement.h"
    3030
     31#import "DOMWindow.h"
     32#import "History.h"
    3133#import "Logging.h"
    3234#import "MediaControlsHost.h"
     
    135137}
    136138
    137 void WebVideoFullscreenModelVideoElement::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
     139void WebVideoFullscreenModelVideoElement::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
    138140{
    139141    if (m_videoElement && m_videoElement->fullscreenMode() != mode)
    140142        m_videoElement->setFullscreenMode(mode);
     143
     144    if (m_videoElement && finishedWithMedia && mode == MediaPlayerEnums::VideoFullscreenModeNone) {
     145        if (m_videoElement->document().isMediaDocument()) {
     146            if (DOMWindow* window = m_videoElement->document().domWindow()) {
     147                if (History* history = window->history())
     148                    history->back();
     149            }
     150        }
     151    }
    141152}
    142153
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm

    r206350 r209747  
    180180    void addClient(WebVideoFullscreenModelClient&) override;
    181181    void removeClient(WebVideoFullscreenModelClient&) override;
    182     void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) override;
     182    void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false) override;
    183183    void setVideoLayerFrame(FloatRect) override;
    184184    void setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity) override;
     
    445445}
    446446
    447 void WebVideoFullscreenControllerContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
    448 {
    449     ASSERT(isUIThread());
    450     RefPtr<WebVideoFullscreenControllerContext> protectedThis(this);
    451     WebThreadRun([protectedThis, this, mode] {
     447void WebVideoFullscreenControllerContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
     448{
     449    ASSERT(isUIThread());
     450    RefPtr<WebVideoFullscreenControllerContext> protectedThis(this);
     451    WebThreadRun([protectedThis, this, mode, finishedWithMedia] {
    452452        if (m_fullscreenModel)
    453             m_fullscreenModel->requestFullscreenMode(mode);
     453            m_fullscreenModel->requestFullscreenMode(mode, finishedWithMedia);
    454454    });
    455455}
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm

    r205365 r209747  
    983983        webPlaybackSessionModel()->pause();
    984984   
    985 
    986     m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone);
     985    m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone, reason == ExitFullScreenReason::DoneButtonTapped);
    987986
    988987    if (!m_watchdogTimer.isActive())
  • trunk/Source/WebKit2/ChangeLog

    r209736 r209747  
     12016-12-12  Dean Jackson  <dino@apple.com>
     2
     3        [iOS] MediaDocument "Done" button should navigate the page back
     4        https://bugs.webkit.org/show_bug.cgi?id=165779
     5
     6        Reviewed by Sam Weinig.
     7
     8        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
     9        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
     10        (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
     11        (WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
     12        * WebProcess/cocoa/WebVideoFullscreenManager.h:
     13        * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
     14        * WebProcess/cocoa/WebVideoFullscreenManager.mm:
     15        (WebKit::WebVideoFullscreenManager::requestFullscreenMode):
     16
    1172016-12-12  Tim Horton  <timothy_horton@apple.com>
    218
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h

    r205365 r209747  
    8080    void addClient(WebCore::WebVideoFullscreenModelClient&) override;
    8181    void removeClient(WebCore::WebVideoFullscreenModelClient&) override;
    82     void requestFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
     82    void requestFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false) override;
    8383    void setVideoLayerFrame(WebCore::FloatRect) override;
    8484    void setVideoLayerGravity(VideoGravity) override;
     
    148148
    149149    // Messages to WebVideoFullscreenManager
    150     void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
     150    void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false);
    151151    void didSetupFullscreen(uint64_t contextId);
    152152    void didExitFullscreen(uint64_t contextId);
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm

    r205592 r209747  
    137137}
    138138
    139 void WebVideoFullscreenModelContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
    140 {
    141     if (m_manager)
    142         m_manager->requestFullscreenMode(m_contextId, mode);
     139void WebVideoFullscreenModelContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
     140{
     141    if (m_manager)
     142        m_manager->requestFullscreenMode(m_contextId, mode, finishedWithMedia);
    143143}
    144144
     
    436436#pragma mark Messages to WebVideoFullscreenManager
    437437
    438 void WebVideoFullscreenManagerProxy::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
    439 {
    440     m_page->send(Messages::WebVideoFullscreenManager::RequestFullscreenMode(contextId, mode), m_page->pageID());
     438void WebVideoFullscreenManagerProxy::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
     439{
     440    m_page->send(Messages::WebVideoFullscreenManager::RequestFullscreenMode(contextId, mode, finishedWithMedia), m_page->pageID());
    441441}
    442442
  • trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h

    r205365 r209747  
    134134
    135135    // Messages from WebVideoFullscreenManagerProxy
    136     void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
     136    void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia);
    137137    void didSetupFullscreen(uint64_t contextId);
    138138    void didExitFullscreen(uint64_t contextId);
  • trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in

    r199919 r209747  
    2323#if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    2424messages -> WebVideoFullscreenManager {
    25     RequestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
     25    RequestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool finishedWithMedia)
    2626    DidSetupFullscreen(uint64_t contextId)
    2727    DidExitFullscreen(uint64_t contextId)
  • trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm

    r205365 r209747  
    292292#pragma mark Messages from WebVideoFullscreenManagerProxy:
    293293
    294 void WebVideoFullscreenManager::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
    295 {
    296     ensureModel(contextId).requestFullscreenMode(mode);
     294void WebVideoFullscreenManager::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
     295{
     296    ensureModel(contextId).requestFullscreenMode(mode, finishedWithMedia);
    297297}
    298298
Note: See TracChangeset for help on using the changeset viewer.