[Picture-in-Picture Web API] Enable the support for iOS
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Oct 2019 05:13:33 +0000 (05:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Oct 2019 05:13:33 +0000 (05:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202618

Patch by Peng Liu <peng.liu6@apple.com> on 2019-10-30
Reviewed by Jer Noble.

Source/JavaScriptCore:

Enable the Picture-in-Picture API support for iOS (iPad only).

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Enable the Picture-in-Picture API support for iOS (iPad only).
Add a file WebCore/platform/PictureInPictureSupport.h to define supportsPictureInPicture()
and provide a default implementation of that function if a configuration does not provide it (just return false).
The original definition of this function in platform/cocoa/VideoFullscreenModel.h is removed,
and the usage of this function is cleaned up.
Also fix a build error related to including header file (pal/spi/cg/CoreGraphicsSPI.h).

Covered by existing test cases.

* Configurations/FeatureDefines.xcconfig:
* Modules/pictureinpicture/DocumentPictureInPicture.cpp:
(WebCore::DocumentPictureInPicture::pictureInPictureEnabled):
* Modules/pictureinpicture/DocumentPictureInPicture.h:
(WebCore::DocumentPictureInPicture::pictureInPictureEnabled): Deleted.
* Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
(WebCore::HTMLVideoElementPictureInPicture::requestPictureInPicture):

* Configurations/FeatureDefines.xcconfig:
* Modules/pictureinpicture/DocumentPictureInPicture.cpp:
(WebCore::DocumentPictureInPicture::pictureInPictureEnabled):
* Modules/pictureinpicture/DocumentPictureInPicture.h:
(WebCore::DocumentPictureInPicture::pictureInPictureEnabled): Deleted.
* Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
(WebCore::HTMLVideoElementPictureInPicture::requestPictureInPicture):
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLMediaElement.cpp:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::webkitSupportsPresentationMode const):
* platform/PictureInPictureSupport.h: Copied from Source/WebCore/Modules/pictureinpicture/DocumentPictureInPicture.h.
(WebCore::supportsPictureInPicture):
* platform/cocoa/VideoFullscreenModel.h:
* platform/graphics/cg/PathCG.cpp:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
* platform/mac/VideoFullscreenInterfaceMac.mm:

Source/WebCore/PAL:

Enable the Picture-in-Picture API support for iOS (iPad only).

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

Enable the Picture-in-Picture API support for iOS (iPad only).

* Configurations/FeatureDefines.xcconfig:
* WebProcess/cocoa/VideoFullscreenManager.mm:

Source/WebKitLegacy/mac:

Enable the Picture-in-Picture API support for iOS (iPad only).

* Configurations/FeatureDefines.xcconfig:

Tools:

Enable the Picture-in-Picture API support for iOS (iPad only).

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

We do not need to play the video before entering the picture-in-picture mode,
so remove the code to start video playback in the test pages.
Also, enable the layout test cases of the Picture-in-Picture API for iPad.

* media/picture-in-picture-api-pip-events-expected.txt:
* media/picture-in-picture-api-pip-events.html:
* media/picture-in-picture-api-pip-window-expected.txt:
* media/picture-in-picture-api-pip-window.html:
* platform/ipad/TestExpectations:

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

30 files changed:
LayoutTests/ChangeLog
LayoutTests/media/picture-in-picture-api-pip-events-expected.txt
LayoutTests/media/picture-in-picture-api-pip-events.html
LayoutTests/media/picture-in-picture-api-pip-window-expected.txt
LayoutTests/media/picture-in-picture-api-pip-window.html
LayoutTests/platform/ipad/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/Modules/pictureinpicture/DocumentPictureInPicture.cpp
Source/WebCore/Modules/pictureinpicture/DocumentPictureInPicture.h
Source/WebCore/Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/platform/PictureInPictureSupport.h [new file with mode: 0644]
Source/WebCore/platform/cocoa/VideoFullscreenModel.h
Source/WebCore/platform/graphics/cg/PathCG.cpp
Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm
Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm
Source/WebKit/ChangeLog
Source/WebKit/Configurations/FeatureDefines.xcconfig
Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig
Tools/ChangeLog
Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig

index 4dba07f..c783366 100644 (file)
@@ -1,3 +1,20 @@
+2019-10-30  Peng Liu  <peng.liu6@apple.com>
+
+        [Picture-in-Picture Web API] Enable the support for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=202618
+
+        Reviewed by Jer Noble.
+
+        We do not need to play the video before entering the picture-in-picture mode,
+        so remove the code to start video playback in the test pages.
+        Also, enable the layout test cases of the Picture-in-Picture API for iPad.
+
+        * media/picture-in-picture-api-pip-events-expected.txt:
+        * media/picture-in-picture-api-pip-events.html:
+        * media/picture-in-picture-api-pip-window-expected.txt:
+        * media/picture-in-picture-api-pip-window.html:
+        * platform/ipad/TestExpectations:
+
 2019-10-30  Yury Semikhatsky  <yurys@chromium.org>
 
         inspector-protocol/debugger/setBreakpoint-dfg.html is flaky
index 92b09ce..ee284b2 100644 (file)
@@ -3,8 +3,6 @@ This tests that events are fired correctly when a video element enters and exits
 RUN(internals.settings.setAllowsPictureInPictureMediaPlayback(true))
 RUN(video.src = findMediaFile("video", "content/test"))
 EVENT(canplaythrough)
-RUN(video.play())
-EVENT(playing)
 EVENT(enterpictureinpicture)
 EVENT(leavepictureinpicture)
 END OF TEST
index 7985d14..33b14a9 100644 (file)
@@ -12,9 +12,6 @@
             run('video.src = findMediaFile("video", "content/test")');
             await waitFor(video, 'canplaythrough');
 
-            run('video.play()');
-            await waitFor(video, 'playing');
-
             runWithKeyDown(function() { video.requestPictureInPicture(); });
             await waitFor(video, 'enterpictureinpicture');
 
index 7f11e74..45d6924 100644 (file)
@@ -3,8 +3,6 @@ This tests that a pip window is returned correctly when a video element enters t
 RUN(internals.settings.setAllowsPictureInPictureMediaPlayback(true))
 RUN(video.src = findMediaFile("video", "content/test"))
 EVENT(canplaythrough)
-RUN(video.play())
-EVENT(playing)
 EXPECTED (pipWindow.width > '0') OK
 EXPECTED (pipWindow.height > '0') OK
 END OF TEST
index 854552a..c7201d1 100644 (file)
@@ -12,9 +12,6 @@
             run('video.src = findMediaFile("video", "content/test")');
             await waitFor(video, 'canplaythrough');
 
-            run('video.play()');
-            await waitFor(video, 'playing');
-
             runWithKeyDown(function() {
                 video.requestPictureInPicture()
                 .then(pipWindow => {
index 08f1fb1..b91ab9e 100644 (file)
@@ -64,3 +64,12 @@ webkit.org/b/203264 editing/pasteboard/smart-paste-paragraph-001.html [ Pass ]
 webkit.org/b/203264 editing/pasteboard/smart-paste-paragraph-002.html [ Pass ]
 webkit.org/b/203264 editing/pasteboard/smart-paste-paragraph-004.html [ Pass ]
 
+media/picture-in-picture-api-element-attributes.html [ Pass ]
+media/picture-in-picture-api-enter-pip-1.html [ Pass ]
+media/picture-in-picture-api-enter-pip-2.html [ Pass ]
+media/picture-in-picture-api-enter-pip-3.html [ Pass ]
+webkit.org/b/203614 media/picture-in-picture-api-enter-pip-4.html [ Pass Timeout ]
+webkit.org/b/203614 media/picture-in-picture-api-exit-pip-1.html [ Pass Timeout ]
+media/picture-in-picture-api-exit-pip-2.html [ Pass ]
+webkit.org/b/203614 media/picture-in-picture-api-pip-events.html [ Pass Timeout ]
+webkit.org/b/203614 media/picture-in-picture-api-pip-window.html [ Pass Timeout ]
\ No newline at end of file
index 0b64503..d48e963 100644 (file)
@@ -1,3 +1,14 @@
+2019-10-30  Peng Liu  <peng.liu6@apple.com>
+
+        [Picture-in-Picture Web API] Enable the support for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=202618
+
+        Reviewed by Jer Noble.
+
+        Enable the Picture-in-Picture API support for iOS (iPad only).
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2019-10-30  Yusuke Suzuki  <ysuzuki@apple.com>
 
         [JSC] Date functions should have intrinsic
index 40b2b66..78e5c00 100644 (file)
@@ -316,6 +316,8 @@ ENABLE_OVERFLOW_SCROLLING_TOUCH_cocoatouch = ENABLE_OVERFLOW_SCROLLING_TOUCH;
 ENABLE_PAYMENT_REQUEST = ENABLE_PAYMENT_REQUEST;
 
 ENABLE_PICTURE_IN_PICTURE_API = $(ENABLE_PICTURE_IN_PICTURE_API_$(WK_PLATFORM_NAME));
+ENABLE_PICTURE_IN_PICTURE_API_iphoneos = ENABLE_PICTURE_IN_PICTURE_API;
+ENABLE_PICTURE_IN_PICTURE_API_iphonesimulator = ENABLE_PICTURE_IN_PICTURE_API;
 ENABLE_PICTURE_IN_PICTURE_API_macosx = ENABLE_PICTURE_IN_PICTURE_API;
 
 ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(WK_PLATFORM_NAME));
index e4d542d..4bcbae7 100644 (file)
@@ -1,3 +1,45 @@
+2019-10-30  Peng Liu  <peng.liu6@apple.com>
+
+        [Picture-in-Picture Web API] Enable the support for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=202618
+
+        Reviewed by Jer Noble.
+
+        Enable the Picture-in-Picture API support for iOS (iPad only).
+        Add a file WebCore/platform/PictureInPictureSupport.h to define supportsPictureInPicture()
+        and provide a default implementation of that function if a configuration does not provide it (just return false).
+        The original definition of this function in platform/cocoa/VideoFullscreenModel.h is removed,
+        and the usage of this function is cleaned up.
+        Also fix a build error related to including header file (pal/spi/cg/CoreGraphicsSPI.h).
+
+        Covered by existing test cases.
+
+        * Configurations/FeatureDefines.xcconfig:
+        * Modules/pictureinpicture/DocumentPictureInPicture.cpp:
+        (WebCore::DocumentPictureInPicture::pictureInPictureEnabled):
+        * Modules/pictureinpicture/DocumentPictureInPicture.h:
+        (WebCore::DocumentPictureInPicture::pictureInPictureEnabled): Deleted.
+        * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
+        (WebCore::HTMLVideoElementPictureInPicture::requestPictureInPicture):
+
+        * Configurations/FeatureDefines.xcconfig:
+        * Modules/pictureinpicture/DocumentPictureInPicture.cpp:
+        (WebCore::DocumentPictureInPicture::pictureInPictureEnabled):
+        * Modules/pictureinpicture/DocumentPictureInPicture.h:
+        (WebCore::DocumentPictureInPicture::pictureInPictureEnabled): Deleted.
+        * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp:
+        (WebCore::HTMLVideoElementPictureInPicture::requestPictureInPicture):
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLMediaElement.cpp:
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::webkitSupportsPresentationMode const):
+        * platform/PictureInPictureSupport.h: Copied from Source/WebCore/Modules/pictureinpicture/DocumentPictureInPicture.h.
+        (WebCore::supportsPictureInPicture):
+        * platform/cocoa/VideoFullscreenModel.h:
+        * platform/graphics/cg/PathCG.cpp:
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        * platform/mac/VideoFullscreenInterfaceMac.mm:
+
 2019-10-30  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Timelines: ResizeObserver callbacks are not labeled in the Events timeline
index 40b2b66..78e5c00 100644 (file)
@@ -316,6 +316,8 @@ ENABLE_OVERFLOW_SCROLLING_TOUCH_cocoatouch = ENABLE_OVERFLOW_SCROLLING_TOUCH;
 ENABLE_PAYMENT_REQUEST = ENABLE_PAYMENT_REQUEST;
 
 ENABLE_PICTURE_IN_PICTURE_API = $(ENABLE_PICTURE_IN_PICTURE_API_$(WK_PLATFORM_NAME));
+ENABLE_PICTURE_IN_PICTURE_API_iphoneos = ENABLE_PICTURE_IN_PICTURE_API;
+ENABLE_PICTURE_IN_PICTURE_API_iphonesimulator = ENABLE_PICTURE_IN_PICTURE_API;
 ENABLE_PICTURE_IN_PICTURE_API_macosx = ENABLE_PICTURE_IN_PICTURE_API;
 
 ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(WK_PLATFORM_NAME));
index 6af3c36..98bd5c8 100644 (file)
@@ -32,6 +32,7 @@
 #include "Document.h"
 #include "HTMLVideoElementPictureInPicture.h"
 #include "JSDOMPromiseDeferred.h"
+#include "PictureInPictureSupport.h"
 #include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
@@ -40,6 +41,11 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(DocumentPictureInPicture);
 
 DocumentPictureInPicture::~DocumentPictureInPicture() = default;
 
+bool DocumentPictureInPicture::pictureInPictureEnabled(Document&)
+{
+    return supportsPictureInPicture();
+}
+
 void DocumentPictureInPicture::exitPictureInPicture(Document& document, Ref<DeferredPromise>&& promise)
 {
     auto element = document.pictureInPictureElement();
index 2cce978..3a34e1a 100644 (file)
@@ -42,7 +42,7 @@ class DocumentPictureInPicture : public Supplement<Document> {
 public:
     virtual ~DocumentPictureInPicture();
 
-    static bool pictureInPictureEnabled(Document&) { return true; }
+    static bool pictureInPictureEnabled(Document&);
     static void exitPictureInPicture(Document&, Ref<DeferredPromise>&&);
 
     static DocumentPictureInPicture* from(Document&);
index 1ce1cd5..4fc9afb 100644 (file)
@@ -33,6 +33,7 @@
 #include "JSDOMPromiseDeferred.h"
 #include "JSPictureInPictureWindow.h"
 #include "Logging.h"
+#include "PictureInPictureSupport.h"
 #include "PictureInPictureWindow.h"
 #include "VideoTrackList.h"
 #include <wtf/IsoMallocInlines.h>
@@ -72,6 +73,11 @@ HTMLVideoElementPictureInPicture* HTMLVideoElementPictureInPicture::from(HTMLVid
 
 void HTMLVideoElementPictureInPicture::requestPictureInPicture(HTMLVideoElement& videoElement, Ref<DeferredPromise>&& promise)
 {
+    if (!supportsPictureInPicture()) {
+        promise->reject(NotSupportedError, "The Picture-in-Picture mode is not supported.");
+        return;
+    }
+
     if (videoElement.readyState() == HTMLMediaElementEnums::HAVE_NOTHING) {
         promise->reject(InvalidStateError, "The video element is not ready to enter the Picture-in-Picture mode.");
         return;
index 3b80c1d..8d98570 100644 (file)
@@ -1,3 +1,14 @@
+2019-10-30  Peng Liu  <peng.liu6@apple.com>
+
+        [Picture-in-Picture Web API] Enable the support for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=202618
+
+        Reviewed by Jer Noble.
+
+        Enable the Picture-in-Picture API support for iOS (iPad only).
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2019-10-26  Chris Lord  <clord@igalia.com>
 
         Put OffscreenCanvas behind a build flag
index 40b2b66..78e5c00 100644 (file)
@@ -316,6 +316,8 @@ ENABLE_OVERFLOW_SCROLLING_TOUCH_cocoatouch = ENABLE_OVERFLOW_SCROLLING_TOUCH;
 ENABLE_PAYMENT_REQUEST = ENABLE_PAYMENT_REQUEST;
 
 ENABLE_PICTURE_IN_PICTURE_API = $(ENABLE_PICTURE_IN_PICTURE_API_$(WK_PLATFORM_NAME));
+ENABLE_PICTURE_IN_PICTURE_API_iphoneos = ENABLE_PICTURE_IN_PICTURE_API;
+ENABLE_PICTURE_IN_PICTURE_API_iphonesimulator = ENABLE_PICTURE_IN_PICTURE_API;
 ENABLE_PICTURE_IN_PICTURE_API_macosx = ENABLE_PICTURE_IN_PICTURE_API;
 
 ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(WK_PLATFORM_NAME));
index 9e27e62..7293038 100644 (file)
                1CCD81502231F83E0065FC2B /* WebCoreResourceHandleAsOperationQueueDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E152551416FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.mm */; };
                1CCDF5BE1990332400BCEBAD /* SVGToOTFFontConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCDF5BC1990332400BCEBAD /* SVGToOTFFontConversion.h */; };
                1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */; };
+               1D2C82B7236A3F6A0055D6C5 /* PictureInPictureSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D2C82B6236A3F6A0055D6C5 /* PictureInPictureSupport.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1D2F8E03234474EF00993B68 /* DocumentPictureInPicture.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DEF06DD233D2E1C00EE228D /* DocumentPictureInPicture.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1D2F8E042344751600993B68 /* EnterPictureInPictureEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DEF06CA233C3D0B00EE228D /* EnterPictureInPictureEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1D2F8E052344751D00993B68 /* HTMLVideoElementPictureInPicture.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DEF06CC233C3D2000EE228D /* HTMLVideoElementPictureInPicture.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1CECB3C721F59C8700F44542 /* WHLSLNativeTypeWriter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLNativeTypeWriter.h; sourceTree = "<group>"; };
                1CF0BFD42298706800ED2074 /* TextSizeAdjustment.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TextSizeAdjustment.cpp; sourceTree = "<group>"; };
                1CFAE3220A6D6A3F0032593D /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; };
+               1D2C82B6236A3F6A0055D6C5 /* PictureInPictureSupport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PictureInPictureSupport.h; sourceTree = "<group>"; };
                1DBC1B552347B3D200B901AF /* PictureInPictureObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PictureInPictureObserver.h; sourceTree = "<group>"; };
                1DC553FD211BA12A004B780E /* NavigatorShare.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorShare.idl; sourceTree = "<group>"; };
                1DC553FF211BA841004B780E /* ShareData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShareData.idl; sourceTree = "<group>"; };
                AACC83D62316569E00EB6BF5 /* HTMLOrForeignElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLOrForeignElement.idl; sourceTree = "<group>"; };
                AACC83D72316576A00EB6BF5 /* JSHTMLOrForeignElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSHTMLOrForeignElement.h; sourceTree = "<group>"; };
                AACC83D82316576B00EB6BF5 /* JSHTMLOrForeignElement.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOrForeignElement.cpp; sourceTree = "<group>"; };
-               AAD9D0B121DFA80C001B11C7 /* LazyLoadImageObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LazyLoadImageObserver.cpp; sourceTree = "<group>"; };
-               AAD9D0B321DFA80E001B11C7 /* LazyLoadImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyLoadImageObserver.h; sourceTree = "<group>"; };
                AAE27B7416CBFC0D00623043 /* PlatformSpeechSynthesizerMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesizerMock.cpp; sourceTree = "<group>"; };
                AAE27B7516CBFC0D00623043 /* PlatformSpeechSynthesizerMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizerMock.h; sourceTree = "<group>"; };
                AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerIOS.mm; sourceTree = "<group>"; };
                                1AF5E4D21E56735A004A1F01 /* PasteboardWriterData.cpp */,
                                1AF5E4D31E56735A004A1F01 /* PasteboardWriterData.h */,
                                1DBC1B552347B3D200B901AF /* PictureInPictureObserver.h */,
+                               1D2C82B6236A3F6A0055D6C5 /* PictureInPictureSupport.h */,
                                A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */,
                                BC5C76291497FE1400BC4775 /* PlatformEvent.h */,
                                A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */,
                                07B7116D1D899E63009F0FFB /* CaptureDevice.h in Headers */,
                                07B7116F1D899E63009F0FFB /* CaptureDeviceManager.h in Headers */,
                                CDC734151977896D0046BFC5 /* CARingBuffer.h in Headers */,
+                               E4ABABF52368C6EF00FA4345 /* CascadeLevel.h in Headers */,
                                57303BBB2006C6EE00355965 /* CBORBinary.h in Headers */,
                                57303BC12006E00C00355965 /* CBORReader.h in Headers */,
                                57303BB92006C6EE00355965 /* CBORValue.h in Headers */,
                                BE8EF045171C8FF9009B48C3 /* JSAudioTrackList.h in Headers */,
                                57D1352A2294AA3900827401 /* JSAuthenticationExtensionsClientInputs.h in Headers */,
                                57303C2F2009B7E100355965 /* JSAuthenticatorAssertionResponse.h in Headers */,
-                               E4ABABF32368B95900FA4345 /* StyleBuilderState.h in Headers */,
                                57303C222009AF0300355965 /* JSAuthenticatorAttestationResponse.h in Headers */,
                                57303BE120095D6100355965 /* JSAuthenticatorResponse.h in Headers */,
                                57DCED98214882160016B847 /* JSAuthenticatorTransport.h in Headers */,
                                FD581FB51520F93B003A7A75 /* PeriodicWave.h in Headers */,
                                49D5DC2E0F423A73008F20FD /* PerspectiveTransformOperation.h in Headers */,
                                1DBC1B562347B3D200B901AF /* PictureInPictureObserver.h in Headers */,
+                               1D2C82B7236A3F6A0055D6C5 /* PictureInPictureSupport.h in Headers */,
                                1D2F8E062344752300993B68 /* PictureInPictureWindow.h in Headers */,
                                D0FF2A5E11F8C45A007E74E0 /* PingLoader.h in Headers */,
                                CD7D33441C7A123F00041293 /* PixelBufferConformerCV.h in Headers */,
                                BC3BE12B0E98092F00835588 /* PopupMenuStyle.h in Headers */,
                                37F567CE165358F400DDE92B /* PopupOpeningObserver.h in Headers */,
                                93F199DE08245E59001E9ABC /* Position.h in Headers */,
-                               E4ABABF52368C6EF00FA4345 /* CascadeLevel.h in Headers */,
                                9746AF2C14F4DDE6003E7A70 /* PositionCallback.h in Headers */,
                                9746AF3014F4DDE6003E7A70 /* PositionErrorCallback.h in Headers */,
                                37919C240B7D188600A56998 /* PositionIterator.h in Headers */,
                                8386A96D19F61B2E00E1EC4A /* StyleBuilder.h in Headers */,
                                83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */,
                                835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */,
+                               E4ABABF32368B95900FA4345 /* StyleBuilderState.h in Headers */,
                                BCEF444D0E674628001C1287 /* StyleCachedImage.h in Headers */,
                                E401E0A41C3C0B8300F34D10 /* StyleChange.h in Headers */,
                                9418278B1D8B244000492764 /* StyleColor.h in Headers */,
index e099483..638265c 100644 (file)
@@ -74,6 +74,7 @@
 #include "NetworkingContext.h"
 #include "Page.h"
 #include "PageGroup.h"
+#include "PictureInPictureSupport.h"
 #include "PlatformMediaSessionManager.h"
 #include "ProgressTracker.h"
 #include "Quirks.h"
index 6cdd36e..60304ed 100644 (file)
@@ -39,6 +39,7 @@
 #include "HTMLParserIdioms.h"
 #include "Logging.h"
 #include "Page.h"
+#include "PictureInPictureSupport.h"
 #include "RenderImage.h"
 #include "RenderVideo.h"
 #include "ScriptController.h"
@@ -414,10 +415,8 @@ bool HTMLVideoElement::webkitSupportsPresentationMode(VideoPresentationMode mode
         return supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModeStandard);
 
     if (mode == VideoPresentationMode::PictureInPicture) {
-#if PLATFORM(COCOA)
         if (!supportsPictureInPicture())
             return false;
-#endif
 
         return supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture);
     }
diff --git a/Source/WebCore/platform/PictureInPictureSupport.h b/Source/WebCore/platform/PictureInPictureSupport.h
new file mode 100644 (file)
index 0000000..e8366b6
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2019 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+WEBCORE_EXPORT bool supportsPictureInPicture();
+#else
+constexpr bool supportsPictureInPicture() { return false; }
+#endif
+
+}
index 3f457d3..1fbb99d 100644 (file)
@@ -85,8 +85,6 @@ public:
     virtual void didExitPictureInPicture() { }
     virtual void modelDestroyed() { }
 };
-
-WEBCORE_EXPORT bool supportsPictureInPicture();
     
 }
 
index 32fcd74..e4ae5d5 100644 (file)
@@ -35,6 +35,7 @@
 #include "IntRect.h"
 #include "StrokeStyleApplier.h"
 #include <CoreGraphics/CoreGraphics.h>
+#include <pal/spi/cg/CoreGraphicsSPI.h>
 #include <wtf/MathExtras.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/text/WTFString.h>
index 5a7465d..d964bd5 100644 (file)
@@ -32,6 +32,7 @@
 
 #import "GeometryUtilities.h"
 #import "Logging.h"
+#import "PictureInPictureSupport.h"
 #import "PlaybackSessionInterfaceAVKit.h"
 #import "RuntimeApplicationChecks.h"
 #import "TimeRanges.h"
index 317795c..15571cd 100644 (file)
@@ -30,6 +30,7 @@
 
 #import "IntRect.h"
 #import "Logging.h"
+#import "PictureInPictureSupport.h"
 #import "PlaybackSessionInterfaceMac.h"
 #import "TimeRanges.h"
 #import "VideoFullscreenChangeObserver.h"
index b960407..0fcd3da 100644 (file)
@@ -1,3 +1,15 @@
+2019-10-30  Peng Liu  <peng.liu6@apple.com>
+
+        [Picture-in-Picture Web API] Enable the support for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=202618
+
+        Reviewed by Jer Noble.
+
+        Enable the Picture-in-Picture API support for iOS (iPad only).
+
+        * Configurations/FeatureDefines.xcconfig:
+        * WebProcess/cocoa/VideoFullscreenManager.mm:
+
 2019-10-30  Alex Christensen  <achristensen@webkit.org>
 
         Prevent Mac CMake build from bit rotting
index 40b2b66..78e5c00 100644 (file)
@@ -316,6 +316,8 @@ ENABLE_OVERFLOW_SCROLLING_TOUCH_cocoatouch = ENABLE_OVERFLOW_SCROLLING_TOUCH;
 ENABLE_PAYMENT_REQUEST = ENABLE_PAYMENT_REQUEST;
 
 ENABLE_PICTURE_IN_PICTURE_API = $(ENABLE_PICTURE_IN_PICTURE_API_$(WK_PLATFORM_NAME));
+ENABLE_PICTURE_IN_PICTURE_API_iphoneos = ENABLE_PICTURE_IN_PICTURE_API;
+ENABLE_PICTURE_IN_PICTURE_API_iphonesimulator = ENABLE_PICTURE_IN_PICTURE_API;
 ENABLE_PICTURE_IN_PICTURE_API_macosx = ENABLE_PICTURE_IN_PICTURE_API;
 
 ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(WK_PLATFORM_NAME));
index ac4032a..77c520d 100644 (file)
@@ -43,6 +43,7 @@
 #import <WebCore/EventNames.h>
 #import <WebCore/FrameView.h>
 #import <WebCore/HTMLVideoElement.h>
+#import <WebCore/PictureInPictureSupport.h>
 #import <WebCore/PlatformCALayer.h>
 #import <WebCore/RenderLayer.h>
 #import <WebCore/RenderLayerBacking.h>
index ea1844b..24b2ee5 100644 (file)
@@ -1,3 +1,14 @@
+2019-10-30  Peng Liu  <peng.liu6@apple.com>
+
+        [Picture-in-Picture Web API] Enable the support for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=202618
+
+        Reviewed by Jer Noble.
+
+        Enable the Picture-in-Picture API support for iOS (iPad only).
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2019-10-29  Andy Estes  <aestes@apple.com>
 
         [Quick Look] Clean up LegacyPreviewLoaderClients
index 40b2b66..78e5c00 100644 (file)
@@ -316,6 +316,8 @@ ENABLE_OVERFLOW_SCROLLING_TOUCH_cocoatouch = ENABLE_OVERFLOW_SCROLLING_TOUCH;
 ENABLE_PAYMENT_REQUEST = ENABLE_PAYMENT_REQUEST;
 
 ENABLE_PICTURE_IN_PICTURE_API = $(ENABLE_PICTURE_IN_PICTURE_API_$(WK_PLATFORM_NAME));
+ENABLE_PICTURE_IN_PICTURE_API_iphoneos = ENABLE_PICTURE_IN_PICTURE_API;
+ENABLE_PICTURE_IN_PICTURE_API_iphonesimulator = ENABLE_PICTURE_IN_PICTURE_API;
 ENABLE_PICTURE_IN_PICTURE_API_macosx = ENABLE_PICTURE_IN_PICTURE_API;
 
 ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(WK_PLATFORM_NAME));
index efd6ab4..eba8c5a 100644 (file)
@@ -1,3 +1,14 @@
+2019-10-30  Peng Liu  <peng.liu6@apple.com>
+
+        [Picture-in-Picture Web API] Enable the support for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=202618
+
+        Reviewed by Jer Noble.
+
+        Enable the Picture-in-Picture API support for iOS (iPad only).
+
+        * TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
+
 2019-10-30  Alex Christensen  <achristensen@webkit.org>
 
         Prevent Mac CMake build from bit rotting
index 40b2b66..78e5c00 100644 (file)
@@ -316,6 +316,8 @@ ENABLE_OVERFLOW_SCROLLING_TOUCH_cocoatouch = ENABLE_OVERFLOW_SCROLLING_TOUCH;
 ENABLE_PAYMENT_REQUEST = ENABLE_PAYMENT_REQUEST;
 
 ENABLE_PICTURE_IN_PICTURE_API = $(ENABLE_PICTURE_IN_PICTURE_API_$(WK_PLATFORM_NAME));
+ENABLE_PICTURE_IN_PICTURE_API_iphoneos = ENABLE_PICTURE_IN_PICTURE_API;
+ENABLE_PICTURE_IN_PICTURE_API_iphonesimulator = ENABLE_PICTURE_IN_PICTURE_API;
 ENABLE_PICTURE_IN_PICTURE_API_macosx = ENABLE_PICTURE_IN_PICTURE_API;
 
 ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(WK_PLATFORM_NAME));