<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[201154] branches/safari-602.1.32-branch</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/201154">201154</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-05-19 02:35:58 -0700 (Thu, 19 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/200951">r200951</a>. rdar://problem/25584201</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602132branchSourceWebKit2ChangeLog">branches/safari-602.1.32-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari602132branchSourceWebKit2SharedWebPreferencesDefinitionsh">branches/safari-602.1.32-branch/Source/WebKit2/Shared/WebPreferencesDefinitions.h</a></li>
<li><a href="#branchessafari602132branchSourceWebKit2UIProcessAPICocoaWKWebViewmm">branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#branchessafari602132branchSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationh">branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h</a></li>
<li><a href="#branchessafari602132branchSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationmm">branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm</a></li>
<li><a href="#branchessafari602132branchSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationPrivateh">branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h</a></li>
<li><a href="#branchessafari602132branchSourceWebKit2UIProcessCocoaVersionChecksh">branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/Cocoa/VersionChecks.h</a></li>
<li><a href="#branchessafari602132branchToolsChangeLog">branches/safari-602.1.32-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari602132branchToolsTestWebKitAPITestsWebKit2CocoaRequiresUserActionForPlaybackmm">branches/safari-602.1.32-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm</a></li>
<li><a href="#branchessafari602132branchToolsWebKitTestRunnercocoaTestControllerCocoamm">branches/safari-602.1.32-branch/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602132branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebKit2/ChangeLog (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebKit2/ChangeLog        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Source/WebKit2/ChangeLog        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -1,5 +1,36 @@
</span><span class="cx"> 2016-05-19 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r200951. rdar://problem/25584201
+
+ 2016-04-06 Jer Noble <jer.noble@apple.com>
+
+ [WK2] Add API to WKWebViewConfiguration to control autoplay policy.
+ https://bugs.webkit.org/show_bug.cgi?id=156312
+
+ Reviewed by Dan Bernstein.
+
+ Add a new API to WKWebViewConfiguration to allow fine-grained control over when media is allowed
+ to play without a user gesture, and simultaneously deprecate the existing, all-or-nothing API,
+ and deprecated the equivalent SPIs.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration init]):
+ (-[WKWebViewConfiguration encodeWithCoder:]):
+ (-[WKWebViewConfiguration initWithCoder:]):
+ (-[WKWebViewConfiguration copyWithZone:]):
+ (-[WKWebViewConfiguration _requiresUserActionForVideoPlayback]):
+ (-[WKWebViewConfiguration _setRequiresUserActionForVideoPlayback:]):
+ (-[WKWebViewConfiguration _requiresUserActionForAudioPlayback]):
+ (-[WKWebViewConfiguration _setRequiresUserActionForAudioPlayback:]):
+ (-[WKWebViewConfiguration requiresUserActionForMediaPlayback]):
+ (-[WKWebViewConfiguration setRequiresUserActionForMediaPlayback:]):
+ * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+
+2016-05-19 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r201079. rdar://problem/26334648
</span><span class="cx">
</span><span class="cx"> 2016-05-18 Brian Burg <bburg@apple.com>
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebKit2SharedWebPreferencesDefinitionsh"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebKit2/Shared/WebPreferencesDefinitions.h (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebKit2/Shared/WebPreferencesDefinitions.h        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Source/WebKit2/Shared/WebPreferencesDefinitions.h        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -74,7 +74,6 @@
</span><span class="cx"> #define DEFAULT_INLINE_MEDIA_PLAYBACK_REQUIRES_PLAYS_INLINE_ATTRIBUTE true
</span><span class="cx"> #define DEFAULT_INVISIBLE_AUTOPLAY_NOT_PERMITTED true
</span><span class="cx"> #define DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY false
</span><del>-#define DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK true
</del><span class="cx"> #define DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM false
</span><span class="cx"> #define DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED false
</span><span class="cx"> #else
</span><span class="lines">@@ -89,7 +88,6 @@
</span><span class="cx"> #define DEFAULT_INLINE_MEDIA_PLAYBACK_REQUIRES_PLAYS_INLINE_ATTRIBUTE false
</span><span class="cx"> #define DEFAULT_INVISIBLE_AUTOPLAY_NOT_PERMITTED false
</span><span class="cx"> #define DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY true
</span><del>-#define DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK false
</del><span class="cx"> #define DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM true
</span><span class="cx"> #define DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED true
</span><span class="cx"> #endif
</span><span class="lines">@@ -150,9 +148,9 @@
</span><span class="cx"> macro(AllowFileAccessFromFileURLs, allowFileAccessFromFileURLs, Bool, bool, false, "", "") \
</span><span class="cx"> macro(AVFoundationEnabled, isAVFoundationEnabled, Bool, bool, true, "", "") \
</span><span class="cx"> macro(AVFoundationNSURLSessionEnabled, isAVFoundationNSURLSessionEnabled, Bool, bool, true, "", "") \
</span><del>- macro(RequiresUserGestureForMediaPlayback, requiresUserGestureForMediaPlayback, Bool, bool, DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK, "", "") \
</del><ins>+ macro(RequiresUserGestureForMediaPlayback, requiresUserGestureForMediaPlayback, Bool, bool, false, "", "") \
</ins><span class="cx"> macro(RequiresUserGestureForVideoPlayback, requiresUserGestureForVideoPlayback, Bool, bool, false, "", "") \
</span><del>- macro(RequiresUserGestureForAudioPlayback, requiresUserGestureForAudioPlayback, Bool, bool, false, "", "") \
</del><ins>+ macro(RequiresUserGestureForAudioPlayback, requiresUserGestureForAudioPlayback, Bool, bool, true, "", "") \
</ins><span class="cx"> macro(MainContentUserGestureOverrideEnabled, mainContentUserGestureOverrideEnabled, Bool, bool, false, "", "") \
</span><span class="cx"> macro(AllowsInlineMediaPlayback, allowsInlineMediaPlayback, Bool, bool, DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK, "", "") \
</span><span class="cx"> macro(InlineMediaPlaybackRequiresPlaysInlineAttribute, inlineMediaPlaybackRequiresPlaysInlineAttribute, Bool, bool, DEFAULT_INLINE_MEDIA_PLAYBACK_REQUIRES_PLAYS_INLINE_ATTRIBUTE, "", "") \
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -457,13 +457,13 @@
</span><span class="cx"> pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::allowsInlineMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsInlineMediaPlayback]));
</span><span class="cx"> pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::inlineMediaPlaybackRequiresPlaysInlineAttributeKey(), WebKit::WebPreferencesStore::Value(!![_configuration _inlineMediaPlaybackRequiresPlaysInlineAttribute]));
</span><span class="cx"> pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::allowsPictureInPictureMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsPictureInPictureMediaPlayback] && shouldAllowPictureInPictureMediaPlayback()));
</span><del>- pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::requiresUserGestureForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration requiresUserActionForMediaPlayback]));
</del><span class="cx"> pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::userInterfaceDirectionPolicyKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(WebCore::UserInterfaceDirectionPolicy::Content)));
</span><span class="cx"> pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::systemLayoutDirectionKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(WebCore::LTR)));
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::requiresUserGestureForVideoPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration _requiresUserActionForVideoPlayback]));
- pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::requiresUserGestureForAudioPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration _requiresUserActionForAudioPlayback]));
</del><ins>+ WKAudiovisualMediaTypes mediaTypesRequiringUserGesture = [_configuration mediaTypesRequiringUserActionForPlayback];
+ pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::requiresUserGestureForVideoPlaybackKey(), WebKit::WebPreferencesStore::Value((mediaTypesRequiringUserGesture & WKAudiovisualMediaTypeVideo) == WKAudiovisualMediaTypeVideo));
+ pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::requiresUserGestureForAudioPlaybackKey(), WebKit::WebPreferencesStore::Value(((mediaTypesRequiringUserGesture & WKAudiovisualMediaTypeAudio) == WKAudiovisualMediaTypeAudio)));
</ins><span class="cx"> pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::mainContentUserGestureOverrideEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _mainContentUserGestureOverrideEnabled]));
</span><span class="cx"> pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::invisibleAutoplayNotPermittedKey(), WebKit::WebPreferencesStore::Value(!![_configuration _invisibleAutoplayNotPermitted]));
</span><span class="cx"> pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::mediaDataLoadsAutomaticallyKey(), WebKit::WebPreferencesStore::Value(!![_configuration _mediaDataLoadsAutomatically]));
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationh"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -95,6 +95,20 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/*! @enum WKAudiovisualMediaTypes
+ @abstract The types of audiovisual media which will require a user gesture to begin playing.
+ @constant WKAudiovisualMediaTypeNone No audiovisual media will require a user gesture to begin playing.
+ @constant WKAudiovisualMediaTypeAudio Audiovisual media containing audio will require a user gesture to begin playing.
+ @constant WKAudiovisualMediaTypeVideo Audiovisual media containing video will require a user gesture to begin playing.
+ @constant WKAudiovisualMediaTypeAll All audiovisual media will require a user gesture to begin playing.
+*/
+typedef NS_OPTIONS(NSUInteger, WKAudiovisualMediaTypes) {
+ WKAudiovisualMediaTypeNone = 0,
+ WKAudiovisualMediaTypeAudio = 1 << 0,
+ WKAudiovisualMediaTypeVideo = 1 << 1,
+ WKAudiovisualMediaTypeAll = NSUIntegerMax
+} WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
</ins><span class="cx"> /*! A WKWebViewConfiguration object is a collection of properties with
</span><span class="cx"> which to initialize a web view.
</span><span class="cx"> @helps Contains properties used to configure a @link WKWebView @/link.
</span><span class="lines">@@ -137,6 +151,8 @@
</span><span class="cx"> */
</span><span class="cx"> @property (nonatomic) BOOL allowsAirPlayForMediaPlayback WK_AVAILABLE(10_11, 9_0);
</span><span class="cx">
</span><ins>+@property (nonatomic) WKAudiovisualMediaTypes mediaTypesRequiringUserActionForPlayback WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
</ins><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> /*! @abstract A Boolean value indicating whether HTML5 videos play inline
</span><span class="cx"> (YES) or use the native full-screen controller (NO).
</span><span class="lines">@@ -144,12 +160,6 @@
</span><span class="cx"> */
</span><span class="cx"> @property (nonatomic) BOOL allowsInlineMediaPlayback;
</span><span class="cx">
</span><del>-/*! @abstract A Boolean value indicating whether HTML5 videos require the
- user to start playing them (YES) or can play automatically (NO).
- @discussion The default value is YES.
- */
-@property (nonatomic) BOOL requiresUserActionForMediaPlayback WK_AVAILABLE(NA, 9_0);
-
</del><span class="cx"> /*! @abstract The level of granularity with which the user can interactively
</span><span class="cx"> select content in the web view.
</span><span class="cx"> @discussion Possible values are described in WKSelectionGranularity.
</span><span class="lines">@@ -189,6 +199,7 @@
</span><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> @property (nonatomic) BOOL mediaPlaybackRequiresUserAction WK_DEPRECATED(NA, NA, 8_0, 9_0, "Please use requiresUserActionForMediaPlayback");
</span><span class="cx"> @property (nonatomic) BOOL mediaPlaybackAllowsAirPlay WK_DEPRECATED(NA, NA, 8_0, 9_0, "Please use allowsAirPlayForMediaPlayback");
</span><ins>+@property (nonatomic) BOOL requiresUserActionForMediaPlayback WK_DEPRECATED(NA, NA, 9_0, 10_0, "Please use mediaTypesRequiringUserActionForPlayback");
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><span class="cx"> #import "APIPageConfiguration.h"
</span><ins>+#import "VersionChecks.h"
</ins><span class="cx"> #import "WKPreferences.h"
</span><span class="cx"> #import "WKProcessPool.h"
</span><span class="cx"> #import "WKUserContentController.h"
</span><span class="lines">@@ -112,8 +113,6 @@
</span><span class="cx"> BOOL _invisibleAutoplayNotPermitted;
</span><span class="cx"> BOOL _mediaDataLoadsAutomatically;
</span><span class="cx"> BOOL _attachmentElementEnabled;
</span><del>- BOOL _requiresUserActionForVideoPlayback;
- BOOL _requiresUserActionForAudioPlayback;
</del><span class="cx"> BOOL _mainContentUserGestureOverrideEnabled;
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="lines">@@ -133,7 +132,6 @@
</span><span class="cx"> return nil;
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>- _requiresUserActionForMediaPlayback = YES;
</del><span class="cx"> _allowsPictureInPictureMediaPlayback = YES;
</span><span class="cx"> _allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
</span><span class="cx"> _inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback;
</span><span class="lines">@@ -142,8 +140,10 @@
</span><span class="cx"> _mediaDataLoadsAutomatically = YES;
</span><span class="cx"> _userInterfaceDirectionPolicy = WKUserInterfaceDirectionPolicyContent;
</span><span class="cx"> #endif
</span><del>- _requiresUserActionForVideoPlayback = NO;
- _requiresUserActionForAudioPlayback = NO;
</del><ins>+ if (linkedOnOrAfter(WebKit::LibraryVersion::FirstWithMediaTypesRequiringUserActionForPlayback))
+ _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAudio;
+ else
+ _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;
</ins><span class="cx"> _mainContentUserGestureOverrideEnabled = NO;
</span><span class="cx"> _invisibleAutoplayNotPermitted = NO;
</span><span class="cx">
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> [coder encodeInteger:self.dataDetectorTypes forKey:@"dataDetectorTypes"];
</span><span class="cx"> [coder encodeBool:self.allowsInlineMediaPlayback forKey:@"allowsInlineMediaPlayback"];
</span><del>- [coder encodeBool:self.requiresUserActionForMediaPlayback forKey:@"requiresUserActionForMediaPlayback"];
</del><ins>+ [coder encodeBool:self.mediaTypesRequiringUserActionForPlayback forKey:@"mediaTypesRequiringUserActionForPlayback"];
</ins><span class="cx"> [coder encodeInteger:self.selectionGranularity forKey:@"selectionGranularity"];
</span><span class="cx"> [coder encodeBool:self.allowsPictureInPictureMediaPlayback forKey:@"allowsPictureInPictureMediaPlayback"];
</span><span class="cx"> #else
</span><span class="lines">@@ -227,7 +227,7 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> self.dataDetectorTypes = [coder decodeIntegerForKey:@"dataDetectorTypes"];
</span><span class="cx"> self.allowsInlineMediaPlayback = [coder decodeBoolForKey:@"allowsInlineMediaPlayback"];
</span><del>- self.requiresUserActionForMediaPlayback = [coder decodeBoolForKey:@"requiresUserActionForMediaPlayback"];
</del><ins>+ self.mediaTypesRequiringUserActionForPlayback = [coder decodeBoolForKey:@"mediaTypesRequiringUserActionForPlayback"];
</ins><span class="cx"> self.selectionGranularity = static_cast<WKSelectionGranularity>([coder decodeIntegerForKey:@"selectionGranularity"]);
</span><span class="cx"> self.allowsPictureInPictureMediaPlayback = [coder decodeBoolForKey:@"allowsPictureInPictureMediaPlayback"];
</span><span class="cx"> #else
</span><span class="lines">@@ -269,14 +269,12 @@
</span><span class="cx"> configuration->_invisibleAutoplayNotPermitted = self->_invisibleAutoplayNotPermitted;
</span><span class="cx"> configuration->_mediaDataLoadsAutomatically = self->_mediaDataLoadsAutomatically;
</span><span class="cx"> configuration->_attachmentElementEnabled = self->_attachmentElementEnabled;
</span><del>- configuration->_requiresUserActionForVideoPlayback = self->_requiresUserActionForVideoPlayback;
- configuration->_requiresUserActionForAudioPlayback = self->_requiresUserActionForAudioPlayback;
</del><ins>+ configuration->_mediaTypesRequiringUserActionForPlayback = self->_mediaTypesRequiringUserActionForPlayback;
</ins><span class="cx"> configuration->_mainContentUserGestureOverrideEnabled = self->_mainContentUserGestureOverrideEnabled;
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> configuration->_allowsInlineMediaPlayback = self->_allowsInlineMediaPlayback;
</span><span class="cx"> configuration->_inlineMediaPlaybackRequiresPlaysInlineAttribute = self->_inlineMediaPlaybackRequiresPlaysInlineAttribute;
</span><del>- configuration->_requiresUserActionForMediaPlayback = self->_requiresUserActionForMediaPlayback;
</del><span class="cx"> configuration->_allowsPictureInPictureMediaPlayback = self->_allowsPictureInPictureMediaPlayback;
</span><span class="cx"> configuration->_alwaysRunsAtForegroundPriority = _alwaysRunsAtForegroundPriority;
</span><span class="cx"> configuration->_selectionGranularity = self->_selectionGranularity;
</span><span class="lines">@@ -598,22 +596,28 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)_requiresUserActionForVideoPlayback
</span><span class="cx"> {
</span><del>- return _requiresUserActionForVideoPlayback;
</del><ins>+ return self.mediaTypesRequiringUserActionForPlayback & WKAudiovisualMediaTypeVideo;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_setRequiresUserActionForVideoPlayback:(BOOL)requiresUserActionForVideoPlayback
</span><span class="cx"> {
</span><del>- _requiresUserActionForVideoPlayback = requiresUserActionForVideoPlayback;
</del><ins>+ if (requiresUserActionForVideoPlayback)
+ self.mediaTypesRequiringUserActionForPlayback |= WKAudiovisualMediaTypeVideo;
+ else
+ self.mediaTypesRequiringUserActionForPlayback &= ~WKAudiovisualMediaTypeVideo;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_requiresUserActionForAudioPlayback
</span><span class="cx"> {
</span><del>- return _requiresUserActionForAudioPlayback;
</del><ins>+ return self.mediaTypesRequiringUserActionForPlayback & WKAudiovisualMediaTypeAudio;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_setRequiresUserActionForAudioPlayback:(BOOL)requiresUserActionForAudioPlayback
</span><span class="cx"> {
</span><del>- _requiresUserActionForAudioPlayback = requiresUserActionForAudioPlayback;
</del><ins>+ if (requiresUserActionForAudioPlayback)
+ self.mediaTypesRequiringUserActionForPlayback |= WKAudiovisualMediaTypeAudio;
+ else
+ self.mediaTypesRequiringUserActionForPlayback &= ~WKAudiovisualMediaTypeAudio;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_mainContentUserGestureOverrideEnabled
</span><span class="lines">@@ -686,6 +690,17 @@
</span><span class="cx"> {
</span><span class="cx"> self.requiresUserActionForMediaPlayback = required;
</span><span class="cx"> }
</span><ins>+
+- (BOOL)requiresUserActionForMediaPlayback
+{
+ return self.mediaTypesRequiringUserActionForPlayback == WKAudiovisualMediaTypeAll;
+}
+
+- (void)setRequiresUserActionForMediaPlayback:(BOOL)requiresUserActionForMediaPlayback
+{
+ self.mediaTypesRequiringUserActionForPlayback = requiresUserActionForMediaPlayback ? WKAudiovisualMediaTypeAll : WKAudiovisualMediaTypeNone;
+}
+
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationPrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -50,8 +50,6 @@
</span><span class="cx"> @property (nonatomic, setter=_setConvertsPositionStyleOnCopy:) BOOL _convertsPositionStyleOnCopy WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="cx"> @property (nonatomic, setter=_setAllowsMetaRefresh:) BOOL _allowsMetaRefresh WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="cx"> @property (nonatomic, setter=_setAllowUniversalAccessFromFileURLs:) BOOL _allowUniversalAccessFromFileURLs WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><del>-@property (nonatomic, setter=_setRequiresUserActionForAudioPlayback:) BOOL _requiresUserActionForAudioPlayback WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
-@property (nonatomic, setter=_setRequiresUserActionForVideoPlayback:) BOOL _requiresUserActionForVideoPlayback WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</del><span class="cx"> @property (nonatomic, setter=_setMainContentUserGestureOverrideEnabled:) BOOL _mainContentUserGestureOverrideEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="cx"> @property (nonatomic, setter=_setInvisibleAutoplayNotPermitted:) BOOL _invisibleAutoplayNotPermitted WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="cx"> @property (nonatomic, setter=_setMediaDataLoadsAutomatically:) BOOL _mediaDataLoadsAutomatically WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="lines">@@ -69,6 +67,8 @@
</span><span class="cx"> @property (nonatomic, strong, setter=_setVisitedLinkProvider:) _WKVisitedLinkProvider *_visitedLinkProvider WK_DEPRECATED(10_10, WK_MAC_TBA, 8_0, WK_IOS_TBA, "Please use _visitedLinkStore instead");
</span><span class="cx">
</span><span class="cx"> @property (nonatomic, strong, setter=_setWebsiteDataStore:) _WKWebsiteDataStore *_websiteDataStore WK_DEPRECATED(10_10, 10_11, 8_0, 9_0, "Please use websiteDataStore instead");
</span><ins>+@property (nonatomic, setter=_setRequiresUserActionForAudioPlayback:) BOOL _requiresUserActionForAudioPlayback WK_DEPRECATED(WK_MAC_TBA, WK_MAC_TBA, WK_IOS_TBA, WK_IOS_TBA, "Please use mediaTypesRequiringUserActionForPlayback");
+@property (nonatomic, setter=_setRequiresUserActionForVideoPlayback:) BOOL _requiresUserActionForVideoPlayback WK_DEPRECATED(WK_MAC_TBA, WK_MAC_TBA, WK_IOS_TBA, WK_IOS_TBA, "Please use mediaTypesRequiringUserActionForPlayback");
</ins><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebKit2UIProcessCocoaVersionChecksh"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/Cocoa/VersionChecks.h (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/Cocoa/VersionChecks.h        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Source/WebKit2/UIProcess/Cocoa/VersionChecks.h        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> */
</span><span class="cx"> enum class LibraryVersion {
</span><span class="cx"> FirstWithNetworkCache = 0x02590116, // 601.1.22
</span><ins>+ FirstWithMediaTypesRequiringUserActionForPlayback = 0x025A0121, // 602.1.33
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> bool linkedOnOrAfter(LibraryVersion);
</span></span></pre></div>
<a id="branchessafari602132branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Tools/ChangeLog (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Tools/ChangeLog        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Tools/ChangeLog        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -1,5 +1,21 @@
</span><span class="cx"> 2016-05-19 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r200951. rdar://problem/25584201
+
+ 2016-04-06 Jer Noble <jer.noble@apple.com>
+
+ [WK2] Add API to WKWebViewConfiguration to control autoplay policy.
+ https://bugs.webkit.org/show_bug.cgi?id=156312
+
+ Reviewed by Dan Bernstein.
+
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::initializeWebViewConfiguration):
+ * TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm:
+ (TEST_F):
+
+2016-05-19 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r201090. rdar://problem/26334636
</span><span class="cx">
</span><span class="cx"> 2016-05-18 Simon Fraser <simon.fraser@apple.com>
</span></span></pre></div>
<a id="branchessafari602132branchToolsTestWebKitAPITestsWebKit2CocoaRequiresUserActionForPlaybackmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -77,7 +77,6 @@
</span><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> configuration.get().allowsInlineMediaPlayback = YES;
</span><span class="cx"> configuration.get()._inlineMediaPlaybackRequiresPlaysInlineAttribute = NO;
</span><del>- configuration.get().requiresUserActionForMediaPlayback = NO;
</del><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -169,6 +168,45 @@
</span><span class="cx">
</span><span class="cx"> TEST_F(RequiresUserActionForPlaybackTest, RequiresUserActionForAudioAndVideoPlayback)
</span><span class="cx"> {
</span><ins>+ configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAudio | WKAudiovisualMediaTypeVideo;
+ createWebView();
+
+ testVideoWithAudio();
+ EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
+ testVideoWithoutAudio();
+ EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
+ testAudioOnly();
+ EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
+}
+
+TEST_F(RequiresUserActionForPlaybackTest, RequiresUserActionForAudioButNotVideoPlayback)
+{
+ configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAudio;
+ createWebView();
+
+ testVideoWithAudio();
+ EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
+ testVideoWithoutAudio();
+ EXPECT_WK_STREQ(@"playing", (NSString *)[lastScriptMessage body]);
+ testAudioOnly();
+ EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
+}
+
+TEST_F(RequiresUserActionForPlaybackTest, RequiresUserActionForVideoButNotAudioPlayback)
+{
+ configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeVideo;
+ createWebView();
+
+ testVideoWithAudio();
+ EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
+ testVideoWithoutAudio();
+ EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
+ testAudioOnly();
+ EXPECT_WK_STREQ(@"playing", (NSString *)[lastScriptMessage body]);
+}
+
+TEST_F(RequiresUserActionForPlaybackTest, DeprecatedRequiresUserActionForAudioAndVideoPlayback)
+{
</ins><span class="cx"> configuration.get()._requiresUserActionForAudioPlayback = YES;
</span><span class="cx"> configuration.get()._requiresUserActionForVideoPlayback = YES;
</span><span class="cx"> createWebView();
</span><span class="lines">@@ -181,7 +219,7 @@
</span><span class="cx"> EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TEST_F(RequiresUserActionForPlaybackTest, RequiresUserActionForAudioButNotVideoPlayback)
</del><ins>+TEST_F(RequiresUserActionForPlaybackTest, DeprecatedRequiresUserActionForAudioButNotVideoPlayback)
</ins><span class="cx"> {
</span><span class="cx"> configuration.get()._requiresUserActionForAudioPlayback = YES;
</span><span class="cx"> configuration.get()._requiresUserActionForVideoPlayback = NO;
</span><span class="lines">@@ -195,7 +233,7 @@
</span><span class="cx"> EXPECT_WK_STREQ(@"not playing", (NSString *)[lastScriptMessage body]);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TEST_F(RequiresUserActionForPlaybackTest, RequiresUserActionForVideoButNotAudioPlayback)
</del><ins>+TEST_F(RequiresUserActionForPlaybackTest, DeprecatedRequiresUserActionForVideoButNotAudioPlayback)
</ins><span class="cx"> {
</span><span class="cx"> configuration.get()._requiresUserActionForAudioPlayback = NO;
</span><span class="cx"> configuration.get()._requiresUserActionForVideoPlayback = YES;
</span></span></pre></div>
<a id="branchessafari602132branchToolsWebKitTestRunnercocoaTestControllerCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (201153 => 201154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm        2016-05-19 08:41:20 UTC (rev 201153)
+++ branches/safari-602.1.32-branch/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm        2016-05-19 09:35:58 UTC (rev 201154)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx"> globalWebViewConfiguration._mediaDataLoadsAutomatically = YES;
</span><span class="cx"> globalWebViewConfiguration.requiresUserActionForMediaPlayback = NO;
</span><span class="cx"> #endif
</span><ins>+ globalWebViewConfiguration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>