Get WebVideoFullscreenManager and related classes to also compile for Mac platform
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jan 2016 18:28:16 +0000 (18:28 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jan 2016 18:28:16 +0000 (18:28 +0000)
with video presentation mode support.
https://bugs.webkit.org/show_bug.cgi?id=153221

Reviewed by Eric Carlson.

Source/WebCore:

No new tests, no actual behavior change with a stub implementation of WebVideoFullscreenInterfaceMac.

* WebCore.xcodeproj/project.pbxproj:
Add PlatformView.h, WebVideoFullscreenChangeObserver.h, and WebVideoFullscreenInterfaceMac.h.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::mediaPlayerEngineUpdated):
(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction):
* html/HTMLMediaElement.h:
Enable the code that deals with the video fullscreen layer also for Mac platform with
video presentation mode support.

* platform/cocoa/PlatformView.h:
Header file for declaring the view types for each Cocoa platform.

* platform/cocoa/WebVideoFullscreenChangeObserver.h:
(WebCore::WebVideoFullscreenChangeObserver::~WebVideoFullscreenChangeObserver):
Interface declaration moved from WebVideoFullscreenInterfaceAVKit.h.

* platform/cocoa/WebVideoFullscreenInterface.h:
Stop guarding the declaration of WebVideoFullscreenInterface to be iOS specific. It is now
enabled for iOS and Mac platform with video presentation mode support.

* platform/cocoa/WebVideoFullscreenModel.h:
* platform/cocoa/WebVideoFullscreenModelVideoElement.h:
* platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
Enable also for Mac platform with video presentation mode support.
(WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
Set the video fullscreen layer's anchor point to (0, 0) since we are not changing the position of
the video layer on Mac.

* platform/ios/WebVideoFullscreenControllerAVKit.mm:
Import WebVideoFullscreenChangeObserver.h now that the interface declaration has been moved to that file.
* platform/ios/WebVideoFullscreenInterfaceAVKit.h:
Move the declaration of WebVideoFullscreenChangeObserver to a separate header.
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
Import WebVideoFullscreenChangeObserver.h now that the interface declaration has been moved to that file.

* platform/mac/WebVideoFullscreenInterfaceMac.h: Added.
* platform/mac/WebVideoFullscreenInterfaceMac.mm:
(WebCore::WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac):
(WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel):
(WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenChangeObserver):
(WebCore::WebVideoFullscreenInterfaceMac::resetMediaState):
(WebCore::WebVideoFullscreenInterfaceMac::setDuration):
(WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime):
(WebCore::WebVideoFullscreenInterfaceMac::setBufferedTime):
(WebCore::WebVideoFullscreenInterfaceMac::setRate):
(WebCore::WebVideoFullscreenInterfaceMac::setVideoDimensions):
(WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges):
(WebCore::WebVideoFullscreenInterfaceMac::setCanPlayFastReverse):
(WebCore::WebVideoFullscreenInterfaceMac::setAudioMediaSelectionOptions):
(WebCore::WebVideoFullscreenInterfaceMac::setLegibleMediaSelectionOptions):
(WebCore::WebVideoFullscreenInterfaceMac::setExternalPlayback):
(WebCore::WebVideoFullscreenInterfaceMac::setWirelessVideoPlaybackDisabled):
(WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::cleanupFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::invalidate):
(WebCore::WebVideoFullscreenInterfaceMac::requestHideAndExitFullscreen):
(WebCore::WebVideoFullscreenInterfaceMac::preparedToReturnToInline):
(WebCore::WebVideoFullscreenInterfaceMac::setMode):
(WebCore::WebVideoFullscreenInterfaceMac::clearMode):
(WebCore::WebVideoFullscreenInterfaceMac::mayAutomaticallyShowVideoPictureInPicture):
(WebCore::WebVideoFullscreenInterfaceMac::applicationDidBecomeActive):
(WebCore::supportsPictureInPicture):
Add a stub implementation of WebVideoFullscreenInterfaceMac.

Source/WebKit2:

* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
Enabled also for Mac with video presentation mode support.
(-[WKLayerHostView makeBackingLayer]):
Make sure this view uses CALayerHost for its layer.
(WebKit::WebVideoFullscreenManagerProxy::invalidate):
(WebKit::WebVideoFullscreenManagerProxy::createModelAndInterface):
(WebKit::WebVideoFullscreenManagerProxy::ensureInterface):
(WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
Replace WebCore::WebVideoFullscreenInterfaceAVKit with PlatformWebVideoFullscreenInterface.
(WebKit::WebVideoFullscreenManagerProxy::setVideoLayerFrame):
+[UIWindow _synchronizeDrawingAcrossProcesses] is not available on Mac.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::reattachToWebProcess):
(WebKit::WebPageProxy::viewDidLeaveWindow):
(WebKit::WebPageProxy::resetState):
* UIProcess/WebPageProxy.h:
The code that creates m_videoFullscreenManager is now enabled also on Mac with video
presentation mode support.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.h:
Enable the API related to the video fullscreen layer also on Mac with video presentation
mode support.

* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
The code that creates m_videoFullscreenManager is now enabled also on Mac with video
presentation mode support.

* WebProcess/cocoa/WebVideoFullscreenManager.h:
* WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
* WebProcess/cocoa/WebVideoFullscreenManager.mm:
Enabled also for Mac with video presentation mode support.
(WebKit::WebVideoFullscreenManager::supportsVideoFullscreen):
Return false for now on Mac.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195755 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/platform/cocoa/PlatformView.h [new file with mode: 0644]
Source/WebCore/platform/cocoa/WebVideoFullscreenChangeObserver.h [new file with mode: 0644]
Source/WebCore/platform/cocoa/WebVideoFullscreenInterface.h
Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h
Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h
Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm
Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h
Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm
Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h [new file with mode: 0644]
Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h
Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in
Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h
Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in
Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm

index 75b2e91..88fdd63 100644 (file)
@@ -1,3 +1,81 @@
+2016-01-26  Ada Chan  <adachan@apple.com>
+
+        Get WebVideoFullscreenManager and related classes to also compile for Mac platform
+        with video presentation mode support.
+        https://bugs.webkit.org/show_bug.cgi?id=153221
+
+        Reviewed by Eric Carlson.
+
+        No new tests, no actual behavior change with a stub implementation of WebVideoFullscreenInterfaceMac.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Add PlatformView.h, WebVideoFullscreenChangeObserver.h, and WebVideoFullscreenInterfaceMac.h.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement):
+        (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated):
+        (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction):
+        * html/HTMLMediaElement.h:
+        Enable the code that deals with the video fullscreen layer also for Mac platform with
+        video presentation mode support.
+
+        * platform/cocoa/PlatformView.h:
+        Header file for declaring the view types for each Cocoa platform.
+
+        * platform/cocoa/WebVideoFullscreenChangeObserver.h:
+        (WebCore::WebVideoFullscreenChangeObserver::~WebVideoFullscreenChangeObserver):
+        Interface declaration moved from WebVideoFullscreenInterfaceAVKit.h.
+
+        * platform/cocoa/WebVideoFullscreenInterface.h:
+        Stop guarding the declaration of WebVideoFullscreenInterface to be iOS specific. It is now
+        enabled for iOS and Mac platform with video presentation mode support.
+
+        * platform/cocoa/WebVideoFullscreenModel.h:
+        * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
+        * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
+        Enable also for Mac platform with video presentation mode support.
+        (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
+        Set the video fullscreen layer's anchor point to (0, 0) since we are not changing the position of
+        the video layer on Mac.
+
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        Import WebVideoFullscreenChangeObserver.h now that the interface declaration has been moved to that file.
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
+        Move the declaration of WebVideoFullscreenChangeObserver to a separate header.
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        Import WebVideoFullscreenChangeObserver.h now that the interface declaration has been moved to that file.
+
+        * platform/mac/WebVideoFullscreenInterfaceMac.h: Added.
+        * platform/mac/WebVideoFullscreenInterfaceMac.mm:
+        (WebCore::WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac):
+        (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel):
+        (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenChangeObserver):
+        (WebCore::WebVideoFullscreenInterfaceMac::resetMediaState):
+        (WebCore::WebVideoFullscreenInterfaceMac::setDuration):
+        (WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime):
+        (WebCore::WebVideoFullscreenInterfaceMac::setBufferedTime):
+        (WebCore::WebVideoFullscreenInterfaceMac::setRate):
+        (WebCore::WebVideoFullscreenInterfaceMac::setVideoDimensions):
+        (WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges):
+        (WebCore::WebVideoFullscreenInterfaceMac::setCanPlayFastReverse):
+        (WebCore::WebVideoFullscreenInterfaceMac::setAudioMediaSelectionOptions):
+        (WebCore::WebVideoFullscreenInterfaceMac::setLegibleMediaSelectionOptions):
+        (WebCore::WebVideoFullscreenInterfaceMac::setExternalPlayback):
+        (WebCore::WebVideoFullscreenInterfaceMac::setWirelessVideoPlaybackDisabled):
+        (WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::cleanupFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::invalidate):
+        (WebCore::WebVideoFullscreenInterfaceMac::requestHideAndExitFullscreen):
+        (WebCore::WebVideoFullscreenInterfaceMac::preparedToReturnToInline):
+        (WebCore::WebVideoFullscreenInterfaceMac::setMode):
+        (WebCore::WebVideoFullscreenInterfaceMac::clearMode):
+        (WebCore::WebVideoFullscreenInterfaceMac::mayAutomaticallyShowVideoPictureInPicture):
+        (WebCore::WebVideoFullscreenInterfaceMac::applicationDidBecomeActive):
+        (WebCore::supportsPictureInPicture):
+        Add a stub implementation of WebVideoFullscreenInterfaceMac.
+
 2016-01-28  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
 
         [SVG] Add support for 'lighter' operator in feComposite
index 117cb36..4ace5cf 100644 (file)
                52131E5B1C4F15760033F802 /* WebVideoFullscreenInterfaceMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52131E5A1C4F15610033F802 /* WebVideoFullscreenInterfaceMac.mm */; };
                521D46F611AEC98100514613 /* KillRingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 521D46F511AEC98100514613 /* KillRingMac.mm */; };
                521D46F811AEC9B100514613 /* KillRing.h in Headers */ = {isa = PBXBuildFile; fileRef = 521D46F711AEC9B100514613 /* KillRing.h */; };
+               52B0D4BE1C57FD1E0077CE53 /* PlatformView.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               52B0D4C01C57FD660077CE53 /* WebVideoFullscreenChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4BF1C57FD660077CE53 /* WebVideoFullscreenChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               52B0D4C21C57FF910077CE53 /* WebVideoFullscreenInterfaceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4C11C57FF910077CE53 /* WebVideoFullscreenInterfaceMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                52B6C9C215E3F4DF00690B05 /* DOMNamedFlowCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52B6C9BD15E3F4DF00690B05 /* DOMNamedFlowCollection.cpp */; };
                52B6C9C315E3F4DF00690B05 /* DOMNamedFlowCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B6C9BE15E3F4DF00690B05 /* DOMNamedFlowCollection.h */; };
                52B6C9C515E3F4DF00690B05 /* NamedFlowCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52B6C9C015E3F4DF00690B05 /* NamedFlowCollection.cpp */; };
                52131E5A1C4F15610033F802 /* WebVideoFullscreenInterfaceMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenInterfaceMac.mm; sourceTree = "<group>"; };
                521D46F511AEC98100514613 /* KillRingMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KillRingMac.mm; sourceTree = "<group>"; };
                521D46F711AEC9B100514613 /* KillRing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KillRing.h; sourceTree = "<group>"; };
+               52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformView.h; sourceTree = "<group>"; };
+               52B0D4BF1C57FD660077CE53 /* WebVideoFullscreenChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenChangeObserver.h; sourceTree = "<group>"; };
+               52B0D4C11C57FF910077CE53 /* WebVideoFullscreenInterfaceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenInterfaceMac.h; sourceTree = "<group>"; };
                52B6C9BD15E3F4DF00690B05 /* DOMNamedFlowCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMNamedFlowCollection.cpp; sourceTree = "<group>"; };
                52B6C9BE15E3F4DF00690B05 /* DOMNamedFlowCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMNamedFlowCollection.h; sourceTree = "<group>"; };
                52B6C9BF15E3F4DF00690B05 /* DOMNamedFlowCollection.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMNamedFlowCollection.idl; sourceTree = "<group>"; };
                                CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */,
                                CD8203081395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h */,
                                CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */,
+                               52B0D4C11C57FF910077CE53 /* WebVideoFullscreenInterfaceMac.h */,
                                52131E5A1C4F15610033F802 /* WebVideoFullscreenInterfaceMac.mm */,
                                CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */,
                                CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */,
                                A19D93481AA11B1E00B46C24 /* NetworkExtensionContentFilter.mm */,
                                A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */,
                                A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */,
+                               52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */,
                                1AA84F03143BA7BD0051D153 /* ScrollController.h */,
                                1AA84F02143BA7BD0051D153 /* ScrollController.mm */,
                                F478755219983AFF0024A287 /* ScrollSnapAnimatorState.h */,
                                CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */,
                                CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */,
                                1A7E19441C5863BE00CCDDF3 /* WebKitAdditions.mm */,
+                               52B0D4BF1C57FD660077CE53 /* WebVideoFullscreenChangeObserver.h */,
                                52131E581C4F15220033F802 /* WebVideoFullscreenInterface.h */,
                                52D5A1A41C57488900DE34A3 /* WebVideoFullscreenModel.h */,
                                52D5A1A51C57488900DE34A3 /* WebVideoFullscreenModelVideoElement.h */,
                                1AD8F81B11CAB9E900E93E54 /* PlatformStrategies.h in Headers */,
                                0F7D07331884C56C00B4AF86 /* PlatformTextTrack.h in Headers */,
                                074E82BB18A69F0E007EF54C /* PlatformTimeRanges.h in Headers */,
+                               52B0D4BE1C57FD1E0077CE53 /* PlatformView.h in Headers */,
                                935C476B09AC4D4F00A6AAB4 /* PlatformWheelEvent.h in Headers */,
                                31D591B316697A6C00E6BF02 /* PlugInClient.h in Headers */,
                                A9C6E4F40D745E48006442E9 /* PluginData.h in Headers */,
                                97AABD2714FA09D5007457AE /* WebSocketHandshake.h in Headers */,
                                31DEA4561B39F4D900F77178 /* WebSystemBackdropLayer.h in Headers */,
                                0F580FA31496939100FB5BD8 /* WebTiledBackingLayer.h in Headers */,
+                               52B0D4C01C57FD660077CE53 /* WebVideoFullscreenChangeObserver.h in Headers */,
                                CD82030A1395AB6A00F956C6 /* WebVideoFullscreenController.h in Headers */,
                                3F42B31D1881191B00278AAC /* WebVideoFullscreenControllerAVKit.h in Headers */,
                                CD82030C1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h in Headers */,
                                52131E591C4F15350033F802 /* WebVideoFullscreenInterface.h in Headers */,
                                3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */,
+                               52B0D4C21C57FF910077CE53 /* WebVideoFullscreenInterfaceMac.h in Headers */,
                                52D5A1A71C57489D00DE34A3 /* WebVideoFullscreenModel.h in Headers */,
                                52D5A1A81C5748A300DE34A3 /* WebVideoFullscreenModelVideoElement.h in Headers */,
                                F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */,
index 56ef2bd..0c9e97f 100644 (file)
 #include "MediaElementAudioSourceNode.h"
 #endif
 
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+#include "WebVideoFullscreenInterface.h"
+#endif
+
 #if PLATFORM(IOS)
 #include "RuntimeApplicationChecksIOS.h"
 #include "WebVideoFullscreenInterfaceAVKit.h"
@@ -336,7 +340,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
     , m_lastTimeUpdateEventMovieTime(MediaTime::positiveInfiniteTime())
     , m_loadState(WaitingForSource)
     , m_videoFullscreenMode(VideoFullscreenModeNone)
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     , m_videoFullscreenGravity(MediaPlayer::VideoGravityResizeAspect)
 #endif
     , m_preload(MediaPlayer::Auto)
@@ -4546,7 +4550,7 @@ void HTMLMediaElement::mediaPlayerEngineUpdated(MediaPlayer*)
     }
 #endif
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     if (!m_player)
         return;
     m_player->setVideoFullscreenFrame(m_videoFullscreenFrame);
@@ -5364,7 +5368,7 @@ PlatformLayer* HTMLMediaElement::platformLayer() const
     return m_player ? m_player->platformLayer() : nullptr;
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 void HTMLMediaElement::setVideoFullscreenLayer(PlatformLayer* platformLayer)
 {
     m_videoFullscreenLayer = platformLayer;
@@ -6556,7 +6560,7 @@ bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMedia
 #endif
     if (m_videoFullscreenMode & VideoFullscreenModePictureInPicture)
         return true;
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     if (m_videoFullscreenMode == VideoFullscreenModeStandard && supportsPictureInPicture() && isPlaying())
         return true;
 #endif
index 4695954..c8ba36b 100644 (file)
@@ -130,7 +130,7 @@ public:
 
     WEBCORE_EXPORT PlatformMedia platformMedia() const;
     PlatformLayer* platformLayer() const;
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     void setVideoFullscreenLayer(PlatformLayer*);
     PlatformLayer* videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); }
     void setVideoFullscreenFrame(FloatRect);
@@ -821,7 +821,7 @@ private:
     RefPtr<Node> m_nextChildNodeToConsider;
 
     VideoFullscreenMode m_videoFullscreenMode;
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     RetainPtr<PlatformLayer> m_videoFullscreenLayer;
     FloatRect m_videoFullscreenFrame;
     MediaPlayerEnums::VideoGravity m_videoFullscreenGravity;
diff --git a/Source/WebCore/platform/cocoa/PlatformView.h b/Source/WebCore/platform/cocoa/PlatformView.h
new file mode 100644 (file)
index 0000000..888d71e
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformView_h
+#define PlatformView_h
+
+#if PLATFORM(COCOA)
+
+#if PLATFORM(IOS)
+OBJC_CLASS UIView;
+typedef UIView PlatformView;
+#else
+OBJC_CLASS NSView;
+typedef NSView PlatformView;
+#endif
+
+#endif
+
+#endif /* PlatformView_h */
diff --git a/Source/WebCore/platform/cocoa/WebVideoFullscreenChangeObserver.h b/Source/WebCore/platform/cocoa/WebVideoFullscreenChangeObserver.h
new file mode 100644 (file)
index 0000000..39075c7
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef WebVideoFullscreenChangeObserver_h
+#define WebVideoFullscreenChangeObserver_h
+
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+
+namespace WebCore {
+
+class WebVideoFullscreenChangeObserver {
+public:
+    virtual ~WebVideoFullscreenChangeObserver() { };
+    virtual void didSetupFullscreen() = 0;
+    virtual void didEnterFullscreen() = 0;
+    virtual void didExitFullscreen() = 0;
+    virtual void didCleanupFullscreen() = 0;
+    virtual void fullscreenMayReturnToInline() = 0;
+};
+
+}
+
+#endif
+
+#endif
index 90a58ee..d9112df 100644 (file)
@@ -38,7 +38,6 @@ namespace WebCore {
 
 bool supportsPictureInPicture();
 
-#if PLATFORM(IOS)
 class TimeRanges;
 
 class WebVideoFullscreenInterface {
@@ -59,7 +58,6 @@ public:
     virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) = 0;
     virtual void setWirelessVideoPlaybackDisabled(bool) = 0;
 };
-#endif
 
 }
 
index f9a58fd..be61630 100644 (file)
 #ifndef WebVideoFullscreenModel_h
 #define WebVideoFullscreenModel_h
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 
 #include <WebCore/FloatRect.h>
+#include <WebCore/HTMLMediaElementEnums.h>
 
 namespace WebCore {
 
index 69302e6..501e4de 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef WebVideoFullscreenModelVideoElement_h
 #define WebVideoFullscreenModelVideoElement_h
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 
 #include <WebCore/EventListener.h>
 #include <WebCore/FloatRect.h>
index e3ad3fb..6e9a357 100644 (file)
@@ -25,7 +25,7 @@
 
 #import "config.h"
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 #import "WebVideoFullscreenModelVideoElement.h"
 
 #import "DOMEventInternal.h"
@@ -44,7 +44,6 @@
 #import <WebCore/SoftLinking.h>
 #import <WebCore/TextTrackList.h>
 #import <WebCore/TimeRanges.h>
-#import <WebCore/WebCoreThreadRun.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/RetainPtr.h>
 
@@ -177,7 +176,11 @@ void WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer(PlatformLayer*
         return;
     
     m_videoFullscreenLayer = videoLayer;
+#if PLATFORM(MAC)
+    [m_videoFullscreenLayer setAnchorPoint:CGPointMake(0, 0)];
+#else
     [m_videoFullscreenLayer setAnchorPoint:CGPointMake(0.5, 0.5)];
+#endif
     [m_videoFullscreenLayer setBounds:m_videoFrame];
     
     if (m_videoElement)
index 1b01e30..c9d3897 100644 (file)
@@ -33,6 +33,7 @@
 #import "QuartzCoreSPI.h"
 #import "SoftLinking.h"
 #import "TimeRanges.h"
+#import "WebVideoFullscreenChangeObserver.h"
 #import "WebVideoFullscreenInterfaceAVKit.h"
 #import "WebVideoFullscreenModelVideoElement.h"
 #import <QuartzCore/CoreAnimation.h>
index afc1747..904f3ae 100644 (file)
@@ -56,17 +56,8 @@ class String;
 namespace WebCore {
 class IntRect;
 class WebVideoFullscreenModel;
+class WebVideoFullscreenChangeObserver;
     
-class WebVideoFullscreenChangeObserver {
-public:
-    virtual ~WebVideoFullscreenChangeObserver() { };
-    virtual void didSetupFullscreen() = 0;
-    virtual void didEnterFullscreen() = 0;
-    virtual void didExitFullscreen() = 0;
-    virtual void didCleanupFullscreen() = 0;
-    virtual void fullscreenMayReturnToInline() = 0;
-};
-
 class WEBCORE_EXPORT WebVideoFullscreenInterfaceAVKit
     : public WebVideoFullscreenInterface
     , public RefCounted<WebVideoFullscreenInterfaceAVKit> {
index 4b3b779..1d68dad 100644 (file)
@@ -38,6 +38,7 @@
 #import "RuntimeApplicationChecksIOS.h"
 #import "TimeRanges.h"
 #import "WebCoreSystemInterface.h"
+#import "WebVideoFullscreenChangeObserver.h"
 #import "WebVideoFullscreenModel.h"
 #import <AVFoundation/AVTime.h>
 #import <UIKit/UIKit.h>
diff --git a/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h b/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h
new file mode 100644 (file)
index 0000000..285807d
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebVideoFullscreenInterfaceMac_h
+#define WebVideoFullscreenInterfaceMac_h
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+
+#include <WebCore/HTMLMediaElementEnums.h>
+#include <WebCore/WebVideoFullscreenInterface.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+class IntRect;
+class WebVideoFullscreenChangeObserver;
+class WebVideoFullscreenModel;
+
+class WEBCORE_EXPORT WebVideoFullscreenInterfaceMac
+    : public WebVideoFullscreenInterface
+    , public RefCounted<WebVideoFullscreenInterfaceMac> {
+
+public:
+    static Ref<WebVideoFullscreenInterfaceMac> create()
+    {
+        return adoptRef(*new WebVideoFullscreenInterfaceMac());
+    }
+    virtual ~WebVideoFullscreenInterfaceMac();
+    WEBCORE_EXPORT void setWebVideoFullscreenModel(WebVideoFullscreenModel*);
+    WEBCORE_EXPORT void setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver*);
+
+    WEBCORE_EXPORT void resetMediaState() override { }
+    WEBCORE_EXPORT void setDuration(double) override { }
+    WEBCORE_EXPORT void setCurrentTime(double /*currentTime*/, double /*anchorTime*/) override { }
+    WEBCORE_EXPORT void setBufferedTime(double) override { }
+    WEBCORE_EXPORT void setRate(bool /*isPlaying*/, float /*playbackRate*/) override { }
+    WEBCORE_EXPORT void setVideoDimensions(bool /*hasVideo*/, float /*width*/, float /*height*/) override { }
+    WEBCORE_EXPORT void setSeekableRanges(const TimeRanges&) override { }
+    WEBCORE_EXPORT void setCanPlayFastReverse(bool) override { }
+    WEBCORE_EXPORT void setAudioMediaSelectionOptions(const Vector<WTF::String>& /*options*/, uint64_t /*selectedIndex*/) override { }
+    WEBCORE_EXPORT void setLegibleMediaSelectionOptions(const Vector<WTF::String>& /*options*/, uint64_t /*selectedIndex*/) override { }
+    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 requestHideAndExitFullscreen() { }
+    WEBCORE_EXPORT void preparedToReturnToInline(bool /*visible*/, const IntRect& /*inlineRect*/) { }
+
+    HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_mode; }
+    bool hasMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const { return m_mode & mode; }
+    bool isMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const { return m_mode == mode; }
+    void setMode(HTMLMediaElementEnums::VideoFullscreenMode);
+    void clearMode(HTMLMediaElementEnums::VideoFullscreenMode);
+
+    WEBCORE_EXPORT bool mayAutomaticallyShowVideoPictureInPicture() const { return false; }
+    void applicationDidBecomeActive() { }
+
+protected:
+    WebVideoFullscreenModel* m_videoFullscreenModel { nullptr };
+    WebVideoFullscreenChangeObserver* m_fullscreenChangeObserver { nullptr };
+    HTMLMediaElementEnums::VideoFullscreenMode m_mode { HTMLMediaElementEnums::VideoFullscreenModeNone };
+};
+
+}
+
+#endif
+
+#endif /* WebVideoFullscreenInterfaceMac_h */
index 080d418..d838f25 100644 (file)
  */
 
 #import "config.h"
-#import "WebVideoFullscreenInterface.h"
+#import "WebVideoFullscreenInterfaceMac.h"
 
 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
 
-bool WebCore::supportsPictureInPicture()
+#import "IntRect.h"
+#import "WebVideoFullscreenChangeObserver.h"
+#import "WebVideoFullscreenModel.h"
+
+namespace WebCore {
+
+WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac()
+{
+}
+
+void WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel(WebVideoFullscreenModel* model)
+{
+    m_videoFullscreenModel = model;
+}
+
+void WebVideoFullscreenInterfaceMac::setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver* observer)
+{
+    m_fullscreenChangeObserver = observer;
+}
+
+void WebVideoFullscreenInterfaceMac::setMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+    HTMLMediaElementEnums::VideoFullscreenMode newMode = m_mode | mode;
+    if (m_mode == newMode)
+        return;
+
+    m_mode = newMode;
+    if (m_videoFullscreenModel)
+        m_videoFullscreenModel->fullscreenModeChanged(m_mode);
+}
+
+void WebVideoFullscreenInterfaceMac::clearMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+    HTMLMediaElementEnums::VideoFullscreenMode newMode = m_mode & ~mode;
+    if (m_mode == newMode)
+        return;
+
+    m_mode = newMode;
+    if (m_videoFullscreenModel)
+        m_videoFullscreenModel->fullscreenModeChanged(m_mode);
+}
+
+bool supportsPictureInPicture()
 {
     return false;
 }
 
+}
+
 #endif
index 0edea49..8b110b6 100644 (file)
@@ -1,3 +1,51 @@
+2016-01-26  Ada Chan  <adachan@apple.com>
+
+        Get WebVideoFullscreenManager and related classes to also compile for Mac platform
+        with video presentation mode support.
+        https://bugs.webkit.org/show_bug.cgi?id=153221
+
+        Reviewed by Eric Carlson.
+
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+        Enabled also for Mac with video presentation mode support.
+        (-[WKLayerHostView makeBackingLayer]):
+        Make sure this view uses CALayerHost for its layer.
+        (WebKit::WebVideoFullscreenManagerProxy::invalidate):
+        (WebKit::WebVideoFullscreenManagerProxy::createModelAndInterface):
+        (WebKit::WebVideoFullscreenManagerProxy::ensureInterface):
+        (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
+        Replace WebCore::WebVideoFullscreenInterfaceAVKit with PlatformWebVideoFullscreenInterface.
+        (WebKit::WebVideoFullscreenManagerProxy::setVideoLayerFrame):
+        +[UIWindow _synchronizeDrawingAcrossProcesses] is not available on Mac.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::reattachToWebProcess):
+        (WebKit::WebPageProxy::viewDidLeaveWindow):
+        (WebKit::WebPageProxy::resetState):
+        * UIProcess/WebPageProxy.h:
+        The code that creates m_videoFullscreenManager is now enabled also on Mac with video
+        presentation mode support.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        Enable the API related to the video fullscreen layer also on Mac with video presentation
+        mode support.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/WebPage/WebPage.h:
+        The code that creates m_videoFullscreenManager is now enabled also on Mac with video
+        presentation mode support.
+
+        * WebProcess/cocoa/WebVideoFullscreenManager.h:
+        * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
+        * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+        Enabled also for Mac with video presentation mode support.
+        (WebKit::WebVideoFullscreenManager::supportsVideoFullscreen):
+        Return false for now on Mac.
+
 2016-01-28  Darin Adler  <darin@apple.com>
 
         Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
index a7bd86c..955fec8 100644 (file)
 #ifndef WebVideoFullscreenManagerProxy_h
 #define WebVideoFullscreenManagerProxy_h
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 
 #include "MessageReceiver.h"
 #include <WebCore/GraphicsLayer.h>
-#include <WebCore/WebVideoFullscreenInterfaceAVKit.h>
+#include <WebCore/PlatformView.h>
+#include <WebCore/WebVideoFullscreenChangeObserver.h>
 #include <WebCore/WebVideoFullscreenModel.h>
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
-OBJC_CLASS UIView;
+#if PLATFORM(IOS)
+#include <WebCore/WebVideoFullscreenInterfaceAVKit.h>
+#else
+#include <WebCore/WebVideoFullscreenInterfaceMac.h>
+#endif
+
+#if PLATFORM(IOS)
+typedef WebCore::WebVideoFullscreenInterfaceAVKit PlatformWebVideoFullscreenInterface;
+#else
+typedef WebCore::WebVideoFullscreenInterfaceMac PlatformWebVideoFullscreenInterface;
+#endif
 
 namespace WebKit {
 
@@ -54,8 +65,8 @@ public:
 
     void invalidate() { m_manager = nullptr; }
 
-    UIView *layerHostView() const { return m_layerHostView.get(); }
-    void setLayerHostView(RetainPtr<UIView>&& layerHostView) { m_layerHostView = WTFMove(layerHostView); }
+    PlatformView *layerHostView() const { return m_layerHostView.get(); }
+    void setLayerHostView(RetainPtr<PlatformView>&& layerHostView) { m_layerHostView = WTFMove(layerHostView); }
 
 private:
     WebVideoFullscreenModelContext(WebVideoFullscreenManagerProxy& manager, uint64_t contextId)
@@ -92,7 +103,7 @@ private:
 
     WebVideoFullscreenManagerProxy* m_manager;
     uint64_t m_contextId;
-    RetainPtr<UIView *> m_layerHostView;
+    RetainPtr<PlatformView *> m_layerHostView;
 };
 
 class WebVideoFullscreenManagerProxy : public RefCounted<WebVideoFullscreenManagerProxy>, private IPC::MessageReceiver {
@@ -114,11 +125,11 @@ private:
     explicit WebVideoFullscreenManagerProxy(WebPageProxy&);
     virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
 
-    typedef std::tuple<RefPtr<WebVideoFullscreenModelContext>, RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit>> ModelInterfaceTuple;
+    typedef std::tuple<RefPtr<WebVideoFullscreenModelContext>, RefPtr<PlatformWebVideoFullscreenInterface>> ModelInterfaceTuple;
     ModelInterfaceTuple createModelAndInterface(uint64_t contextId);
     ModelInterfaceTuple& ensureModelAndInterface(uint64_t contextId);
     WebVideoFullscreenModelContext& ensureModel(uint64_t contextId);
-    WebCore::WebVideoFullscreenInterfaceAVKit& ensureInterface(uint64_t contextId);
+    PlatformWebVideoFullscreenInterface& ensureInterface(uint64_t contextId);
 
     // Messages from WebVideoFullscreenManager
     void setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicture);
@@ -169,6 +180,6 @@ private:
     
 } // namespace WebKit
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 
 #endif // WebVideoFullscreenManagerProxy_h
index 7e447da..2ba2212 100644 (file)
@@ -20,7 +20,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 messages -> WebVideoFullscreenManagerProxy {
     ResetMediaState(uint64_t contextId)
     SetCurrentTime(uint64_t contextId, double currentTime, double hostTime)
index e526719..7b2c5b3 100644 (file)
 #import "config.h"
 #import "WebVideoFullscreenManagerProxy.h"
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 
-#import "RemoteLayerTreeDrawingAreaProxy.h"
-#import "UIKitSPI.h"
 #import "WebPageProxy.h"
 #import "WebProcessProxy.h"
 #import "WebVideoFullscreenManagerMessages.h"
 #import <WebCore/TimeRanges.h>
 #import <WebKitSystemInterface.h>
 
-@interface WKLayerHostView : UIView
+#if PLATFORM(IOS)
+#import "RemoteLayerTreeDrawingAreaProxy.h"
+#import "UIKitSPI.h"
+#endif
+
+@interface WKLayerHostView : PlatformView
 @property (nonatomic, assign) uint32_t contextID;
 @end
 
 @implementation WKLayerHostView
 
+#if PLATFORM(IOS)
 + (Class)layerClass {
     return [CALayerHost class];
 }
+#else
+- (CALayer *)makeBackingLayer
+{
+    return [[CALayerHost alloc] init];
+}
+#endif
 
 - (uint32_t)contextID {
     return [[self layerHost] contextId];
@@ -67,7 +77,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-#if !HAVE(AVKIT)
+#if PLATFORM(IOS) && !HAVE(AVKIT)
 
 RefPtr<WebVideoFullscreenManagerProxy> WebVideoFullscreenManagerProxy::create(WebPageProxy&)
 {
@@ -259,7 +269,7 @@ void WebVideoFullscreenManagerProxy::invalidate()
 
     for (auto& tuple : m_contextMap.values()) {
         RefPtr<WebVideoFullscreenModelContext> model;
-        RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit> interface;
+        RefPtr<PlatformWebVideoFullscreenInterface> interface;
         std::tie(model, interface) = tuple;
 
         interface->invalidate();
@@ -303,7 +313,7 @@ void WebVideoFullscreenManagerProxy::applicationDidBecomeActive()
 WebVideoFullscreenManagerProxy::ModelInterfaceTuple WebVideoFullscreenManagerProxy::createModelAndInterface(uint64_t contextId)
 {
     Ref<WebVideoFullscreenModelContext> model = WebVideoFullscreenModelContext::create(*this, contextId);
-    Ref<WebCore::WebVideoFullscreenInterfaceAVKit> interface = WebVideoFullscreenInterfaceAVKit::create();
+    Ref<PlatformWebVideoFullscreenInterface> interface = PlatformWebVideoFullscreenInterface::create();
 
     interface->setWebVideoFullscreenModel(&model.get());
     interface->setWebVideoFullscreenChangeObserver(&model.get());
@@ -324,7 +334,7 @@ WebVideoFullscreenModelContext& WebVideoFullscreenManagerProxy::ensureModel(uint
     return *std::get<0>(ensureModelAndInterface(contextId));
 }
 
-WebCore::WebVideoFullscreenInterfaceAVKit& WebVideoFullscreenManagerProxy::ensureInterface(uint64_t contextId)
+PlatformWebVideoFullscreenInterface& WebVideoFullscreenManagerProxy::ensureInterface(uint64_t contextId)
 {
     return *std::get<1>(ensureModelAndInterface(contextId));
 }
@@ -335,13 +345,16 @@ void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint64_t contextId, u
 {
     ASSERT(videoLayerID);
     RefPtr<WebVideoFullscreenModelContext> model;
-    RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit> interface;
+    RefPtr<PlatformWebVideoFullscreenInterface> interface;
 
     std::tie(model, interface) = ensureModelAndInterface(contextId);
 
     RetainPtr<WKLayerHostView> view = static_cast<WKLayerHostView*>(model->layerHostView());
     if (!view) {
         view = adoptNS([[WKLayerHostView alloc] init]);
+#if PLATFORM(MAC)
+        [view setWantsLayer:YES];
+#endif
         model->setLayerHostView(view);
     }
     [view setContextID:videoLayerID];
@@ -351,8 +364,12 @@ void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint64_t contextId, u
         [[view layer] setSublayerTransform:CATransform3DMakeScale(inverseScale, inverseScale, 1)];
     }
 
+#if PLATFORM(IOS)
     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);
+#endif
 }
 
 void WebVideoFullscreenManagerProxy::resetMediaState(uint64_t contextId)
@@ -549,7 +566,11 @@ void WebVideoFullscreenManagerProxy::didCleanupFullscreen(uint64_t contextId)
 void WebVideoFullscreenManagerProxy::setVideoLayerFrame(uint64_t contextId, WebCore::FloatRect frame)
 {
     @autoreleasepool {
+#if PLATFORM(IOS)
         mach_port_name_t fencePort = [UIWindow _synchronizeDrawingAcrossProcesses];
+#else
+        mach_port_name_t fencePort = 0;
+#endif
 
         m_page->send(Messages::WebVideoFullscreenManager::SetVideoLayerFrameFenced(contextId, frame, IPC::Attachment(fencePort, MACH_MSG_TYPE_MOVE_SEND)), m_page->pageID());
     }
@@ -590,4 +611,4 @@ void WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline(uint64_t contex
 
 } // namespace WebKit
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
index 2e85976..728b6ee 100644 (file)
 #include "RemoteLayerTreeDrawingAreaProxy.h"
 #include "RemoteLayerTreeScrollingPerformanceData.h"
 #include "ViewSnapshotStore.h"
+#include "WebVideoFullscreenManagerProxy.h"
+#include "WebVideoFullscreenManagerProxyMessages.h"
 #include <WebCore/MachSendRight.h>
 #include <WebCore/RunLoopObserver.h>
 #include <WebCore/TextIndicatorWindow.h>
 #endif
 
-#if PLATFORM(IOS)
-#include "WebVideoFullscreenManagerProxy.h"
-#include "WebVideoFullscreenManagerProxyMessages.h"
-#endif
-
 #if USE(CAIRO)
 #include <WebCore/CairoUtilities.h>
 #endif
@@ -470,7 +467,7 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin
 #if ENABLE(FULLSCREEN_API)
     m_fullScreenManager = WebFullScreenManagerProxy::create(*this, m_pageClient.fullScreenManagerProxyClient());
 #endif
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     m_videoFullscreenManager = WebVideoFullscreenManagerProxy::create(*this);
 #endif
 #if ENABLE(VIBRATION)
@@ -705,7 +702,7 @@ void WebPageProxy::reattachToWebProcess()
 #if ENABLE(FULLSCREEN_API)
     m_fullScreenManager = WebFullScreenManagerProxy::create(*this, m_pageClient.fullScreenManagerProxyClient());
 #endif
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     m_videoFullscreenManager = WebVideoFullscreenManagerProxy::create(*this);
 #endif
 
@@ -1398,7 +1395,7 @@ void WebPageProxy::viewDidLeaveWindow()
     if (m_colorPicker)
         endColorPicker();
 #endif
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     // When leaving the current page, close the video fullscreen.
     if (m_videoFullscreenManager)
         m_videoFullscreenManager->requestHideAndExitFullscreen();
@@ -3977,12 +3974,14 @@ WebFullScreenManagerProxy* WebPageProxy::fullScreenManager()
 }
 #endif
     
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 RefPtr<WebVideoFullscreenManagerProxy> WebPageProxy::videoFullscreenManager()
 {
     return m_videoFullscreenManager;
 }
+#endif
 
+#if PLATFORM(IOS)
 bool WebPageProxy::allowsMediaDocumentInlinePlayback() const
 {
     return m_allowsMediaDocumentInlinePlayback;
@@ -5026,12 +5025,14 @@ void WebPageProxy::resetState(ResetStateReason resetStateReason)
 
     m_visibleScrollerThumbRect = IntRect();
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     if (m_videoFullscreenManager) {
         m_videoFullscreenManager->invalidate();
         m_videoFullscreenManager = nullptr;
     }
+#endif
 
+#if PLATFORM(IOS)
     m_lastVisibleContentRectUpdate = VisibleContentRectUpdateInfo();
     m_dynamicViewportSizeUpdateWaitingForTarget = false;
     m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit = false;
index 216f5ba..ec0f8af 100644 (file)
@@ -329,9 +329,11 @@ public:
 #if ENABLE(FULLSCREEN_API)
     WebFullScreenManagerProxy* fullScreenManager();
 #endif
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     RefPtr<WebVideoFullscreenManagerProxy> videoFullscreenManager();
+#endif
 
+#if PLATFORM(IOS)
     bool allowsMediaDocumentInlinePlayback() const;
     void setAllowsMediaDocumentInlinePlayback(bool);
 #endif
@@ -1535,8 +1537,10 @@ private:
 #if ENABLE(FULLSCREEN_API)
     RefPtr<WebFullScreenManagerProxy> m_fullScreenManager;
 #endif
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     RefPtr<WebVideoFullscreenManagerProxy> m_videoFullscreenManager;
+#endif
+#if PLATFORM(IOS)
     VisibleContentRectUpdateInfo m_lastVisibleContentRectUpdate;
     bool m_hasReceivedLayerTreeTransactionAfterDidCommitLoad;
     uint64_t m_firstLayerTreeTransactionIdAfterDidCommitLoad;
index 473e793..09e3262 100644 (file)
@@ -75,7 +75,7 @@
 #include <WebCore/SecurityOriginData.h>
 #include <WebCore/Settings.h>
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 #include "WebVideoFullscreenManager.h"
 #endif
 
@@ -849,7 +849,7 @@ PassRefPtr<ScrollingCoordinator> WebChromeClient::createScrollingCoordinator(Pag
 }
 #endif
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 bool WebChromeClient::supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode)
 {
     return m_page->videoFullscreenManager()->supportsVideoFullscreen();
index 74bb858..7641303 100644 (file)
@@ -242,7 +242,7 @@ private:
     virtual void elementDidRefocus(const WebCore::Node*) override;
 #endif
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     virtual bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
     virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
     virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) override;
index 4b4d5a9..a1cd2d8 100644 (file)
 #include "PDFPlugin.h"
 #include "RemoteLayerTreeTransaction.h"
 #include "WKStringCF.h"
+#include "WebVideoFullscreenManager.h"
 #include <WebCore/LegacyWebArchive.h>
 #endif
 
 
 #if PLATFORM(IOS)
 #include "RemoteLayerTreeDrawingArea.h"
-#include "WebVideoFullscreenManager.h"
 #include <CoreGraphics/CoreGraphics.h>
 #include <WebCore/CoreTextSPI.h>
 #include <WebCore/Icon.h>
@@ -3046,14 +3046,16 @@ WebInspectorUI* WebPage::inspectorUI()
     return m_inspectorUI.get();
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 WebVideoFullscreenManager* WebPage::videoFullscreenManager()
 {
     if (!m_videoFullscreenManager)
         m_videoFullscreenManager = WebVideoFullscreenManager::create(this);
     return m_videoFullscreenManager.get();
 }
+#endif
 
+#if PLATFORM(IOS)
 void WebPage::setAllowsMediaDocumentInlinePlayback(bool allows)
 {
     m_page->setAllowsMediaDocumentInlinePlayback(allows);
index 25950dd..a8e89f9 100644 (file)
@@ -249,8 +249,10 @@ public:
     WebInspectorUI* inspectorUI();
     bool isInspectorPage() { return !!m_inspectorUI; }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     WebVideoFullscreenManager* videoFullscreenManager();
+#endif
+#if PLATFORM(IOS)
     void setAllowsMediaDocumentInlinePlayback(bool);
     bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
 #endif
@@ -1281,8 +1283,10 @@ private:
 
     RefPtr<WebInspector> m_inspector;
     RefPtr<WebInspectorUI> m_inspectorUI;
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     RefPtr<WebVideoFullscreenManager> m_videoFullscreenManager;
+#endif
+#if PLATFORM(IOS)
     bool m_allowsMediaDocumentInlinePlayback { false };
 #endif
 #if ENABLE(FULLSCREEN_API)
index f1d0fe5..0961407 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef WebVideoFullscreenManager_h
 #define WebVideoFullscreenManager_h
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 
 #include "MessageReceiver.h"
 #include <WebCore/EventListener.h>
@@ -172,6 +172,6 @@ protected:
     
 } // namespace WebKit
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 
 #endif // WebVideoFullscreenManager_h
index d4dcaaa..83ddfe2 100644 (file)
@@ -20,7 +20,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 messages -> WebVideoFullscreenManager {
     Play(uint64_t contextId)
     Pause(uint64_t contextId)
index 2d6ecbc..b9b6f35 100644 (file)
@@ -25,7 +25,7 @@
 #import "config.h"
 #import "WebVideoFullscreenManager.h"
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
 
 #import "Attachment.h"
 #import "WebCoreArgumentCoders.h"
@@ -45,7 +45,6 @@
 #import <WebCore/RenderView.h>
 #import <WebCore/Settings.h>
 #import <WebCore/TimeRanges.h>
-#import <WebCore/WebCoreThreadRun.h>
 #import <mach/mach_port.h>
 
 using namespace WebCore;
@@ -220,7 +219,12 @@ WebVideoFullscreenInterfaceContext& WebVideoFullscreenManager::ensureInterface(u
 
 bool WebVideoFullscreenManager::supportsVideoFullscreen() const
 {
+#if PLATFORM(IOS)
     return Settings::avKitEnabled();
+#else
+    // FIXME 153241: Return false until more of WebVideoFullscreenInterfaceMac has been implemented.
+    return false;
+#endif
 }
 
 void WebVideoFullscreenManager::enterVideoFullscreenForVideoElement(HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode mode)
@@ -558,4 +562,4 @@ void WebVideoFullscreenManager::setVideoLayerFrameFenced(uint64_t contextId, Web
 
 } // namespace WebKit
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))