Title: [184946] trunk/Source
Revision
184946
Author
jon...@apple.com
Date
2015-05-28 00:27:13 -0700 (Thu, 28 May 2015)

Log Message

Fix macros for wireless playback
https://bugs.webkit.org/show_bug.cgi?id=145239
rdar://problem/21049541

Reviewed by Anders Carlsson.

Encompass the logic within ENABLE(WIRELESS_TARGET_PLAYBACK). Update property name.

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Wrap in ENABLE.
(-[WebPreferences allowsAirPlayForMediaPlayback]): Ditto.
(-[WebPreferences setAllowsAirPlayForMediaPlayback:]): Ditto.
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]): Ditto.

Source/WebKit2:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.h: Update names. Add a WKDeprecated
category section.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]): Update name of variables to reflect new property names.
(-[WKWebViewConfiguration copyWithZone:]): Ditto.
(-[WKWebViewConfiguration mediaPlaybackAllowsAirPlay]): Get and set off of the new
variable.
(-[WKWebViewConfiguration setMediaPlaybackAllowsAirPlay:]): Ditto.
(-[WKWebViewConfiguration mediaPlaybackRequiresUserAction]): Ditto.
(-[WKWebViewConfiguration setMediaPlaybackRequiresUserAction:]): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (184945 => 184946)


--- trunk/Source/WebKit/mac/ChangeLog	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-05-28 07:27:13 UTC (rev 184946)
@@ -1,3 +1,22 @@
+2015-05-22  Jon Lee  <jon...@apple.com>
+
+        Fix macros for wireless playback
+        https://bugs.webkit.org/show_bug.cgi?id=145239
+        rdar://problem/21049541
+
+        Reviewed by Anders Carlsson.
+
+        Encompass the logic within ENABLE(WIRELESS_TARGET_PLAYBACK). Update property name.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]): Wrap in ENABLE.
+        (-[WebPreferences allowsAirPlayForMediaPlayback]): Ditto.
+        (-[WebPreferences setAllowsAirPlayForMediaPlayback:]): Ditto.
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]): Ditto.
+
 2015-05-27  Dean Jackson  <d...@apple.com>
 
         img.currentSrc problem in strict mode with old picturefill

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (184945 => 184946)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2015-05-28 07:27:13 UTC (rev 184946)
@@ -122,6 +122,7 @@
 #define WebKitRequiresUserGestureForMediaPlaybackPreferenceKey @"WebKitMediaPlaybackRequiresUserGesture"
 #define WebKitAllowsInlineMediaPlaybackPreferenceKey @"WebKitMediaPlaybackAllowsInline"
 #define WebKitAllowsAlternateFullscreenPreferenceKey @"WebKitAllowsAlternateFullscreen"
+#define WebKitAllowsAirPlayForMediaPlaybackPreferenceKey @"WebKitMediaPlaybackAllowsAirPlay"
 #define WebKitMockScrollbarsEnabledPreferenceKey @"WebKitMockScrollbarsEnabled"
 #define WebKitShouldDisplaySubtitlesPreferenceKey @"WebKitShouldDisplaySubtitles"
 #define WebKitShouldDisplayCaptionsPreferenceKey @"WebKitShouldDisplayCaptions"
@@ -130,7 +131,6 @@
 #define WebKitSuppressesIncrementalRenderingKey @"WebKitSuppressesIncrementalRendering"
 #define WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey @"WebKitSubpixelCSSOMElementMetricsEnabled"
 #if TARGET_OS_IPHONE
-#define WebKitAllowsAirPlayForMediaPlaybackPreferenceKey @"WebKitMediaPlaybackAllowsAirPlay"
 #define WebKitAudioSessionCategoryOverride @"WebKitAudioSessionCategoryOverride"
 #define WebKitAVKitEnabled @"WebKitAVKitEnabled"
 #endif

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.h (184945 => 184946)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.h	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.h	2015-05-28 07:27:13 UTC (rev 184946)
@@ -267,4 +267,9 @@
 */
 @property (nonatomic) BOOL suppressesIncrementalRendering;
 
+/*!
+    @property allowsAirPlayForMediaPlayback
+ */
+@property (nonatomic) BOOL allowsAirPlayForMediaPlayback;
+
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (184945 => 184946)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2015-05-28 07:27:13 UTC (rev 184946)
@@ -529,7 +529,6 @@
 #else
         [NSNumber numberWithBool:YES],  WebKitRequiresUserGestureForMediaPlaybackPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitAllowsInlineMediaPlaybackPreferenceKey,
-        [NSNumber numberWithBool:YES],  WebKitAllowsAirPlayForMediaPlaybackPreferenceKey,
         [NSNumber numberWithUnsignedInt:AudioSession::None],  WebKitAudioSessionCategoryOverride,
 #if HAVE(AVKIT)
         [NSNumber numberWithBool:YES],  WebKitAVKitEnabled,
@@ -545,6 +544,9 @@
 
         [NSNumber numberWithBool:YES],   WebKitShouldRespectImageOrientationKey,
 #endif // PLATFORM(IOS)
+#if ENABLE(WIRELESS_TARGET_PLAYBACK)
+        [NSNumber numberWithBool:YES],  WebKitAllowsAirPlayForMediaPlaybackPreferenceKey,
+#endif
         [NSNumber numberWithBool:YES],  WebKitAllowsAlternateFullscreenPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitRequestAnimationFrameEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitWantsBalancedSetDefersLoadingBehaviorKey,
@@ -2076,6 +2078,22 @@
     [self _setBoolValue:flag forKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
 }
 
+- (BOOL)allowsAirPlayForMediaPlayback
+{
+#if ENABLE(WIRELESS_TARGET_PLAYBACK)
+    return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
+#else
+    return false;
+#endif
+}
+
+- (void)setAllowsAirPlayForMediaPlayback:(BOOL)flag
+{
+#if ENABLE(WIRELESS_TARGET_PLAYBACK)
+    [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
+#endif
+}
+
 #if PLATFORM(IOS)
 - (BOOL)mediaPlaybackAllowsAirPlay
 {

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (184945 => 184946)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2015-05-28 07:27:13 UTC (rev 184946)
@@ -2343,6 +2343,9 @@
     settings.setRubberBandingForSubScrollableRegionsEnabled(false);
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    settings.setAllowsAirPlayForMediaPlayback([preferences allowsAirPlayForMediaPlayback]);
+#endif
 #if PLATFORM(IOS)
     settings.setStandalone([preferences _standalone]);
     settings.setTelephoneNumberParsingEnabled([preferences _telephoneNumberParsingEnabled]);
@@ -2350,7 +2353,6 @@
     settings.setLayoutInterval(std::chrono::milliseconds([preferences _layoutInterval]));
     settings.setMaxParseDuration([preferences _maxParseDuration]);
     settings.setAlwaysUseAcceleratedOverflowScroll([preferences _alwaysUseAcceleratedOverflowScroll]);
-    settings.setAllowsAirPlayForMediaPlayback([preferences mediaPlaybackAllowsAirPlay]);
     settings.setAudioSessionCategoryOverride([preferences audioSessionCategoryOverride]);
     settings.setNetworkDataUsageTrackingEnabled([preferences networkDataUsageTrackingEnabled]);
     settings.setNetworkInterfaceName([preferences networkInterfaceName]);

Modified: trunk/Source/WebKit2/ChangeLog (184945 => 184946)


--- trunk/Source/WebKit2/ChangeLog	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit2/ChangeLog	2015-05-28 07:27:13 UTC (rev 184946)
@@ -1,3 +1,26 @@
+2015-05-22  Jon Lee  <jon...@apple.com>
+
+        Fix macros for wireless playback
+        https://bugs.webkit.org/show_bug.cgi?id=145239
+        rdar://problem/21049541
+
+        Reviewed by Anders Carlsson.
+
+        Encompass the logic within ENABLE(WIRELESS_TARGET_PLAYBACK). Update property name.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.h: Update names. Add a WKDeprecated
+        category section.
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]): Update name of variables to reflect new property names.
+        (-[WKWebViewConfiguration copyWithZone:]): Ditto.
+        (-[WKWebViewConfiguration mediaPlaybackAllowsAirPlay]): Get and set off of the new
+        variable.
+        (-[WKWebViewConfiguration setMediaPlaybackAllowsAirPlay:]): Ditto.
+        (-[WKWebViewConfiguration mediaPlaybackRequiresUserAction]): Ditto.
+        (-[WKWebViewConfiguration setMediaPlaybackRequiresUserAction:]): Ditto.
+
 2015-05-27  Brady Eidson  <beid...@apple.com>
 
         Add a "should open urls externally" flag to DocumentLoader.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (184945 => 184946)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-05-28 07:27:13 UTC (rev 184946)
@@ -322,9 +322,11 @@
 #if PLATFORM(IOS)
     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::requiresUserGestureForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration mediaPlaybackRequiresUserAction]));
-    webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::allowsAirPlayForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration mediaPlaybackAllowsAirPlay]));
+    webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::requiresUserGestureForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration requiresUserActionForMediaPlayback]));
 #endif
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    webPageConfiguration.preferenceValues.set(WebKit::WebPreferencesKey::allowsAirPlayForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsAirPlayForMediaPlayback]));
+#endif
 
 #if PLATFORM(IOS)
     _scrollView = adoptNS([[WKScrollView alloc] initWithFrame:bounds]);

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (184945 => 184946)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h	2015-05-28 07:27:13 UTC (rev 184946)
@@ -88,6 +88,11 @@
 */
 @property (WK_NULLABLE_PROPERTY nonatomic, copy) NSString *applicationNameForUserAgent WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
+/*! @abstract A Boolean value indicating whether AirPlay is allowed.
+ @discussion The default value is YES.
+ */
+@property (nonatomic) BOOL allowsAirPlayForMediaPlayback WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
 #if TARGET_OS_IPHONE
 /*! @abstract A Boolean value indicating whether HTML5 videos play inline
  (YES) or use the native full-screen controller (NO).
@@ -99,13 +104,8 @@
  user to start playing them (YES) or can play automatically (NO).
  @discussion The default value is YES.
  */
-@property (nonatomic) BOOL mediaPlaybackRequiresUserAction;
+@property (nonatomic) BOOL requiresUserActionForMediaPlayback WK_AVAILABLE(NA, WK_IOS_TBA);
 
-/*! @abstract A Boolean value indicating whether AirPlay is allowed.
- @discussion The default value is YES.
- */
-@property (nonatomic) BOOL mediaPlaybackAllowsAirPlay;
-
 /*! @abstract The level of granularity with which the user can interactively
  select content in the web view.
  @discussion Possible values are described in WKSelectionGranularity.
@@ -117,6 +117,15 @@
 
 @end
 
+@interface WKWebViewConfiguration (WKDeprecated)
+
+#if TARGET_OS_IPHONE
+@property (nonatomic) BOOL mediaPlaybackRequiresUserAction WK_DEPRECATED(NA, NA, 8_0, WK_IOS_TBA, "Please use requiresUserActionForMediaPlayback");
+@property (nonatomic) BOOL mediaPlaybackAllowsAirPlay WK_DEPRECATED(NA, NA, 8_0, WK_IOS_TBA, "Please use allowsAirPlayForMediaPlayback");
+#endif
+
+@end
+
 WK_ASSUME_NONNULL_END
 
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (184945 => 184946)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2015-05-28 06:14:50 UTC (rev 184945)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2015-05-28 07:27:13 UTC (rev 184946)
@@ -103,11 +103,13 @@
         return nil;
     
 #if PLATFORM(IOS)
-    _mediaPlaybackRequiresUserAction = YES;
-    _mediaPlaybackAllowsAirPlay = YES;
+    _requiresUserActionForMediaPlayback = YES;
     _allowsAlternateFullscreen = YES;
 #endif
-    
+#if ENABLE(WIRELESS_TARGET_PLAYBACK)
+    _allowsAirPlayForMediaPlayback = YES;
+#endif
+
     return self;
 }
 
@@ -138,10 +140,12 @@
 #if PLATFORM(IOS)
     configuration->_allowsInlineMediaPlayback = self->_allowsInlineMediaPlayback;
     configuration->_allowsAlternateFullscreen = self->_allowsAlternateFullscreen;
-    configuration->_mediaPlaybackRequiresUserAction = self->_mediaPlaybackRequiresUserAction;
-    configuration->_mediaPlaybackAllowsAirPlay = self->_mediaPlaybackAllowsAirPlay;
+    configuration->_requiresUserActionForMediaPlayback = self->_requiresUserActionForMediaPlayback;
     configuration->_selectionGranularity = self->_selectionGranularity;
 #endif
+#if ENABLE(WIRELESS_TARGET_PLAYBACK)
+    configuration->_allowsAirPlayForMediaPlayback = self->_allowsAirPlayForMediaPlayback;
+#endif
 
     return configuration;
 }
@@ -323,4 +327,30 @@
 
 @end
 
+@implementation WKWebViewConfiguration (WKDeprecated)
+
+#if PLATFORM(IOS)
+- (BOOL)mediaPlaybackAllowsAirPlay
+{
+    return self.allowsAirPlayForMediaPlayback;
+}
+
+- (void)setMediaPlaybackAllowsAirPlay:(BOOL)allowed
+{
+    self.allowsAirPlayForMediaPlayback = allowed;
+}
+
+- (BOOL)mediaPlaybackRequiresUserAction
+{
+    return self.requiresUserActionForMediaPlayback;
+}
+
+- (void)setMediaPlaybackRequiresUserAction:(BOOL)required
+{
+    self.requiresUserActionForMediaPlayback = required;
+}
+#endif // PLATFORM(IOS)
+
+@end
+
 #endif // WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to