Title: [196964] trunk/Source
Revision
196964
Author
[email protected]
Date
2016-02-22 16:40:16 -0800 (Mon, 22 Feb 2016)

Log Message

Implement basic functionality in WebVideoFullscreenInterfaceMac.
https://bugs.webkit.org/show_bug.cgi?id=153241

Reviewed by Beth Dakin.

Source/WebCore:

* platform/cocoa/WebVideoFullscreenInterface.h:
* platform/mac/WebVideoFullscreenInterfaceMac.h:
* platform/mac/WebVideoFullscreenInterfaceMac.mm:
(WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::cleanupFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::invalidate):
(WebCore::WebVideoFullscreenInterfaceMac::preparedToReturnToInline):

Source/WebKit2:

* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
(WebKit::WebVideoFullscreenManagerProxy::exitFullscreen):
(WebKit::WebVideoFullscreenManagerProxy::preparedToReturnToInline):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::rootViewToWindow):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::rootViewToWindow):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::supportsVideoFullscreen):
* WebProcess/cocoa/WebVideoFullscreenManager.h:
* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::supportsVideoFullscreen):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (196963 => 196964)


--- trunk/Source/WebCore/ChangeLog	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebCore/ChangeLog	2016-02-23 00:40:16 UTC (rev 196964)
@@ -1,3 +1,20 @@
+2016-02-16  Ada Chan  <[email protected]>
+
+        Implement basic functionality in WebVideoFullscreenInterfaceMac.
+        https://bugs.webkit.org/show_bug.cgi?id=153241
+
+        Reviewed by Beth Dakin.
+
+        * platform/cocoa/WebVideoFullscreenInterface.h:
+        * platform/mac/WebVideoFullscreenInterfaceMac.h:
+        * platform/mac/WebVideoFullscreenInterfaceMac.mm:
+        (WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::cleanupFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::invalidate):
+        (WebCore::WebVideoFullscreenInterfaceMac::preparedToReturnToInline):
+
 2016-02-22  Chris Dumez  <[email protected]>
 
         REGRESSION (r196563): Images not loading on https://klim.co.nz/blog/paypal-sans-design-information/

Modified: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenInterface.h (196963 => 196964)


--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenInterface.h	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenInterface.h	2016-02-23 00:40:16 UTC (rev 196964)
@@ -36,7 +36,7 @@
 
 namespace WebCore {
 
-bool supportsPictureInPicture();
+WEBCORE_EXPORT bool supportsPictureInPicture();
 
 class TimeRanges;
 

Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h (196963 => 196964)


--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h	2016-02-23 00:40:16 UTC (rev 196964)
@@ -34,6 +34,12 @@
 #include <wtf/RetainPtr.h>
 #include <wtf/text/WTFString.h>
 
+OBJC_CLASS NSWindow;
+
+#if USE(APPLE_INTERNAL_SDK)
+OBJC_CLASS WebVideoFullscreenInterfaceMacObjC;
+#endif
+
 namespace WebCore {
 class IntRect;
 class WebVideoFullscreenChangeObserver;
@@ -49,7 +55,9 @@
         return adoptRef(*new WebVideoFullscreenInterfaceMac());
     }
     virtual ~WebVideoFullscreenInterfaceMac();
+    WebVideoFullscreenModel* webVideoFullscreenModel() const { return m_videoFullscreenModel; }
     WEBCORE_EXPORT void setWebVideoFullscreenModel(WebVideoFullscreenModel*);
+    WebVideoFullscreenChangeObserver* webVideoFullscreenChangeObserver() const { return m_fullscreenChangeObserver; }
     WEBCORE_EXPORT void setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver*);
 
     WEBCORE_EXPORT void resetMediaState() override { }
@@ -65,13 +73,13 @@
     WEBCORE_EXPORT void setExternalPlayback(bool /*enabled*/, ExternalPlaybackTargetType, WTF::String /*localizedDeviceName*/) override { }
     WEBCORE_EXPORT void setWirelessVideoPlaybackDisabled(bool) override { }
 
-    WEBCORE_EXPORT void setupFullscreen(NSView& /*layerHostedView*/, const IntRect& /*initialRect*/, HTMLMediaElementEnums::VideoFullscreenMode, bool /*allowsPictureInPicturePlayback*/) { }
-    WEBCORE_EXPORT void enterFullscreen() { }
-    WEBCORE_EXPORT void exitFullscreen(const IntRect& /*finalRect*/) { }
-    WEBCORE_EXPORT void cleanupFullscreen() { }
-    WEBCORE_EXPORT void invalidate() { }
+    WEBCORE_EXPORT void setupFullscreen(NSView& layerHostedView, const IntRect& initialRect, NSWindow *parentWindow, HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicturePlayback);
+    WEBCORE_EXPORT void enterFullscreen();
+    WEBCORE_EXPORT void exitFullscreen(const IntRect& finalRect, NSWindow *parentWindow);
+    WEBCORE_EXPORT void cleanupFullscreen();
+    WEBCORE_EXPORT void invalidate();
     WEBCORE_EXPORT void requestHideAndExitFullscreen() { }
-    WEBCORE_EXPORT void preparedToReturnToInline(bool /*visible*/, const IntRect& /*inlineRect*/) { }
+    WEBCORE_EXPORT void preparedToReturnToInline(bool visible, const IntRect& inlineRect, NSWindow *parentWindow);
 
     HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_mode; }
     bool hasMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const { return m_mode & mode; }
@@ -82,10 +90,14 @@
     WEBCORE_EXPORT bool mayAutomaticallyShowVideoPictureInPicture() const { return false; }
     void applicationDidBecomeActive() { }
 
-protected:
+private:
     WebVideoFullscreenModel* m_videoFullscreenModel { nullptr };
     WebVideoFullscreenChangeObserver* m_fullscreenChangeObserver { nullptr };
     HTMLMediaElementEnums::VideoFullscreenMode m_mode { HTMLMediaElementEnums::VideoFullscreenModeNone };
+
+#if USE(APPLE_INTERNAL_SDK)
+    RetainPtr<WebVideoFullscreenInterfaceMacObjC> m_webVideoFullscreenInterfaceObjC;
+#endif
 };
 
 }

Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm (196963 => 196964)


--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm	2016-02-23 00:40:16 UTC (rev 196964)
@@ -32,6 +32,10 @@
 #import "WebVideoFullscreenChangeObserver.h"
 #import "WebVideoFullscreenModel.h"
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/WebVideoFullscreenInterfaceMacAdditions.mm>
+#endif
+
 namespace WebCore {
 
 WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac()
@@ -70,10 +74,36 @@
         m_videoFullscreenModel->fullscreenModeChanged(m_mode);
 }
 
+#if !USE(APPLE_INTERNAL_SDK)
+void WebVideoFullscreenInterfaceMac::setupFullscreen(NSView&, const IntRect&, NSWindow *, HTMLMediaElementEnums::VideoFullscreenMode, bool)
+{
+}
+
+void WebVideoFullscreenInterfaceMac::enterFullscreen()
+{
+}
+
+void WebVideoFullscreenInterfaceMac::exitFullscreen(const IntRect&, NSWindow *)
+{
+}
+
+void WebVideoFullscreenInterfaceMac::cleanupFullscreen()
+{
+}
+
+void WebVideoFullscreenInterfaceMac::invalidate()
+{
+}
+
+void WebVideoFullscreenInterfaceMac::preparedToReturnToInline(bool, const IntRect&, NSWindow *)
+{
+}
+
 bool supportsPictureInPicture()
 {
     return false;
 }
+#endif
 
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (196963 => 196964)


--- trunk/Source/WebKit2/ChangeLog	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/ChangeLog	2016-02-23 00:40:16 UTC (rev 196964)
@@ -1,3 +1,27 @@
+2016-02-16  Ada Chan  <[email protected]>
+
+        Implement basic functionality in WebVideoFullscreenInterfaceMac.
+        https://bugs.webkit.org/show_bug.cgi?id=153241
+
+        Reviewed by Beth Dakin.
+
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
+        (WebKit::WebVideoFullscreenManagerProxy::exitFullscreen):
+        (WebKit::WebVideoFullscreenManagerProxy::preparedToReturnToInline):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::rootViewToWindow):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::rootViewToWindow):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::supportsVideoFullscreen):
+        * WebProcess/cocoa/WebVideoFullscreenManager.h:
+        * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+        (WebKit::WebVideoFullscreenManager::supportsVideoFullscreen):
+
 2016-02-22  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r196935.

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (196963 => 196964)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm	2016-02-23 00:40:16 UTC (rev 196964)
@@ -368,7 +368,9 @@
     UIView *parentView = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_page->drawingArea()).remoteLayerTreeHost().rootLayer();
     interface->setupFullscreen(*model->layerHostView(), initialRect, parentView, videoFullscreenMode, allowsPictureInPicture);
 #else
-    interface->setupFullscreen(*model->layerHostView(), initialRect, videoFullscreenMode, allowsPictureInPicture);
+    IntRect initialWindowRect;
+    m_page->rootViewToWindow(initialRect, initialWindowRect);
+    interface->setupFullscreen(*model->layerHostView(), initialWindowRect, m_page->platformWindow(), videoFullscreenMode, allowsPictureInPicture);
 #endif
 }
 
@@ -462,7 +464,13 @@
 
 void WebVideoFullscreenManagerProxy::exitFullscreen(uint64_t contextId, WebCore::IntRect finalRect)
 {
+#if PLATFORM(IOS)
     ensureInterface(contextId).exitFullscreen(finalRect);
+#else
+    IntRect finalWindowRect;
+    m_page->rootViewToWindow(finalRect, finalWindowRect);
+    ensureInterface(contextId).exitFullscreen(finalWindowRect, m_page->platformWindow());
+#endif
 }
 
 void WebVideoFullscreenManagerProxy::cleanupFullscreen(uint64_t contextId)
@@ -474,7 +482,13 @@
 {
     m_page->fullscreenMayReturnToInline();
 
+#if PLATFORM(IOS)
     ensureInterface(contextId).preparedToReturnToInline(visible, inlineRect);
+#else
+    IntRect inlineWindowRect;
+    m_page->rootViewToWindow(inlineRect, inlineWindowRect);
+    ensureInterface(contextId).preparedToReturnToInline(visible, inlineWindowRect, m_page->platformWindow());
+#endif
 }
 
 #pragma mark Messages to WebVideoFullscreenManager

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (196963 => 196964)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2016-02-23 00:40:16 UTC (rev 196964)
@@ -209,6 +209,9 @@
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0;
     virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) = 0;
     virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) = 0;
+#if PLATFORM(MAC)
+    virtual WebCore::IntRect rootViewToWindow(const WebCore::IntRect&) = 0;
+#endif
 #if PLATFORM(IOS)
     virtual WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) = 0;
     virtual WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) = 0;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (196963 => 196964)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-02-23 00:40:16 UTC (rev 196964)
@@ -581,6 +581,7 @@
 
     void startWindowDrag();
     NSWindow *platformWindow();
+    void rootViewToWindow(const WebCore::IntRect& viewRect, WebCore::IntRect& windowRect);
 
 #if WK_API_ENABLED
     NSView *inspectorAttachmentView();

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (196963 => 196964)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2016-02-23 00:40:16 UTC (rev 196964)
@@ -113,6 +113,9 @@
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override;
     virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override;
     virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override;
+#if PLATFORM(MAC)
+    virtual WebCore::IntRect rootViewToWindow(const WebCore::IntRect&) override;
+#endif
 #if PLATFORM(IOS)
     virtual WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) = 0;
     virtual WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) = 0;

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (196963 => 196964)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2016-02-23 00:40:16 UTC (rev 196964)
@@ -421,6 +421,15 @@
     return enclosingIntRect(tempRect);
 }
 
+#if PLATFORM(MAC)
+IntRect PageClientImpl::rootViewToWindow(const WebCore::IntRect& rect)
+{
+    NSRect tempRect = rect;
+    tempRect = [m_view convertRect:tempRect toView:nil];
+    return enclosingIntRect(tempRect);
+}
+#endif
+
 void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled)
 {
     m_impl->doneWithKeyEvent(event.nativeEvent(), eventWasHandled);

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (196963 => 196964)


--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2016-02-23 00:40:16 UTC (rev 196964)
@@ -584,6 +584,11 @@
     return m_pageClient.platformWindow();
 }
 
+void WebPageProxy::rootViewToWindow(const WebCore::IntRect& viewRect, WebCore::IntRect& windowRect)
+{
+    windowRect = m_pageClient.rootViewToWindow(viewRect);
+}
+
 #if WK_API_ENABLED
 NSView *WebPageProxy::inspectorAttachmentView()
 {

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (196963 => 196964)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2016-02-23 00:40:16 UTC (rev 196964)
@@ -850,9 +850,9 @@
 #endif
 
 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
-bool WebChromeClient::supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode)
+bool WebChromeClient::supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
 {
-    return m_page->videoFullscreenManager()->supportsVideoFullscreen();
+    return m_page->videoFullscreenManager()->supportsVideoFullscreen(mode);
 }
 
 void WebChromeClient::enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h (196963 => 196964)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h	2016-02-23 00:40:16 UTC (rev 196964)
@@ -113,7 +113,7 @@
     void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
 
     // Interface to ChromeClient
-    bool supportsVideoFullscreen() const;
+    bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) const;
     void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
     void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&);
     

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (196963 => 196964)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm	2016-02-23 00:03:54 UTC (rev 196963)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm	2016-02-23 00:40:16 UTC (rev 196964)
@@ -217,12 +217,14 @@
 
 #pragma mark Interface to ChromeClient:
 
-bool WebVideoFullscreenManager::supportsVideoFullscreen() const
+bool WebVideoFullscreenManager::supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode) const
 {
 #if PLATFORM(IOS)
+    UNUSED_PARAM(mode);
     return Settings::avKitEnabled();
+#elif USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WebVideoFullscreenManagerSupportsVideoFullscreenMac.mm>
 #else
-    // FIXME 153241: Return false until more of WebVideoFullscreenInterfaceMac has been implemented.
     return false;
 #endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to