Update AVKit usage of pip
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jun 2015 23:42:22 +0000 (23:42 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Jun 2015 23:42:22 +0000 (23:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146095
<rdar://problem/21386853>

Reviewed by Eric Carlson.

Source/WebCore:

- Rename enum VideoFullscreenModeOptimized to VideoFullscreenModePictureInPicture
- Rename MediaElementSession::allowsAlternateFullscreen to allowsPictureInPicture
- Rename Settings::allowsAlternateFullscreen to allowsPictureInPictureMediaPlayback
- Update AVKit calls and AVKitSPI.h
- Rename WebVideoFullscreenInterfaceAVKit delegate functions and member variables

* html/HTMLMediaElement.cpp:
* html/HTMLVideoElement.cpp:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::allowsPictureInPicture): Renamed.
(WebCore::MediaElementSession::allowsAlternateFullscreen): Deleted.
* html/MediaElementSession.h:
* page/Settings.cpp:
* page/Settings.in:
* platform/graphics/MediaPlayerEnums.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
* platform/ios/WebVideoFullscreenInterfaceAVKit.h: Remove unused setIsOptimized.
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
* platform/spi/cocoa/AVKitSPI.h: Remove unused typedef.
* platform/spi/mac/AVFoundationSPI.h:

Source/WebKit/mac:

- Rename preference key
- Rename shouldAllowAlternateFullscreen to shouldAllowPictureInPictureMediaPlayback

* WebCoreSupport/WebSystemInterface.mm:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences allowsAlternateFullscreen]): Call allowsPictureInPictureMediaPlayback.
(-[WebPreferences setAllowsAlternateFullscreen:]):
(-[WebPreferences allowsPictureInPictureMediaPlayback]): Added.
(-[WebPreferences setAllowsPictureInPictureMediaPlayback:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:

Source/WebKit2:

- Rename preference key
- Rename shouldAllowAlternateFullscreen to shouldAllowPictureInPictureMediaPlayback

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp: Remove unused preference calls.
(WKPreferencesSetAllowsAlternateFullscreen): Deleted.
(WKPreferencesGetAllowsAlternateFullscreen): Deleted.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _isShowingVideoPictureInPicture]): Renamed.
(-[WKWebView _isShowingVideoOptimized]): Deleted.
(-[WKWebView _mayAutomaticallyShowVideoPictureInPicture]): Renamed.
(-[WKWebView _mayAutomaticallyShowVideoOptimized]): Deleted.
(shouldAllowPictureInPictureMediaPlayback): Renamed.
(shouldAllowAlternateFullscreen): Deleted.
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/ios/PageClientImplIOS.mm:
* UIProcess/ios/WebVideoFullscreenManagerProxy.h: Rename local variables.
* UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in:
* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture): Renamed.
(WebKit::WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoOptimized): Deleted.
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/ios/WebVideoFullscreenManager.mm:

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

31 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/html/MediaElementSession.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.in
Source/WebCore/platform/graphics/MediaPlayerEnums.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h
Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm
Source/WebCore/platform/spi/cocoa/AVKitSPI.h
Source/WebCore/platform/spi/mac/AVFoundationSPI.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h
Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h
Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in
Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm

index 339e92d..aa98692 100644 (file)
@@ -1,3 +1,33 @@
+2015-06-18  Jon Lee  <jonlee@apple.com>
+
+        Update AVKit usage of pip
+        https://bugs.webkit.org/show_bug.cgi?id=146095
+        <rdar://problem/21386853>
+
+        Reviewed by Eric Carlson.
+
+        - Rename enum VideoFullscreenModeOptimized to VideoFullscreenModePictureInPicture
+        - Rename MediaElementSession::allowsAlternateFullscreen to allowsPictureInPicture
+        - Rename Settings::allowsAlternateFullscreen to allowsPictureInPictureMediaPlayback
+        - Update AVKit calls and AVKitSPI.h
+        - Rename WebVideoFullscreenInterfaceAVKit delegate functions and member variables
+
+        * html/HTMLMediaElement.cpp:
+        * html/HTMLVideoElement.cpp:
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::allowsPictureInPicture): Renamed.
+        (WebCore::MediaElementSession::allowsAlternateFullscreen): Deleted.
+        * html/MediaElementSession.h:
+        * page/Settings.cpp:
+        * page/Settings.in:
+        * platform/graphics/MediaPlayerEnums.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.h: Remove unused setIsOptimized.
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        * platform/spi/cocoa/AVKitSPI.h: Remove unused typedef.
+        * platform/spi/mac/AVFoundationSPI.h:
+
 2015-06-18  Jeremy Jones  <jeremyj@apple.com>
 
         Fix crash when entering fullscreen during exit fullscreen animation.
index 40835a3..9c58c97 100644 (file)
@@ -6212,7 +6212,7 @@ PlatformMediaSession::DisplayType HTMLMediaElement::displayType() const
 {
     if (m_videoFullscreenMode == VideoFullscreenModeStandard)
         return PlatformMediaSession::Fullscreen;
-    if (m_videoFullscreenMode & VideoFullscreenModeOptimized)
+    if (m_videoFullscreenMode & VideoFullscreenModePictureInPicture)
         return PlatformMediaSession::Optimized;
     if (m_videoFullscreenMode == VideoFullscreenModeNone)
         return PlatformMediaSession::Normal;
@@ -6285,7 +6285,7 @@ bool HTMLMediaElement::overrideBackgroundPlaybackRestriction() const
     if (m_player && m_player->isCurrentPlaybackTargetWireless())
         return true;
 #endif
-    if (m_videoFullscreenMode & VideoFullscreenModeOptimized)
+    if (m_videoFullscreenMode & VideoFullscreenModePictureInPicture)
         return true;
 #if PLATFORM(IOS)
     if (m_videoFullscreenMode == VideoFullscreenModeStandard && wkIsOptimizedFullscreenSupported() && isPlaying())
index 178a633..c4ece4e 100644 (file)
@@ -369,7 +369,7 @@ bool HTMLVideoElement::webkitSupportsPresentationMode(const String& mode) const
         return mediaSession().fullscreenPermitted(*this) && supportsFullscreen();
 
     if (mode == presentationModePictureInPicture())
-        return wkIsOptimizedFullscreenSupported() && mediaSession().allowsAlternateFullscreen(*this) && supportsFullscreen();
+        return wkIsOptimizedFullscreenSupported() && mediaSession().allowsPictureInPicture(*this) && supportsFullscreen();
 
     if (mode == presentationModeInline())
         return !mediaSession().requiresFullscreenForVideoPlayback(*this);
@@ -392,7 +392,7 @@ void HTMLVideoElement::webkitSetPresentationMode(const String& mode)
     if (mode == presentationModeFullscreen())
         enterFullscreen(VideoFullscreenModeStandard);
     else if (mode == presentationModePictureInPicture())
-        enterFullscreen(VideoFullscreenModeOptimized);
+        enterFullscreen(VideoFullscreenModePictureInPicture);
 }
 
 String HTMLVideoElement::webkitPresentationMode() const
@@ -402,7 +402,7 @@ String HTMLVideoElement::webkitPresentationMode() const
     if (mode == VideoFullscreenModeStandard)
         return presentationModeFullscreen();
 
-    if (mode & VideoFullscreenModeOptimized)
+    if (mode & VideoFullscreenModePictureInPicture)
         return presentationModePictureInPicture();
 
     if (mode == VideoFullscreenModeNone)
index 0d43fcd..d027bc0 100644 (file)
@@ -379,10 +379,10 @@ void MediaElementSession::mediaEngineUpdated(const HTMLMediaElement& element)
     
 }
 
-bool MediaElementSession::allowsAlternateFullscreen(const HTMLMediaElement& element) const
+bool MediaElementSession::allowsPictureInPicture(const HTMLMediaElement& element) const
 {
     Settings* settings = element.document().settings();
-    return settings && settings->allowsAlternateFullscreen();
+    return settings && settings->allowsPictureInPictureMediaPlayback();
 }
 
 #if ENABLE(MEDIA_SOURCE)
index a3456b8..0a98819 100644 (file)
@@ -69,7 +69,7 @@ public:
 #endif
 
     bool requiresFullscreenForVideoPlayback(const HTMLMediaElement&) const;
-    WEBCORE_EXPORT bool allowsAlternateFullscreen(const HTMLMediaElement&) const;
+    WEBCORE_EXPORT bool allowsPictureInPicture(const HTMLMediaElement&) const;
     MediaPlayer::Preload effectivePreloadForElement(const HTMLMediaElement&) const;
 
     void mediaEngineUpdated(const HTMLMediaElement&);
index 39e2add..f284409 100644 (file)
@@ -147,7 +147,7 @@ static const bool defaultImageSubsamplingEnabled = false;
 static const bool defaultScrollingTreeIncludesFrames = false;
 #endif
 
-static const bool defaultAllowsAlternateFullscreen = true;
+static const bool defaultAllowsPictureInPictureMediaPlayback = true;
 
 static const double defaultIncrementalRenderingSuppressionTimeoutInSeconds = 5;
 #if USE(UNIFIED_TEXT_CHECKING)
index 0296947..8d71733 100644 (file)
@@ -128,7 +128,7 @@ allowRunningOfInsecureContent initial=false
 requiresUserGestureForMediaPlayback initial=defaultRequiresUserGestureForMediaPlayback
 audioPlaybackRequiresUserGesture initial=defaultAudioPlaybackRequiresUserGesture
 allowsInlineMediaPlayback initial=defaultAllowsInlineMediaPlayback
-allowsAlternateFullscreen initial=defaultAllowsAlternateFullscreen
+allowsPictureInPictureMediaPlayback initial=defaultAllowsPictureInPictureMediaPlayback
 passwordEchoEnabled initial=false
 suppressesIncrementalRendering initial=false
 incrementalRenderingSuppressionTimeoutInSeconds type=double, initial=defaultIncrementalRenderingSuppressionTimeoutInSeconds
index d1aa012..3486be3 100644 (file)
@@ -38,7 +38,7 @@ public:
     enum {
         VideoFullscreenModeNone = 0,
         VideoFullscreenModeStandard = 1 << 0,
-        VideoFullscreenModeOptimized = 1 << 1,
+        VideoFullscreenModePictureInPicture = 1 << 1,
     };
     typedef uint32_t VideoFullscreenMode;
 };
index 4f54dbd..70ef3de 100644 (file)
@@ -693,8 +693,8 @@ void MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer()
         [m_videoInlineLayer insertSublayer:m_videoLayer.get() atIndex:0];
         [m_videoLayer setFrame:m_videoInlineLayer.get().bounds];
     }
-    if ([m_videoLayer respondsToSelector:@selector(setEnterOptimizedFullscreenModeEnabled:)])
-        [m_videoLayer setEnterOptimizedFullscreenModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModeOptimized)];
+    if ([m_videoLayer respondsToSelector:@selector(setPIPModeEnabled:)])
+        [m_videoLayer setPIPModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModePictureInPicture)];
 #else
     [m_videoLayer setFrame:CGRectMake(0, 0, defaultSize.width(), defaultSize.height())];
 #endif
@@ -1186,8 +1186,8 @@ void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity(MediaPlayer::
 
 void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode mode)
 {
-    if (m_videoLayer && [m_videoLayer respondsToSelector:@selector(setEnterOptimizedFullscreenModeEnabled:)])
-        [m_videoLayer setEnterOptimizedFullscreenModeEnabled:(mode & MediaPlayer::VideoFullscreenModeOptimized)];
+    if (m_videoLayer && [m_videoLayer respondsToSelector:@selector(setPIPModeEnabled:)])
+        [m_videoLayer setPIPModeEnabled:(mode & MediaPlayer::VideoFullscreenModePictureInPicture)];
 }
 
 NSArray *MediaPlayerPrivateAVFoundationObjC::timedMetadata() const
index c718f15..d19af01 100644 (file)
@@ -518,11 +518,11 @@ void WebVideoFullscreenControllerContext::setUpFullscreen(HTMLVideoElement& vide
         m_model->setVideoElement(m_videoElement.get());
         m_videoFullscreenLayer = [CALayer layer];
         
-        bool allowsAlternateFullscreen = m_videoElement->mediaSession().allowsAlternateFullscreen(*m_videoElement.get());
+        bool allowsPictureInPicture = m_videoElement->mediaSession().allowsPictureInPicture(*m_videoElement.get());
         IntRect videoElementClientRect = m_videoElement->clientRect();
         
-        dispatch_async(dispatch_get_main_queue(), [strongThis, this, videoElementClientRect, viewRef, mode, allowsAlternateFullscreen] {
-            m_interface->setupFullscreen(*m_videoFullscreenLayer.get(), videoElementClientRect, viewRef.get(), mode, allowsAlternateFullscreen);
+        dispatch_async(dispatch_get_main_queue(), [strongThis, this, videoElementClientRect, viewRef, mode, allowsPictureInPicture] {
+            m_interface->setupFullscreen(*m_videoFullscreenLayer.get(), videoElementClientRect, viewRef.get(), mode, allowsPictureInPicture);
         });
     });
 }
index 1d0fa55..6d234cd 100644 (file)
@@ -91,7 +91,7 @@ public:
     WEBCORE_EXPORT virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
     WEBCORE_EXPORT virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override;
     
-    WEBCORE_EXPORT virtual void setupFullscreen(PlatformLayer&, const IntRect& initialRect, UIView *, HTMLMediaElementEnums::VideoFullscreenMode, bool allowOptimizedFullscreen);
+    WEBCORE_EXPORT virtual void setupFullscreen(PlatformLayer&, const IntRect& initialRect, UIView *, HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicturePlayback);
     WEBCORE_EXPORT virtual void enterFullscreen();
     WEBCORE_EXPORT virtual void exitFullscreen(const IntRect& finalRect);
     WEBCORE_EXPORT virtual void cleanupFullscreen();
@@ -100,17 +100,16 @@ public:
     WEBCORE_EXPORT virtual void preparedToReturnToInline(bool visible, const IntRect& inlineRect);
 
     HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_mode; }
-    bool allowOptimizedFullscreen() const { return m_allowOptimizedFullscreen; }
-    void setIsOptimized(bool);
-    WEBCORE_EXPORT bool mayAutomaticallyShowVideoOptimized() const;
+    bool allowsPictureInPicturePlayback() const { return m_allowsPictureInPicturePlayback; }
+    WEBCORE_EXPORT bool mayAutomaticallyShowVideoPictureInPicture() const;
     void fullscreenMayReturnToInline(std::function<void(bool)> callback);
 
-    void willStartOptimizedFullscreen();
-    void didStartOptimizedFullscreen();
-    void failedToStartOptimizedFullscreen();
-    void willStopOptimizedFullscreen();
-    void didStopOptimizedFullscreen();
-    void prepareForOptimizedFullscreenStopWithCompletionHandler(void (^)(BOOL));
+    void willStartPictureInPicture();
+    void didStartPictureInPicture();
+    void failedToStartPictureInPicture();
+    void willStopPictureInPicture();
+    void didStopPictureInPicture();
+    void prepareForPictureInPictureStopWithCompletionHandler(void (^)(BOOL));
 
     void setMode(HTMLMediaElementEnums::VideoFullscreenMode);
     void clearMode(HTMLMediaElementEnums::VideoFullscreenMode);
@@ -120,7 +119,7 @@ public:
 protected:
     WEBCORE_EXPORT WebVideoFullscreenInterfaceAVKit();
     void beginSession();
-    void enterFullscreenOptimized();
+    void enterPictureInPicture();
     void enterFullscreenStandard();
 
     RetainPtr<WebAVPlayerController> m_playerController;
@@ -138,7 +137,7 @@ protected:
     RetainPtr<UIWindow> m_parentWindow;
     HTMLMediaElementEnums::VideoFullscreenMode m_mode { HTMLMediaElementEnums::VideoFullscreenModeNone };
     std::function<void(bool)> m_prepareToInlineCallback;
-    bool m_allowOptimizedFullscreen { false };
+    bool m_allowsPictureInPicturePlayback { false };
     bool m_exitRequested { false };
     bool m_exitCompleted { false };
     bool m_enterRequested { false };
index c4a497f..9e7b584 100644 (file)
@@ -191,35 +191,35 @@ static const char* boolString(bool val)
     return self.playerControllerProxy;
 }
 
-- (void)playerViewControllerWillStartOptimizedFullscreen:(AVPlayerViewController *)playerViewController
+- (void)playerViewControllerWillStartPictureInPicture:(AVPlayerViewController *)playerViewController
 {
     UNUSED_PARAM(playerViewController);
-    self.fullscreenInterface->willStartOptimizedFullscreen();
+    self.fullscreenInterface->willStartPictureInPicture();
 }
 
-- (void)playerViewControllerDidStartOptimizedFullscreen:(AVPlayerViewController *)playerViewController
+- (void)playerViewControllerDidStartPictureInPicture:(AVPlayerViewController *)playerViewController
 {
     UNUSED_PARAM(playerViewController);
-    self.fullscreenInterface->didStartOptimizedFullscreen();
+    self.fullscreenInterface->didStartPictureInPicture();
 }
 
-- (void)playerViewControllerFailedToStartOptimizedFullscreen:(AVPlayerViewController *)playerViewController withError:(NSError *)error
+- (void)playerViewControllerFailedToStartPictureInPicture:(AVPlayerViewController *)playerViewController withError:(NSError *)error
 {
     UNUSED_PARAM(playerViewController);
     UNUSED_PARAM(error);
-    self.fullscreenInterface->failedToStartOptimizedFullscreen();
+    self.fullscreenInterface->failedToStartPictureInPicture();
 }
 
-- (void)playerViewControllerWillStopOptimizedFullscreen:(AVPlayerViewController *)playerViewController
+- (void)playerViewControllerWillStopPictureInPicture:(AVPlayerViewController *)playerViewController
 {
     UNUSED_PARAM(playerViewController);
-    self.fullscreenInterface->willStopOptimizedFullscreen();
+    self.fullscreenInterface->willStopPictureInPicture();
 }
 
-- (void)playerViewControllerDidStopOptimizedFullscreen:(AVPlayerViewController *)playerViewController
+- (void)playerViewControllerDidStopPictureInPicture:(AVPlayerViewController *)playerViewController
 {
     UNUSED_PARAM(playerViewController);
-    self.fullscreenInterface->didStopOptimizedFullscreen();
+    self.fullscreenInterface->didStopPictureInPicture();
 }
 
 - (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldExitFullScreenWithReason:(AVPlayerViewControllerExitFullScreenReason)reason
@@ -236,10 +236,10 @@ static const char* boolString(bool val)
     return NO;
 }
 
-- (void)playerViewController:(AVPlayerViewController *)playerViewController restoreUserInterfaceForOptimizedFullscreenStopWithCompletionHandler:(void (^)(BOOL restored))completionHandler
+- (void)playerViewController:(AVPlayerViewController *)playerViewController restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:(void (^)(BOOL restored))completionHandler
 {
     UNUSED_PARAM(playerViewController);
-    self.fullscreenInterface->prepareForOptimizedFullscreenStopWithCompletionHandler(completionHandler);
+    self.fullscreenInterface->prepareForPictureInPictureStopWithCompletionHandler(completionHandler);
 }
 
 - (void)play:(id)sender
@@ -547,9 +547,9 @@ static const char* boolString(bool val)
     return [NSSet setWithObjects:@"externalPlaybackActive", nil];
 }
 
-- (BOOL)isOptimizedFullscreenPossible
+- (BOOL)isPictureInPicturePossible
 {
-    return self.fullscreenInterface->allowOptimizedFullscreen();
+    return self.fullscreenInterface->allowsPictureInPicturePlayback();
 }
 @end
 
@@ -876,12 +876,12 @@ void WebVideoFullscreenInterfaceAVKit::setExternalPlayback(bool enabled, Externa
     [m_videoLayerContainer.get() setHidden:enabled];
 }
 
-void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer& videoLayer, const WebCore::IntRect& initialRect, UIView* parentView, HTMLMediaElementEnums::VideoFullscreenMode mode, bool allowOptimizedFullscreen)
+void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer& videoLayer, const WebCore::IntRect& initialRect, UIView* parentView, HTMLMediaElementEnums::VideoFullscreenMode mode, bool allowsPictureInPicturePlayback)
 {
     ASSERT(mode != HTMLMediaElementEnums::VideoFullscreenModeNone);
     LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::setupFullscreen(%p)", this);
 
-    m_allowOptimizedFullscreen = allowOptimizedFullscreen;
+    m_allowsPictureInPicturePlayback = allowsPictureInPicturePlayback;
 
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
@@ -919,7 +919,7 @@ void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer& videoLayer
     [m_playerViewController setShowsPlaybackControls:NO];
     [m_playerViewController setPlayerController:(AVPlayerController *)m_playerController.get()];
     [m_playerViewController setDelegate:m_playerController.get()];
-    [m_playerViewController setAllowsOptimizedFullscreen:allowOptimizedFullscreen];
+    [m_playerViewController setAllowsPictureInPicturePlayback:m_allowsPictureInPicturePlayback];
 
     [m_videoLayerContainer setPlayerViewController:m_playerViewController.get()];
 
@@ -951,22 +951,22 @@ void WebVideoFullscreenInterfaceAVKit::enterFullscreen()
     m_enterRequested = true;
 
     [m_videoLayerContainer setBackgroundColor:[[getUIColorClass() blackColor] CGColor]];
-    if (mode() == HTMLMediaElementEnums::VideoFullscreenModeOptimized)
-        enterFullscreenOptimized();
+    if (mode() == HTMLMediaElementEnums::VideoFullscreenModePictureInPicture)
+        enterPictureInPicture();
     else if (mode() == HTMLMediaElementEnums::VideoFullscreenModeStandard)
         enterFullscreenStandard();
     else
         ASSERT_NOT_REACHED();
 }
 
-void WebVideoFullscreenInterfaceAVKit::enterFullscreenOptimized()
+void WebVideoFullscreenInterfaceAVKit::enterPictureInPicture()
 {
-    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::enterFullscreenOptimized(%p)", this);
+    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::enterPictureInPicture(%p)", this);
     
-    if ([m_playerViewController isOptimizedFullscreenPossible])
-        [m_playerViewController startOptimizedFullscreen];
+    if ([m_playerViewController isPictureInPicturePossible])
+        [m_playerViewController startPictureInPicture];
     else
-        failedToStartOptimizedFullscreen();
+        failedToStartPictureInPicture();
 }
 
 void WebVideoFullscreenInterfaceAVKit::enterFullscreenStandard()
@@ -1004,14 +1004,14 @@ void WebVideoFullscreenInterfaceAVKit::exitFullscreen(const WebCore::IntRect& fi
     [[m_playerViewController view] layoutIfNeeded];
 
 
-    if (isMode(HTMLMediaElementEnums::VideoFullscreenModeOptimized)) {
+    if (isMode(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture)) {
         [m_window setHidden:NO];
-        [m_playerViewController stopOptimizedFullscreen];
-    } else if (isMode(HTMLMediaElementEnums::VideoFullscreenModeOptimized | HTMLMediaElementEnums::VideoFullscreenModeStandard)) {
+        [m_playerViewController stopPictureInPicture];
+    } else if (isMode(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture | HTMLMediaElementEnums::VideoFullscreenModeStandard)) {
         RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
         [m_playerViewController exitFullScreenAnimated:NO completionHandler:[strongThis, this] (BOOL, NSError*) {
             [m_window setHidden:NO];
-            [m_playerViewController stopOptimizedFullscreen];
+            [m_playerViewController stopPictureInPicture];
         }];
     } else if (isMode(HTMLMediaElementEnums::VideoFullscreenModeStandard)) {
         RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
@@ -1054,8 +1054,8 @@ void WebVideoFullscreenInterfaceAVKit::cleanupFullscreen()
     [m_playerViewController setDelegate:nil];
     [m_playerViewController setPlayerController:nil];
     
-    if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeOptimized))
-        [m_playerViewController stopOptimizedFullscreen];
+    if (hasMode(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture))
+        [m_playerViewController stopPictureInPicture];
     if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard))
         [m_playerViewController exitFullScreenAnimated:NO completionHandler:[] (BOOL, NSError *) { }];
     
@@ -1099,7 +1099,7 @@ void WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen()
     if (!m_enterRequested)
         return;
     
-    if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeOptimized))
+    if (hasMode(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture))
         return;
     
     LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen(%p)", this);
@@ -1127,7 +1127,7 @@ void WebVideoFullscreenInterfaceAVKit::preparedToReturnToInline(bool visible, co
     }
 }
 
-bool WebVideoFullscreenInterfaceAVKit::mayAutomaticallyShowVideoOptimized() const
+bool WebVideoFullscreenInterfaceAVKit::mayAutomaticallyShowVideoPictureInPicture() const
 {
     return [m_playerController isPlaying] && m_mode == HTMLMediaElementEnums::VideoFullscreenModeStandard && wkIsOptimizedFullscreenSupported();
 }
@@ -1139,17 +1139,17 @@ void WebVideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline(std::function
         m_fullscreenChangeObserver->fullscreenMayReturnToInline();
 }
 
-void WebVideoFullscreenInterfaceAVKit::willStartOptimizedFullscreen()
+void WebVideoFullscreenInterfaceAVKit::willStartPictureInPicture()
 {
-    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::willStartOptimizedFullscreen(%p)", this);
-    setMode(HTMLMediaElementEnums::VideoFullscreenModeOptimized);
+    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::willStartPictureInPicture(%p)", this);
+    setMode(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture);
 
     if (!hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard))
         return;
 
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     fullscreenMayReturnToInline([strongThis, this](bool visible) {
-        LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::willStartOptimizedFullscreen - lambda(%p) - visible(%s)", this, boolString(visible));
+        LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::willStartPictureInPicture - lambda(%p) - visible(%s)", this, boolString(visible));
 
         if (!visible) {
             [m_window setHidden:YES];
@@ -1167,9 +1167,9 @@ void WebVideoFullscreenInterfaceAVKit::willStartOptimizedFullscreen()
     });
 }
 
-void WebVideoFullscreenInterfaceAVKit::didStartOptimizedFullscreen()
+void WebVideoFullscreenInterfaceAVKit::didStartPictureInPicture()
 {
-    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::didStartOptimizedFullscreen(%p)", this);
+    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::didStartPictureInPicture(%p)", this);
     [m_playerViewController setShowsPlaybackControls:YES];
     [m_window setHidden:YES];
 
@@ -1177,9 +1177,9 @@ void WebVideoFullscreenInterfaceAVKit::didStartOptimizedFullscreen()
         m_fullscreenChangeObserver->didEnterFullscreen();
 }
 
-void WebVideoFullscreenInterfaceAVKit::failedToStartOptimizedFullscreen()
+void WebVideoFullscreenInterfaceAVKit::failedToStartPictureInPicture()
 {
-    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::failedToStartOptimizedFullscreen(%p)", this);
+    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::failedToStartPictureInPicture(%p)", this);
     [m_playerViewController setShowsPlaybackControls:YES];
 
     if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard))
@@ -1194,18 +1194,18 @@ void WebVideoFullscreenInterfaceAVKit::failedToStartOptimizedFullscreen()
         m_videoFullscreenModel->requestExitFullscreen();
 }
 
-void WebVideoFullscreenInterfaceAVKit::willStopOptimizedFullscreen()
+void WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture()
 {
-    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::willStopOptimizedFullscreen(%p)", this);
+    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture(%p)", this);
     [m_window setHidden:NO];
 
     if (m_videoFullscreenModel)
         m_videoFullscreenModel->requestExitFullscreen();
 }
 
-void WebVideoFullscreenInterfaceAVKit::didStopOptimizedFullscreen()
+void WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture()
 {
-    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::didStopOptimizedFullscreen(%p)", this);
+    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture(%p)", this);
     if (hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard))
         return;
 
@@ -1214,20 +1214,20 @@ void WebVideoFullscreenInterfaceAVKit::didStopOptimizedFullscreen()
     [m_videoLayerContainer setBackgroundColor:[[getUIColorClass() clearColor] CGColor]];
     [[m_playerViewController view] setBackgroundColor:[getUIColorClass() clearColor]];
 
-    clearMode(HTMLMediaElementEnums::VideoFullscreenModeOptimized);
+    clearMode(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture);
     [m_window setHidden:YES];
     
     if (m_fullscreenChangeObserver)
         m_fullscreenChangeObserver->didExitFullscreen();
 }
 
-void WebVideoFullscreenInterfaceAVKit::prepareForOptimizedFullscreenStopWithCompletionHandler(void (^completionHandler)(BOOL restored))
+void WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler(void (^completionHandler)(BOOL restored))
 {
-    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::prepareForOptimizedFullscreenStopWithCompletionHandler(%p)", this);
+    LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler(%p)", this);
     RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
     RetainPtr<id> strongCompletionHandler = adoptNS([completionHandler copy]);
     fullscreenMayReturnToInline([strongThis, strongCompletionHandler](bool restored)  {
-        LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::prepareForOptimizedFullscreenStopWithCompletionHandler lambda(%p) - restored(%s)", strongThis.get(), boolString(restored));
+        LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler lambda(%p) - restored(%s)", strongThis.get(), boolString(restored));
         void (^completionHandler)(BOOL restored) = strongCompletionHandler.get();
         completionHandler(restored);
     });
index b7cd313..cabd509 100644 (file)
@@ -78,20 +78,18 @@ typedef NS_ENUM(NSInteger, AVPlayerViewControllerExitFullScreenReason) {
     AVPlayerViewControllerExitFullScreenReasonRemoteControlStopEventReceived = 3,
 };
 - (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldExitFullScreenWithReason:(AVPlayerViewControllerExitFullScreenReason)reason;
-- (void)playerViewController:(AVPlayerViewController *)playerViewController restoreUserInterfaceForOptimizedFullscreenStopWithCompletionHandler:(void (^)(BOOL restored))completionHandler;
+- (void)playerViewController:(AVPlayerViewController *)playerViewController restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:(void (^)(BOOL restored))completionHandler;
 @end
 
-typedef NSInteger AVPlayerViewControllerOptimizedFullscreenStopReason;
-
 @interface AVPlayerViewController (Details)
 - (instancetype)initWithVideoLayer:(CALayer <AVVideoLayer> *)videoLayer;
 - (void)enterFullScreenAnimated:(BOOL)animated completionHandler:(void (^)(BOOL success, NSError *))completionHandler;
 - (void)exitFullScreenAnimated:(BOOL)animated completionHandler:(void (^)(BOOL success, NSError *))completionHandler;
 
-- (BOOL)isOptimizedFullscreenPossible;
-- (void)startOptimizedFullscreen;
-- (void)stopOptimizedFullscreen;
-- (void)setAllowsOptimizedFullscreen:(BOOL)allowsOptimizedFullscreen;
+- (BOOL)isPictureInPicturePossible;
+- (void)startPictureInPicture;
+- (void)stopPictureInPicture;
+- (void)setAllowsPictureInPicturePlayback:(BOOL)allow;
 
 @property (nonatomic, strong) AVPlayerController *playerController;
 @property (nonatomic, weak) id <AVPlayerViewControllerDelegate> delegate;
index 08c482d..3668468 100644 (file)
@@ -66,8 +66,8 @@
 
 #if !HAVE(AVKIT) || !USE(APPLE_INTERNAL_SDK) || __IPHONE_OS_VERSION_MIN_REQUIRED < 90000
 
-@interface AVPlayerLayer (AVPlayerLayerOptimizedFullscreenModeSupportPrivate)
-- (void)setEnterOptimizedFullscreenModeEnabled:(BOOL)flag;
+@interface AVPlayerLayer (AVPlayerLayerPictureInPictureModeSupportPrivate)
+- (void)setPIPModeEnabled:(BOOL)flag;
 @end
 
 #endif
index f0cfcf5..3d78f5a 100644 (file)
@@ -1,3 +1,24 @@
+2015-06-18  Jon Lee  <jonlee@apple.com>
+
+        Update AVKit usage of pip
+        https://bugs.webkit.org/show_bug.cgi?id=146095
+        <rdar://problem/21386853>
+
+        Reviewed by Eric Carlson.
+
+        - Rename preference key
+        - Rename shouldAllowAlternateFullscreen to shouldAllowPictureInPictureMediaPlayback
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences allowsAlternateFullscreen]): Call allowsPictureInPictureMediaPlayback.
+        (-[WebPreferences setAllowsAlternateFullscreen:]):
+        (-[WebPreferences allowsPictureInPictureMediaPlayback]): Added.
+        (-[WebPreferences setAllowsPictureInPictureMediaPlayback:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+
 2015-06-18  Anders Carlsson  <andersca@apple.com>
 
         Remove shouldInterruptJavaScript
index d0a9aa4..3f0c8dd 100644 (file)
 #define WebKitHixie76WebSocketProtocolEnabledKey @"WebKitHixie76WebSocketProtocolEnabled"
 #define WebKitRequiresUserGestureForMediaPlaybackPreferenceKey @"WebKitMediaPlaybackRequiresUserGesture"
 #define WebKitAllowsInlineMediaPlaybackPreferenceKey @"WebKitMediaPlaybackAllowsInline"
-#define WebKitAllowsAlternateFullscreenPreferenceKey @"WebKitAllowsAlternateFullscreen"
+#define WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey @"WebKitAllowsPictureInPictureMediaPlayback"
 #define WebKitAllowsAirPlayForMediaPlaybackPreferenceKey @"WebKitMediaPlaybackAllowsAirPlay"
 #define WebKitMockScrollbarsEnabledPreferenceKey @"WebKitMockScrollbarsEnabled"
 #define WebKitShouldDisplaySubtitlesPreferenceKey @"WebKitShouldDisplaySubtitles"
index b0131a7..7fa82d8 100644 (file)
@@ -546,7 +546,7 @@ public:
 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
         [NSNumber numberWithBool:YES],  WebKitAllowsAirPlayForMediaPlaybackPreferenceKey,
 #endif
-        [NSNumber numberWithBool:YES],  WebKitAllowsAlternateFullscreenPreferenceKey,
+        [NSNumber numberWithBool:YES],  WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitRequestAnimationFrameEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitWantsBalancedSetDefersLoadingBehaviorKey,
         [NSNumber numberWithBool:NO],   WebKitDiagnosticLoggingEnabledKey,
@@ -2197,12 +2197,22 @@ static NSString *classIBCreatorID = nil;
 
 - (BOOL)allowsAlternateFullscreen
 {
-    return [self _boolValueForKey:WebKitAllowsAlternateFullscreenPreferenceKey];
+    return [self allowsPictureInPictureMediaPlayback];
 }
 
 - (void)setAllowsAlternateFullscreen:(BOOL)flag
 {
-    [self _setBoolValue:flag forKey:WebKitAllowsAlternateFullscreenPreferenceKey];
+    [self setAllowsPictureInPictureMediaPlayback:flag];
+}
+
+- (BOOL)allowsPictureInPictureMediaPlayback
+{
+    return [self _boolValueForKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
+}
+
+- (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
 }
 
 - (BOOL)mockScrollbarsEnabled
index 6eb2976..347769e 100644 (file)
@@ -253,6 +253,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (void)setAllowsAlternateFullscreen:(BOOL)flag;
 - (BOOL)allowsAlternateFullscreen;
 
+- (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag;
+- (BOOL)allowsPictureInPictureMediaPlayback;
+
 - (NSString *)pictographFontFamily;
 - (void)setPictographFontFamily:(NSString *)family;
 
index 7b2ac74..15e3b74 100644 (file)
@@ -851,11 +851,11 @@ static bool shouldAllowDisplayAndRunningOfInsecureContent()
     return shouldAllowDisplayAndRunningOfInsecureContent;
 }
 
-static bool shouldAllowAlternateFullscreen()
+static bool shouldAllowPictureInPictureMediaPlayback()
 {
 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000
-    static bool shouldAllowAlternateFullscreen = iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_9_0);
-    return shouldAllowAlternateFullscreen;
+    static bool shouldAllowPictureInPictureMediaPlayback = iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_9_0);
+    return shouldAllowPictureInPictureMediaPlayback;
 #else
     return false;
 #endif
@@ -2294,7 +2294,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
     settings.setRequiresUserGestureForMediaPlayback([preferences mediaPlaybackRequiresUserGesture]);
     settings.setAllowsInlineMediaPlayback([preferences mediaPlaybackAllowsInline]);
-    settings.setAllowsAlternateFullscreen([preferences allowsAlternateFullscreen] && shouldAllowAlternateFullscreen());
+    settings.setAllowsPictureInPictureMediaPlayback([preferences allowsPictureInPictureMediaPlayback] && shouldAllowPictureInPictureMediaPlayback());
     settings.setSuppressesIncrementalRendering([preferences suppressesIncrementalRendering]);
     settings.setBackspaceKeyNavigationEnabled([preferences backspaceKeyNavigationEnabled]);
     settings.setWantsBalancedSetDefersLoadingBehavior([preferences wantsBalancedSetDefersLoadingBehavior]);
index 5465fb3..54afbcf 100644 (file)
@@ -1,3 +1,37 @@
+2015-06-18  Jon Lee  <jonlee@apple.com>
+
+        Update AVKit usage of pip
+        https://bugs.webkit.org/show_bug.cgi?id=146095
+        <rdar://problem/21386853>
+
+        Reviewed by Eric Carlson.
+
+        - Rename preference key
+        - Rename shouldAllowAlternateFullscreen to shouldAllowPictureInPictureMediaPlayback
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp: Remove unused preference calls.
+        (WKPreferencesSetAllowsAlternateFullscreen): Deleted.
+        (WKPreferencesGetAllowsAlternateFullscreen): Deleted.
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _isShowingVideoPictureInPicture]): Renamed.
+        (-[WKWebView _isShowingVideoOptimized]): Deleted.
+        (-[WKWebView _mayAutomaticallyShowVideoPictureInPicture]): Renamed.
+        (-[WKWebView _mayAutomaticallyShowVideoOptimized]): Deleted.
+        (shouldAllowPictureInPictureMediaPlayback): Renamed.
+        (shouldAllowAlternateFullscreen): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.h: Rename local variables.
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in:
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture): Renamed.
+        (WebKit::WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoOptimized): Deleted.
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/ios/WebVideoFullscreenManager.mm:
+
 2015-06-18  Jeremy Jones  <jeremyj@apple.com>
 
         Fix crash when entering fullscreen during exit fullscreen animation.
index 56921d9..300b607 100644 (file)
     macro(AVFoundationEnabled, isAVFoundationEnabled, Bool, bool, true) \
     macro(RequiresUserGestureForMediaPlayback, requiresUserGestureForMediaPlayback, Bool, bool, DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK) \
     macro(AllowsInlineMediaPlayback, allowsInlineMediaPlayback, Bool, bool, DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK) \
-    macro(AllowsAlternateFullscreen, allowsAlternateFullscreen, Bool, bool, true) \
+    macro(AllowsPictureInPictureMediaPlayback, allowsPictureInPictureMediaPlayback, Bool, bool, true) \
     macro(AllowsAirPlayForMediaPlayback, allowsAirPlayForMediaPlayback, Bool, bool, true) \
     macro(InspectorStartsAttached, inspectorStartsAttached, Bool, bool, true) \
     macro(ShowsToolTipOverTruncatedText, showsToolTipOverTruncatedText, Bool, bool, false) \
index 10ec777..e0e5922 100644 (file)
@@ -748,16 +748,6 @@ bool WKPreferencesGetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->allowsInlineMediaPlayback();
 }
 
-void WKPreferencesSetAllowsAlternateFullscreen(WKPreferencesRef preferencesRef, bool flag)
-{
-    toImpl(preferencesRef)->setAllowsAlternateFullscreen(flag);
-}
-
-bool WKPreferencesGetAllowsAlternateFullscreen(WKPreferencesRef preferencesRef)
-{
-    return toImpl(preferencesRef)->allowsAlternateFullscreen();
-}
-
 void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setShowsToolTipOverTruncatedText(flag);
index ba18b2f..0c9e935 100644 (file)
@@ -179,10 +179,6 @@ WK_EXPORT bool WKPreferencesGetMediaPlaybackRequiresUserGesture(WKPreferencesRef
 WK_EXPORT void WKPreferencesSetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef);
 
-// Defaults to true.
-WK_EXPORT void WKPreferencesSetAllowsAlternateFullscreen(WKPreferencesRef preferencesRef, bool flag);
-WK_EXPORT bool WKPreferencesGetAllowsAlternateFullscreen(WKPreferencesRef preferencesRef);
-
 // Defaults to false.
 WK_EXPORT void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef);
index af026be..7041122 100644 (file)
@@ -242,15 +242,15 @@ static int32_t deviceOrientation()
     return deviceOrientationForUIInterfaceOrientation([[UIApplication sharedApplication] statusBarOrientation]);
 }
 
-- (BOOL)_isShowingVideoOptimized
+- (BOOL)_isShowingVideoPictureInPicture
 {
     if (!_page || !_page->videoFullscreenManager())
         return false;
     
-    return _page->videoFullscreenManager()->hasMode(WebCore::HTMLMediaElementEnums::VideoFullscreenModeOptimized);
+    return _page->videoFullscreenManager()->hasMode(WebCore::HTMLMediaElementEnums::VideoFullscreenModePictureInPicture);
 }
 
-- (BOOL)_mayAutomaticallyShowVideoOptimized
+- (BOOL)_mayAutomaticallyShowVideoPictureInPicture
 {
 #if (__IPHONE_OS_VERSION_MIN_REQUIRED <= 80200) || !HAVE(AVKIT)
     return false;
@@ -258,15 +258,15 @@ static int32_t deviceOrientation()
     if (!_page || !_page->videoFullscreenManager())
         return false;
 
-    return _page->videoFullscreenManager()->mayAutomaticallyShowVideoOptimized();
+    return _page->videoFullscreenManager()->mayAutomaticallyShowVideoPictureInPicture();
 #endif
 }
 
-static bool shouldAllowAlternateFullscreen()
+static bool shouldAllowPictureInPictureMediaPlayback()
 {
 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000
-    static bool shouldAllowAlternateFullscreen = iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_9_0);
-    return shouldAllowAlternateFullscreen;
+    static bool shouldAllowPictureInPictureMediaPlayback = iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_9_0);
+    return shouldAllowPictureInPictureMediaPlayback;
 #else
     return false;
 #endif
@@ -323,7 +323,7 @@ static bool shouldAllowAlternateFullscreen()
     webPageConfiguration.alwaysRunsAtForegroundPriority = [_configuration _alwaysRunsAtForegroundPriority];
 
     webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::allowsInlineMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsInlineMediaPlayback]));
-    webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::allowsAlternateFullscreenKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsPictureInPictureMediaPlayback] && shouldAllowAlternateFullscreen()));
+    webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::allowsPictureInPictureMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsPictureInPictureMediaPlayback] && shouldAllowPictureInPictureMediaPlayback()));
     webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::requiresUserGestureForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration requiresUserActionForMediaPlayback]));
 #endif
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
index a7ac597..df3e7d7 100644 (file)
@@ -98,8 +98,8 @@ struct PrintInfo;
 - (void)_didFinishLoadForMainFrame;
 - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType;
 
-- (BOOL)_isShowingVideoOptimized;
-- (BOOL)_mayAutomaticallyShowVideoOptimized;
+- (BOOL)_isShowingVideoPictureInPicture;
+- (BOOL)_mayAutomaticallyShowVideoPictureInPicture;
 
 - (void)_updateScrollViewBackground;
 
index 5732072..ca72a77 100644 (file)
@@ -185,10 +185,10 @@ bool PageClientImpl::isViewVisible()
     if (isViewInWindow() && !m_contentView.isBackground)
         return true;
     
-    if ([m_webView _isShowingVideoOptimized])
+    if ([m_webView _isShowingVideoPictureInPicture])
         return true;
     
-    if ([m_webView _mayAutomaticallyShowVideoOptimized])
+    if ([m_webView _mayAutomaticallyShowVideoPictureInPicture])
         return true;
     
     return false;
index 7e0be76..834324f 100644 (file)
@@ -108,7 +108,7 @@ public:
 
     void requestHideAndExitFullscreen();
     bool hasMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) const;
-    bool mayAutomaticallyShowVideoOptimized() const;
+    bool mayAutomaticallyShowVideoPictureInPicture() const;
 
 private:
     friend class WebVideoFullscreenModelContext;
@@ -123,7 +123,7 @@ private:
     WebCore::WebVideoFullscreenInterfaceAVKit& 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 allowOptimizedFullscreen);
+    void setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicture);
     void resetMediaState(uint64_t contextId);
     void setCurrentTime(uint64_t contextId, double currentTime, double hostTime);
     void setBufferedTime(uint64_t contextId, double bufferedTime);
index 0c5dc11..6bb076d 100644 (file)
@@ -33,7 +33,7 @@ messages -> WebVideoFullscreenManagerProxy {
     SetExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName)
     SetDuration(uint64_t contextId, double duration)
     SetRate(uint64_t contextId, bool isPlaying, double rate)
-    SetupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowOptimizedFullscreen)
+    SetupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture)
     EnterFullscreen(uint64_t contextId)
     ExitFullscreen(uint64_t contextId, WebCore::IntRect finalRect)
     CleanupFullscreen(uint64_t contextId)
index e6ada12..49537e4 100644 (file)
@@ -62,7 +62,7 @@ bool WebVideoFullscreenManagerProxy::hasMode(HTMLMediaElementEnums::VideoFullscr
     return false;
 }
 
-bool WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoOptimized() const
+bool WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture() const
 {
     return false;
 }
@@ -266,10 +266,10 @@ bool WebVideoFullscreenManagerProxy::hasMode(HTMLMediaElementEnums::VideoFullscr
     return false;
 }
 
-bool WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoOptimized() const
+bool WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture() const
 {
     for (auto& tuple : m_contextMap.values()) {
-        if (std::get<1>(tuple)->mayAutomaticallyShowVideoOptimized())
+        if (std::get<1>(tuple)->mayAutomaticallyShowVideoPictureInPicture())
             return true;
     }
     return false;
@@ -306,7 +306,7 @@ WebCore::WebVideoFullscreenInterfaceAVKit& WebVideoFullscreenManagerProxy::ensur
 
 #pragma mark Messages from WebVideoFullscreenManager
 
-void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingDeviceScaleFactor, HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowOptimizedFullscreen)
+void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingDeviceScaleFactor, HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture)
 {
     ASSERT(videoLayerID);
     RefPtr<WebVideoFullscreenModelContext> model;
@@ -323,7 +323,7 @@ void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint64_t contextId, u
     }
 
     UIView *parentView = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_page->drawingArea()).remoteLayerTreeHost().rootLayer();
-    interface->setupFullscreen(*model->layerHost(), initialRect, parentView, videoFullscreenMode, allowOptimizedFullscreen);
+    interface->setupFullscreen(*model->layerHost(), initialRect, parentView, videoFullscreenMode, allowsPictureInPicture);
 }
 
 void WebVideoFullscreenManagerProxy::resetMediaState(uint64_t contextId)
index 928e5dd..9ff5979 100644 (file)
@@ -2799,7 +2799,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings.setAccelerated2dCanvasEnabled(store.getBoolValueForKey(WebPreferencesKey::accelerated2dCanvasEnabledKey()));
     settings.setRequiresUserGestureForMediaPlayback(store.getBoolValueForKey(WebPreferencesKey::requiresUserGestureForMediaPlaybackKey()));
     settings.setAllowsInlineMediaPlayback(store.getBoolValueForKey(WebPreferencesKey::allowsInlineMediaPlaybackKey()));
-    settings.setAllowsAlternateFullscreen(store.getBoolValueForKey(WebPreferencesKey::allowsAlternateFullscreenKey()));
+    settings.setAllowsPictureInPictureMediaPlayback(store.getBoolValueForKey(WebPreferencesKey::allowsPictureInPictureMediaPlaybackKey()));
     settings.setMockScrollbarsEnabled(store.getBoolValueForKey(WebPreferencesKey::mockScrollbarsEnabledKey()));
     settings.setHyperlinkAuditingEnabled(store.getBoolValueForKey(WebPreferencesKey::hyperlinkAuditingEnabledKey()));
     settings.setRequestAnimationFrameEnabled(store.getBoolValueForKey(WebPreferencesKey::requestAnimationFrameEnabledKey()));
index 3fef687..66188e4 100644 (file)
@@ -240,9 +240,9 @@ void WebVideoFullscreenManager::enterVideoFullscreenForVideoElement(HTMLVideoEle
         return;
     interface->setIsAnimating(true);
 
-    bool allowOptimizedFullscreen = videoElement.mediaSession().allowsAlternateFullscreen(videoElement);
+    bool allowsPictureInPicture = videoElement.mediaSession().allowsPictureInPicture(videoElement);
     
-    m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface->layerHostingContext()->contextID(), clientRectForElement(&videoElement), m_page->deviceScaleFactor(), interface->fullscreenMode(), allowOptimizedFullscreen), m_page->pageID());
+    m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface->layerHostingContext()->contextID(), clientRectForElement(&videoElement), m_page->deviceScaleFactor(), interface->fullscreenMode(), allowsPictureInPicture), m_page->pageID());
 }
 
 void WebVideoFullscreenManager::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement)