Diff
Modified: trunk/LayoutTests/ChangeLog (189128 => 189129)
--- trunk/LayoutTests/ChangeLog 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/LayoutTests/ChangeLog 2015-08-28 22:57:01 UTC (rev 189129)
@@ -1,5 +1,19 @@
2015-08-28 Jer Noble <[email protected]>
+ [iOS] Add WebKit/WebKit2 settings to control automatic data loading
+ https://bugs.webkit.org/show_bug.cgi?id=148579
+
+ Reviewed by Anders Carlsson.
+
+ Restriction setting moved from a global to a specific session.
+
+ * media/video-restricted-no-preload-auto-expected.txt:
+ * media/video-restricted-no-preload-auto.html:
+ * media/video-restricted-no-preload-metadata-expected.txt:
+ * media/video-restricted-no-preload-metadata.html:
+
+2015-08-28 Jer Noble <[email protected]>
+
Unreviewed gardening; fix (rebaseline) expected results for media/video-fullscreeen-only-playback.html after r189112.
* media/video-fullscreeen-only-playback-expected.txt:
Modified: trunk/LayoutTests/media/video-restricted-no-preload-auto-expected.txt (189128 => 189129)
--- trunk/LayoutTests/media/video-restricted-no-preload-auto-expected.txt 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/LayoutTests/media/video-restricted-no-preload-auto-expected.txt 2015-08-28 22:57:01 UTC (rev 189129)
@@ -3,7 +3,7 @@
** setting video.src
EXPECTED (video.preload == 'auto') OK
-RUN(internals.setMediaSessionRestrictions('video', 'AutoPreloadingNotPermitted'))
+RUN(internals.setMediaElementRestrictions(video, 'AutoPreloadingNotPermitted'))
EVENT(loadedmetadata)
EXPECTED (video.readyState < '2') OK
Modified: trunk/LayoutTests/media/video-restricted-no-preload-auto.html (189128 => 189129)
--- trunk/LayoutTests/media/video-restricted-no-preload-auto.html 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/LayoutTests/media/video-restricted-no-preload-auto.html 2015-08-28 22:57:01 UTC (rev 189129)
@@ -49,7 +49,7 @@
waitForEvent('loadedmetadata', loadedmetadata);
waitForEvent('canplaythrough', canplaythrough);
failTestIn(2000);
- run("internals.setMediaSessionRestrictions('video', 'AutoPreloadingNotPermitted')");
+ run("internals.setMediaElementRestrictions(video, 'AutoPreloadingNotPermitted')");
consoleWrite("");
}
</script>
Modified: trunk/LayoutTests/media/video-restricted-no-preload-metadata-expected.txt (189128 => 189129)
--- trunk/LayoutTests/media/video-restricted-no-preload-metadata-expected.txt 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/LayoutTests/media/video-restricted-no-preload-metadata-expected.txt 2015-08-28 22:57:01 UTC (rev 189129)
@@ -3,7 +3,7 @@
** setting video.src
EXPECTED (video.preload == 'auto') OK
-RUN(internals.setMediaSessionRestrictions('video', 'MetadataPreloadingNotPermitted'))
+RUN(internals.setMediaElementRestrictions(video, 'MetadataPreloadingNotPermitted'))
** Pausing...
** 250ms timer fired
Modified: trunk/LayoutTests/media/video-restricted-no-preload-metadata.html (189128 => 189129)
--- trunk/LayoutTests/media/video-restricted-no-preload-metadata.html 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/LayoutTests/media/video-restricted-no-preload-metadata.html 2015-08-28 22:57:01 UTC (rev 189129)
@@ -37,7 +37,7 @@
testExpected("video.preload", "auto");
waitForEvent('loadedmetadata', loadedmetadata);
- run("internals.setMediaSessionRestrictions('video', 'MetadataPreloadingNotPermitted')");
+ run("internals.setMediaElementRestrictions(video, 'MetadataPreloadingNotPermitted')");
// Wait 250ms before load()ing to make sure setting src did not kick off the load.
consoleWrite("** Pausing...<br>");
Modified: trunk/Source/WebCore/ChangeLog (189128 => 189129)
--- trunk/Source/WebCore/ChangeLog 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/ChangeLog 2015-08-28 22:57:01 UTC (rev 189129)
@@ -1,3 +1,27 @@
+2015-08-28 Jer Noble <[email protected]>
+
+ [iOS] Add WebKit/WebKit2 settings to control automatic data loading
+ https://bugs.webkit.org/show_bug.cgi?id=148579
+
+ Reviewed by Anders Carlsson.
+
+ Move the automatic and metadata restrictions from PlatformMediaSessionManager (where access
+ to Settings is unavailable) to MediaElementSession (where it is available). Add properties
+ to Settings so that clients can control this behavior at runtime. Move these restrictions
+ between the two Internals functions which can set them for testing purposes.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::HTMLMediaElement):
+ * html/MediaElementSession.cpp:
+ (WebCore::MediaElementSession::effectivePreloadForElement):
+ * html/MediaElementSession.h:
+ * platform/audio/PlatformMediaSessionManager.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::resetRestrictions): Deleted.
+ * testing/Internals.cpp:
+ (WebCore::Internals::setMediaElementRestrictions):
+ (WebCore::Internals::setMediaSessionRestrictions): Deleted.
+
2015-08-28 Yusuke Suzuki <[email protected]>
Move std::function from JSFunction into NativeStdFunctionCell to correctly destroy the heap allocated std::function
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (189128 => 189129)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-08-28 22:57:01 UTC (rev 189129)
@@ -431,6 +431,9 @@
if (settings && settings->audioPlaybackRequiresUserGesture() && settings->requiresUserGestureForMediaPlayback())
m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForAudioRateChange);
+ if (!settings || !settings->mediaDataLoadsAutomatically())
+ m_mediaSession->addBehaviorRestriction(MediaElementSession::AutoPreloadingNotPermitted);
+
#if ENABLE(VIDEO_TRACK)
if (document.page())
m_captionDisplayMode = document.page()->group().captionPreferences()->captionDisplayMode();
Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (189128 => 189129)
--- trunk/Source/WebCore/html/MediaElementSession.cpp 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp 2015-08-28 22:57:01 UTC (rev 189129)
@@ -338,16 +338,15 @@
MediaPlayer::Preload MediaElementSession::effectivePreloadForElement(const HTMLMediaElement& element) const
{
- PlatformMediaSessionManager::SessionRestrictions restrictions = PlatformMediaSessionManager::sharedManager().restrictions(mediaType());
MediaPlayer::Preload preload = element.preloadValue();
if (pageExplicitlyAllowsElementToAutoplayInline(element))
return preload;
- if ((restrictions & PlatformMediaSessionManager::MetadataPreloadingNotPermitted) == PlatformMediaSessionManager::MetadataPreloadingNotPermitted)
+ if (m_restrictions & MetadataPreloadingNotPermitted)
return MediaPlayer::None;
- if ((restrictions & PlatformMediaSessionManager::AutoPreloadingNotPermitted) == PlatformMediaSessionManager::AutoPreloadingNotPermitted) {
+ if (m_restrictions & AutoPreloadingNotPermitted) {
if (preload > MediaPlayer::MetaData)
return MediaPlayer::MetaData;
}
Modified: trunk/Source/WebCore/html/MediaElementSession.h (189128 => 189129)
--- trunk/Source/WebCore/html/MediaElementSession.h 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/html/MediaElementSession.h 2015-08-28 22:57:01 UTC (rev 189129)
@@ -89,6 +89,8 @@
WirelessVideoPlaybackDisabled = 1 << 7,
RequireUserGestureToAutoplayToExternalDevice = 1 << 8,
#endif
+ MetadataPreloadingNotPermitted = 1 << 9,
+ AutoPreloadingNotPermitted = 1 << 10,
};
typedef unsigned BehaviorRestrictions;
Modified: trunk/Source/WebCore/page/Settings.cpp (189128 => 189129)
--- trunk/Source/WebCore/page/Settings.cpp 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/page/Settings.cpp 2015-08-28 22:57:01 UTC (rev 189129)
@@ -125,6 +125,7 @@
static const bool defaultInlineMediaPlaybackRequiresPlaysInlineAttribute = true;
static const bool defaultRequiresUserGestureForMediaPlayback = true;
static const bool defaultAudioPlaybackRequiresUserGesture = true;
+static const bool defaultMediaDataLoadsAutomatically = false;
static const bool defaultShouldRespectImageOrientation = true;
static const bool defaultImageSubsamplingEnabled = true;
static const bool defaultScrollingTreeIncludesFrames = true;
@@ -137,6 +138,7 @@
static const bool defaultInlineMediaPlaybackRequiresPlaysInlineAttribute = false;
static const bool defaultRequiresUserGestureForMediaPlayback = false;
static const bool defaultAudioPlaybackRequiresUserGesture = false;
+static const bool defaultMediaDataLoadsAutomatically = true;
static const bool defaultShouldRespectImageOrientation = false;
static const bool defaultImageSubsamplingEnabled = false;
static const bool defaultScrollingTreeIncludesFrames = false;
Modified: trunk/Source/WebCore/page/Settings.in (189128 => 189129)
--- trunk/Source/WebCore/page/Settings.in 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/page/Settings.in 2015-08-28 22:57:01 UTC (rev 189129)
@@ -214,7 +214,7 @@
maxParseDuration type=double, initial=-1
standalone initial=false
telephoneNumberParsingEnabled initial=false
-mediaDataLoadsAutomatically initial=false
+mediaDataLoadsAutomatically initial=defaultMediaDataLoadsAutomatically
shouldTransformsAffectOverflow initial=true
shouldDispatchJavaScriptWindowOnErrorEvents initial=false
alwaysUseAcceleratedOverflowScroll initial=false
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (189128 => 189129)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2015-08-28 22:57:01 UTC (rev 189129)
@@ -65,12 +65,9 @@
enum SessionRestrictionFlags {
NoRestrictions = 0,
ConcurrentPlaybackNotPermitted = 1 << 0,
- InlineVideoPlaybackRestricted = 1 << 1,
- MetadataPreloadingNotPermitted = 1 << 2,
- AutoPreloadingNotPermitted = 1 << 3,
- BackgroundProcessPlaybackRestricted = 1 << 4,
- BackgroundTabPlaybackRestricted = 1 << 5,
- InterruptedPlaybackNotPermitted = 1 << 6,
+ BackgroundProcessPlaybackRestricted = 1 << 1,
+ BackgroundTabPlaybackRestricted = 1 << 2,
+ InterruptedPlaybackNotPermitted = 1 << 3,
};
typedef unsigned SessionRestrictions;
Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (189128 => 189129)
--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2015-08-28 22:57:01 UTC (rev 189129)
@@ -160,12 +160,6 @@
removeRestriction(PlatformMediaSession::WebAudio, ConcurrentPlaybackNotPermitted);
removeRestriction(PlatformMediaSession::WebAudio, BackgroundProcessPlaybackRestricted);
-
- removeRestriction(PlatformMediaSession::Audio, MetadataPreloadingNotPermitted);
- removeRestriction(PlatformMediaSession::Video, MetadataPreloadingNotPermitted);
-
- addRestriction(PlatformMediaSession::Audio, AutoPreloadingNotPermitted);
- addRestriction(PlatformMediaSession::Video, AutoPreloadingNotPermitted);
}
bool MediaSessionManageriOS::hasWirelessTargetsAvailable()
Modified: trunk/Source/WebCore/testing/Internals.cpp (189128 => 189129)
--- trunk/Source/WebCore/testing/Internals.cpp 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebCore/testing/Internals.cpp 2015-08-28 22:57:01 UTC (rev 189129)
@@ -2701,12 +2701,6 @@
for (auto& restrictionString : restrictionsArray) {
if (equalIgnoringCase(restrictionString, "ConcurrentPlaybackNotPermitted"))
restrictions |= PlatformMediaSessionManager::ConcurrentPlaybackNotPermitted;
- if (equalIgnoringCase(restrictionString, "InlineVideoPlaybackRestricted"))
- restrictions |= PlatformMediaSessionManager::InlineVideoPlaybackRestricted;
- if (equalIgnoringCase(restrictionString, "MetadataPreloadingNotPermitted"))
- restrictions |= PlatformMediaSessionManager::MetadataPreloadingNotPermitted;
- if (equalIgnoringCase(restrictionString, "AutoPreloadingNotPermitted"))
- restrictions |= PlatformMediaSessionManager::AutoPreloadingNotPermitted;
if (equalIgnoringCase(restrictionString, "BackgroundProcessPlaybackRestricted"))
restrictions |= PlatformMediaSessionManager::BackgroundProcessPlaybackRestricted;
if (equalIgnoringCase(restrictionString, "BackgroundTabPlaybackRestricted"))
@@ -2752,6 +2746,10 @@
#endif
if (equalIgnoringCase(restrictionString, "RequireUserGestureForAudioRateChange"))
restrictions |= MediaElementSession::RequireUserGestureForAudioRateChange;
+ if (equalIgnoringCase(restrictionString, "MetadataPreloadingNotPermitted"))
+ restrictions |= MediaElementSession::MetadataPreloadingNotPermitted;
+ if (equalIgnoringCase(restrictionString, "AutoPreloadingNotPermitted"))
+ restrictions |= MediaElementSession::AutoPreloadingNotPermitted;
}
element->mediaSession().addBehaviorRestriction(restrictions);
}
Modified: trunk/Source/WebKit/mac/ChangeLog (189128 => 189129)
--- trunk/Source/WebKit/mac/ChangeLog 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit/mac/ChangeLog 2015-08-28 22:57:01 UTC (rev 189129)
@@ -1,3 +1,26 @@
+2015-08-28 Jer Noble <[email protected]>
+
+ [iOS] Add WebKit/WebKit2 settings to control automatic data loading
+ https://bugs.webkit.org/show_bug.cgi?id=148579
+
+ Reviewed by Anders Carlsson.
+
+ Add a WebPreference to allow clients to control whether media is allowed to load automatically.
+ Remove the (now unnecessary) WebFrame property to do the same.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame mediaDataLoadsAutomatically]): Deleted.
+ (-[WebFrame setMediaDataLoadsAutomatically:]): Deleted.
+ * WebView/WebFramePrivate.h:
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+ (-[WebPreferences mediaDataLoadsAutomatically]):
+ (-[WebPreferences setMediaDataLoadsAutomatically:]):
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChanged:]):
+
2015-08-28 Beth Dakin <[email protected]>
Crash in WK1 when clicking on a PDF inside an iframe
Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (189128 => 189129)
--- trunk/Source/WebKit/mac/WebView/WebFrame.mm 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm 2015-08-28 22:57:01 UTC (rev 189129)
@@ -1439,22 +1439,6 @@
return document->isTelephoneNumberParsingEnabled();
}
-- (BOOL)mediaDataLoadsAutomatically
-{
- WebCore::Frame *frame = core(self);
- if (WebCore::Page* page = frame->page())
- return page->settings().mediaDataLoadsAutomatically();
-
- return NO;
-}
-
-- (void)setMediaDataLoadsAutomatically:(BOOL)flag
-{
- WebCore::Frame *frame = core(self);
- if (WebCore::Page* page = frame->page())
- page->settings().setMediaDataLoadsAutomatically(flag);
-}
-
- (DOMRange *)selectedDOMRange
{
WebCore::Frame *frame = core(self);
Modified: trunk/Source/WebKit/mac/WebView/WebFramePrivate.h (189128 => 189129)
--- trunk/Source/WebKit/mac/WebView/WebFramePrivate.h 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit/mac/WebView/WebFramePrivate.h 2015-08-28 22:57:01 UTC (rev 189129)
@@ -149,8 +149,6 @@
- (int)layoutCount;
- (BOOL)isTelephoneNumberParsingAllowed;
- (BOOL)isTelephoneNumberParsingEnabled;
-- (BOOL)mediaDataLoadsAutomatically;
-- (void)setMediaDataLoadsAutomatically:(BOOL)flag;
- (DOMRange *)selectedDOMRange;
- (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)affinity closeTyping:(BOOL)closeTyping;
Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (189128 => 189129)
--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h 2015-08-28 22:57:01 UTC (rev 189129)
@@ -193,3 +193,4 @@
#endif
#define WebKitEnableInheritURIQueryComponentPreferenceKey @"WebKitEnableInheritURIQueryComponent"
+#define WebKitMediaDataLoadsAutomaticallyPreferenceKey @"WebKitMediaDataLoadsAutomatically"
Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (189128 => 189129)
--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm 2015-08-28 22:57:01 UTC (rev 189129)
@@ -531,12 +531,14 @@
[NSNumber numberWithBool:NO], WebKitShouldDisplayTextDescriptionsPreferenceKey,
[NSNumber numberWithBool:YES], WebKitNotificationsEnabledKey,
[NSNumber numberWithBool:NO], WebKitShouldRespectImageOrientationKey,
+ [NSNumber numberWithBool:YES], WebKitMediaDataLoadsAutomaticallyPreferenceKey,
#else
[NSNumber numberWithBool:YES], WebKitRequiresUserGestureForMediaPlaybackPreferenceKey,
[NSNumber numberWithBool:allowsInlineMediaPlayback], WebKitAllowsInlineMediaPlaybackPreferenceKey,
[NSNumber numberWithBool:requiresPlaysInlineAttribute], WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
[NSNumber numberWithBool:NO], WebKitMediaControlsScaleWithPageZoomPreferenceKey,
[NSNumber numberWithUnsignedInt:AudioSession::None], WebKitAudioSessionCategoryOverride,
+ [NSNumber numberWithBool:NO], WebKitMediaDataLoadsAutomaticallyPreferenceKey,
#if HAVE(AVKIT)
[NSNumber numberWithBool:YES], WebKitAVKitEnabled,
#endif
@@ -2582,6 +2584,16 @@
[self _setBoolValue:flag forKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
}
+- (BOOL)mediaDataLoadsAutomatically
+{
+ return [self _boolValueForKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
+}
+
+- (void)setMediaDataLoadsAutomatically:(BOOL)flag
+{
+ [self _setBoolValue:flag forKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
+}
+
@end
@implementation WebPreferences (WebInternal)
Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (189128 => 189129)
--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h 2015-08-28 22:57:01 UTC (rev 189129)
@@ -453,6 +453,7 @@
- (BOOL)httpEquivEnabled;
@property (nonatomic) BOOL _javascript_MarkupEnabled;
+@property (nonatomic) BOOL mediaDataLoadsAutomatically;
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
- (void)_setAllowCompositingLayerVisualDegradation:(BOOL)flag;
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (189128 => 189129)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2015-08-28 22:57:01 UTC (rev 189129)
@@ -2462,6 +2462,8 @@
#if ENABLE(ENCRYPTED_MEDIA_V2)
settings.setMediaKeysStorageDirectory([preferences mediaKeysStorageDirectory]);
#endif
+
+ settings.setMediaDataLoadsAutomatically([preferences mediaDataLoadsAutomatically]);
}
static inline IMP getMethod(id o, SEL s)
Modified: trunk/Source/WebKit2/ChangeLog (189128 => 189129)
--- trunk/Source/WebKit2/ChangeLog 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit2/ChangeLog 2015-08-28 22:57:01 UTC (rev 189129)
@@ -1,5 +1,27 @@
2015-08-28 Jer Noble <[email protected]>
+ [iOS] Add WebKit/WebKit2 settings to control automatic data loading
+ https://bugs.webkit.org/show_bug.cgi?id=148579
+
+ Reviewed by Anders Carlsson.
+
+ Add a property to WKWebViewConfiguration to control whether clients are allowed
+ to load media data automatically. Pass this configuration on through to WebCore.
+
+ * Shared/WebPreferencesDefinitions.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView initWithFrame:configuration:]):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration init]):
+ (-[WKWebViewConfiguration copyWithZone:]):
+ (-[WKWebViewConfiguration _mediaDataLoadsAutomatically]):
+ (-[WKWebViewConfiguration _setMediaDataLoadsAutomatically:]):
+ * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+
+2015-08-28 Jer Noble <[email protected]>
+
[iOS] Make the AllowsInlineMediaPlayback preference work in WebKit / WebKit2.
https://bugs.webkit.org/show_bug.cgi?id=147512
Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (189128 => 189129)
--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h 2015-08-28 22:57:01 UTC (rev 189129)
@@ -58,6 +58,7 @@
#define DEFAULT_PASSWORD_ECHO_ENABLED true
#define DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK false
#define DEFAULT_INLINE_MEDIA_PLAYBACK_REQUIRES_PLAYS_INLINE_ATTRIBUTE true
+#define DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY false
#define DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK true
#define DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM false
#define DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED false
@@ -71,6 +72,7 @@
#define DEFAULT_PASSWORD_ECHO_ENABLED false
#define DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK true
#define DEFAULT_INLINE_MEDIA_PLAYBACK_REQUIRES_PLAYS_INLINE_ATTRIBUTE false
+#define DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY true
#define DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK false
#define DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM true
#define DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED true
@@ -135,6 +137,7 @@
macro(RequiresUserGestureForMediaPlayback, requiresUserGestureForMediaPlayback, Bool, bool, DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK) \
macro(AllowsInlineMediaPlayback, allowsInlineMediaPlayback, Bool, bool, DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK) \
macro(InlineMediaPlaybackRequiresPlaysInlineAttribute, inlineMediaPlaybackRequiresPlaysInlineAttribute, Bool, bool, DEFAULT_INLINE_MEDIA_PLAYBACK_REQUIRES_PLAYS_INLINE_ATTRIBUTE) \
+ macro(MediaDataLoadsAutomatically, mediaDataLoadsAutomatically, Bool, bool, DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY) \
macro(AllowsPictureInPictureMediaPlayback, allowsPictureInPictureMediaPlayback, Bool, bool, true) \
macro(AllowsAirPlayForMediaPlayback, allowsAirPlayForMediaPlayback, Bool, bool, true) \
macro(MediaControlsScaleWithPageZoom, mediaControlsScaleWithPageZoom, Bool, bool, DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM) \
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (189128 => 189129)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-08-28 22:57:01 UTC (rev 189129)
@@ -330,6 +330,7 @@
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::inlineMediaPlaybackRequiresPlaysInlineAttributeKey(), WebKit::WebPreferencesStore::Value(!![_configuration _inlineMediaPlaybackRequiresPlaysInlineAttribute]));
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::allowsPictureInPictureMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsPictureInPictureMediaPlayback] && shouldAllowPictureInPictureMediaPlayback()));
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::requiresUserGestureForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration requiresUserActionForMediaPlayback]));
+ pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::mediaDataLoadsAutomaticallyKey(), WebKit::WebPreferencesStore::Value(!![_configuration _mediaDataLoadsAutomatically]));
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::allowsAirPlayForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsAirPlayForMediaPlayback]));
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (189128 => 189129)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2015-08-28 22:57:01 UTC (rev 189129)
@@ -97,6 +97,7 @@
BOOL _alwaysRunsAtForegroundPriority;
BOOL _allowsInlineMediaPlayback;
BOOL _inlineMediaPlaybackRequiresPlaysInlineAttribute;
+ BOOL _mediaDataLoadsAutomatically;
#endif
}
@@ -110,6 +111,7 @@
_allowsPictureInPictureMediaPlayback = YES;
_allowsInlineMediaPlayback = WKGetDeviceClass() == WKDeviceClassiPad;
_inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback;
+ _mediaDataLoadsAutomatically = NO;
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
@@ -146,6 +148,7 @@
#if PLATFORM(IOS)
configuration->_allowsInlineMediaPlayback = self->_allowsInlineMediaPlayback;
configuration->_inlineMediaPlaybackRequiresPlaysInlineAttribute = self->_inlineMediaPlaybackRequiresPlaysInlineAttribute;
+ configuration->_mediaDataLoadsAutomatically = self->_mediaDataLoadsAutomatically;
configuration->_allowsPictureInPictureMediaPlayback = self->_allowsPictureInPictureMediaPlayback;
configuration->_alwaysRunsAtForegroundPriority = _alwaysRunsAtForegroundPriority;
configuration->_requiresUserActionForMediaPlayback = self->_requiresUserActionForMediaPlayback;
@@ -351,6 +354,16 @@
{
_inlineMediaPlaybackRequiresPlaysInlineAttribute = requires;
}
+
+- (BOOL)_mediaDataLoadsAutomatically
+{
+ return _mediaDataLoadsAutomatically;
+}
+
+- (void)_setMediaDataLoadsAutomatically:(BOOL)mediaDataLoadsAutomatically
+{
+ _mediaDataLoadsAutomatically = mediaDataLoadsAutomatically;
+}
#endif
@end
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (189128 => 189129)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h 2015-08-28 22:57:01 UTC (rev 189129)
@@ -47,6 +47,7 @@
@property (nonatomic, setter=_setAlwaysRunsAtForegroundPriority:) BOOL _alwaysRunsAtForegroundPriority WK_AVAILABLE(NA, WK_IOS_TBA);
@property (nonatomic, setter=_setInlineMediaPlaybackRequiresPlaysInlineAttribute:) BOOL _inlineMediaPlaybackRequiresPlaysInlineAttribute WK_AVAILABLE(NA, WK_IOS_TBA);
+@property (nonatomic, setter=_setMediaDataLoadsAutomatically:) BOOL _mediaDataLoadsAutomatically WK_AVAILABLE(NA, WK_IOS_TBA);
#endif
@property (nonatomic, strong, setter=_setVisitedLinkProvider:) _WKVisitedLinkProvider *_visitedLinkProvider WK_DEPRECATED(10_10, WK_MAC_TBA, 8_0, WK_IOS_TBA, "Please use visitedLinkStore instead");
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (189128 => 189129)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-08-28 22:57:01 UTC (rev 189129)
@@ -2735,6 +2735,7 @@
settings.setRequiresUserGestureForMediaPlayback(store.getBoolValueForKey(WebPreferencesKey::requiresUserGestureForMediaPlaybackKey()));
settings.setAllowsInlineMediaPlayback(store.getBoolValueForKey(WebPreferencesKey::allowsInlineMediaPlaybackKey()));
settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(store.getBoolValueForKey(WebPreferencesKey::inlineMediaPlaybackRequiresPlaysInlineAttributeKey()));
+ settings.setMediaDataLoadsAutomatically(store.getBoolValueForKey(WebPreferencesKey::mediaDataLoadsAutomaticallyKey()));
settings.setAllowsPictureInPictureMediaPlayback(store.getBoolValueForKey(WebPreferencesKey::allowsPictureInPictureMediaPlaybackKey()));
settings.setMediaControlsScaleWithPageZoom(store.getBoolValueForKey(WebPreferencesKey::mediaControlsScaleWithPageZoomKey()));
settings.setMockScrollbarsEnabled(store.getBoolValueForKey(WebPreferencesKey::mockScrollbarsEnabledKey()));
Modified: trunk/Tools/ChangeLog (189128 => 189129)
--- trunk/Tools/ChangeLog 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Tools/ChangeLog 2015-08-28 22:57:01 UTC (rev 189129)
@@ -1,3 +1,21 @@
+2015-08-28 Jer Noble <[email protected]>
+
+ [iOS] Add WebKit/WebKit2 settings to control automatic data loading
+ https://bugs.webkit.org/show_bug.cgi?id=148579
+
+ Reviewed by Anders Carlsson.
+
+ In DumpRenderTree, set the new mediaDataLoadsAutomatically preference to YES.
+
+ In WebKitTestRunner, do the same for the new _mediaDataLoadsAutomatically configuration property,
+ and also set the existing requiresUserActionForMediaPlayback configuration property to NO.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetWebPreferencesToConsistentValues):
+ (resetWebViewToConsistentStateBeforeTesting):
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::initializeWebViewConfiguration):
+
2015-08-28 Alexey Proskuryakov <[email protected]>
Fix run-webkit-tests --additional-env-var="DYLD_INSERT_LIBRARIES=..."
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (189128 => 189129)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2015-08-28 22:57:01 UTC (rev 189129)
@@ -936,6 +936,7 @@
#if PLATFORM(IOS)
[preferences setMediaPlaybackAllowsInline:YES];
[preferences setMediaPlaybackRequiresUserGesture:NO];
+ [preferences setMediaDataLoadsAutomatically:YES];
// Enable the tracker before creating the first WebView will
// cause initialization to use the correct database paths.
@@ -1801,7 +1802,6 @@
#if PLATFORM(IOS)
adjustWebDocumentForStandardViewport(gWebBrowserView, gWebScrollView);
[webView _setAllowsMessaging:YES];
- [mainFrame setMediaDataLoadsAutomatically:YES];
#endif
[webView setEditable:NO];
[(EditingDelegate *)[webView editingDelegate] setAcceptsEditing:YES];
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (189128 => 189129)
--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2015-08-28 22:50:43 UTC (rev 189128)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2015-08-28 22:57:01 UTC (rev 189129)
@@ -59,6 +59,8 @@
#if TARGET_OS_IPHONE
globalWebViewConfiguration.allowsInlineMediaPlayback = YES;
globalWebViewConfiguration._inlineMediaPlaybackRequiresPlaysInlineAttribute = NO;
+ globalWebViewConfiguration._mediaDataLoadsAutomatically = YES;
+ globalWebViewConfiguration.requiresUserActionForMediaPlayback = NO;
#endif
#endif
}