[WK2] Add allowsPictureInPictureMediaPlayback
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Jun 2015 18:07:02 +0000 (18:07 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Jun 2015 18:07:02 +0000 (18:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145901
rdar://problem/21349851

Reviewed by Anders Carlsson.

Replace _allowsAlternateFullscreen with allowsPictureInPictureMediaPlayback.

* UIProcess/API/Cocoa/WKWebViewConfiguration.h: Add allowsPictureInPictureMediaPlayback.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]): Remove _allowsAlternateFullscreen.
(-[WKWebViewConfiguration copyWithZone:]): Replace the variable.
(-[WKWebViewConfiguration _allowsAlternateFullscreen]): Deleted.
(-[WKWebViewConfiguration _setAllowsAlternateFullscreen:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Remove the SPI.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]): Update to use the new API.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h

index f548221..9947440 100644 (file)
@@ -1,3 +1,24 @@
+2015-06-11  Jon Lee  <jonlee@apple.com>
+
+        [WK2] Add allowsPictureInPictureMediaPlayback
+        https://bugs.webkit.org/show_bug.cgi?id=145901
+        rdar://problem/21349851
+
+        Reviewed by Anders Carlsson.
+
+        Replace _allowsAlternateFullscreen with allowsPictureInPictureMediaPlayback.
+
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.h: Add allowsPictureInPictureMediaPlayback.
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]): Remove _allowsAlternateFullscreen.
+        (-[WKWebViewConfiguration copyWithZone:]): Replace the variable.
+        (-[WKWebViewConfiguration _allowsAlternateFullscreen]): Deleted.
+        (-[WKWebViewConfiguration _setAllowsAlternateFullscreen:]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Remove the SPI.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]): Update to use the new API.
+
 2015-06-12  Alexey Proskuryakov  <ap@apple.com>
 
         -[WKWebView evaluateJavaScript] provides a misleading error when the return cannot be serialized
index 5ea4268..2bb6840 100644 (file)
@@ -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 _allowsAlternateFullscreen] && shouldAllowAlternateFullscreen()));
+    webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::allowsAlternateFullscreenKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsPictureInPictureMediaPlayback] && shouldAllowAlternateFullscreen()));
     webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::requiresUserGestureForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration requiresUserActionForMediaPlayback]));
 #endif
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
index 2c414fa..f51feaa 100644 (file)
@@ -113,6 +113,12 @@ WK_CLASS_AVAILABLE(10_10, 8_0)
  */
 @property (nonatomic) WKSelectionGranularity selectionGranularity;
 
+/*! @abstract A Boolean value indicating whether HTML5 videos may play
+ picture-in-picture.
+ @discussion The default value is YES.
+ */
+@property (nonatomic) BOOL allowsPictureInPictureMediaPlayback WK_AVAILABLE(NA, WK_IOS_TBA);
+
 #endif
 
 @end
index a36c946..2ec7e69 100644 (file)
@@ -93,7 +93,6 @@ private:
 
 #if PLATFORM(IOS)
     LazyInitialized<RetainPtr<WKWebViewContentProviderRegistry>> _contentProviderRegistry;
-    BOOL _allowsAlternateFullscreen;
     BOOL _alwaysRunsAtForegroundPriority;
 #endif
 }
@@ -105,8 +104,9 @@ private:
     
 #if PLATFORM(IOS)
     _requiresUserActionForMediaPlayback = YES;
-    _allowsAlternateFullscreen = YES;
+    _allowsPictureInPictureMediaPlayback = YES;
 #endif
+
 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
     _allowsAirPlayForMediaPlayback = YES;
 #endif
@@ -140,7 +140,7 @@ private:
 
 #if PLATFORM(IOS)
     configuration->_allowsInlineMediaPlayback = self->_allowsInlineMediaPlayback;
-    configuration->_allowsAlternateFullscreen = self->_allowsAlternateFullscreen;
+    configuration->_allowsPictureInPictureMediaPlayback = self->_allowsPictureInPictureMediaPlayback;
     configuration->_alwaysRunsAtForegroundPriority = _alwaysRunsAtForegroundPriority;
     configuration->_requiresUserActionForMediaPlayback = self->_requiresUserActionForMediaPlayback;
     configuration->_selectionGranularity = self->_selectionGranularity;
@@ -316,16 +316,6 @@ static NSString *defaultApplicationNameForUserAgent()
 }
 
 #if PLATFORM(IOS)
-- (BOOL)_allowsAlternateFullscreen
-{
-    return _allowsAlternateFullscreen;
-}
-
-- (void)_setAllowsAlternateFullscreen:(BOOL)allowed
-{
-    _allowsAlternateFullscreen = allowed;
-}
-
 - (BOOL)_alwaysRunsAtForegroundPriority
 {
     return _alwaysRunsAtForegroundPriority;
index 4cc8cbf..bfe2efa 100644 (file)
@@ -45,8 +45,6 @@
 @property (nonatomic, setter=_setTreatsSHA1SignedCertificatesAsInsecure:) BOOL _treatsSHA1SignedCertificatesAsInsecure WK_AVAILABLE(NA, WK_IOS_TBA);
 
 #if TARGET_OS_IPHONE
-@property (nonatomic, setter=_setAllowsAlternateFullscreen:) BOOL _allowsAlternateFullscreen WK_AVAILABLE(NA, WK_IOS_TBA);
-
 @property (nonatomic, setter=_setAlwaysRunsAtForegroundPriority:) BOOL _alwaysRunsAtForegroundPriority WK_AVAILABLE(NA, WK_IOS_TBA);
 #endif