[iOS] Make the AllowsInlineMediaPlayback preference work in WebKit / WebKit2.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Aug 2015 18:51:42 +0000 (18:51 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Aug 2015 18:51:42 +0000 (18:51 +0000)
commitbd4ccc314c5b1eb5b9c1700ce11cc9ea646d4700
tree21dbee043454bb26e616a94aa3cca19a99e114d5
parent98f84dcd71467ccffd52f2d954a0c7e92019b70f
[iOS] Make the AllowsInlineMediaPlayback preference work in WebKit / WebKit2.
https://bugs.webkit.org/show_bug.cgi?id=147512

Reviewed by Anders Carlsson.

Source/WebCore:

Updated existing tests to use the Setting rather than the Behavior Restriction.

Get rid of the sessionRestrictsInlineVideoPlayback() method and the InlineVideoPlaybackRestricted
restriction. Instead, just use the allowsInlineMediaPlayback() setting, and require
WebKit and WebKitLegacy clients to initialize the setting appropriately.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback): Deleted.
* page/Settings.cpp: Add a new inlineMediaPlaybackRequiresPlaysInlineAttribute setting.
* page/Settings.in: Ditto.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::sessionRestrictsInlineVideoPlayback): Deleted.
* platform/audio/PlatformMediaSessionManager.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::resetRestrictions): Deleted.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup): Backup the allowsInlineMediaPlayback() setting value.
(WebCore::InternalSettings::Backup::restoreTo): Restore same.
(WebCore::InternalSettings::setAllowsInlineMediaPlayback): Set allowsInlineMediaPlayback().
* testing/InternalSettings.h:
* testing/InternalSettings.idl:
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Deleted.

Source/WebKit/mac:

Add a new preference, inlineMediaPlaybackRequiresPlaysInlineAttribute, which defaults to
NO on iPad and YES on iPhone and iPod.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Default the value of WebKitAllowsInlineMediaPlaybackPreferenceKey to
YES on iPad and NO on iPhone and iPod.
(-[WebPreferences inlineMediaPlaybackRequiresPlaysInlineAttribute]):
(-[WebPreferences setInlineMediaPlaybackRequiresPlaysInlineAttribute:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Default the value of allowsInlineMediaPlayback to YES on iPad and NO on iPhone and iPod.
Add a new configuration property, _inlineMediaPlaybackRequiresPlaysInlineAttribute, which
defaults to NO on iPad and YES on iPhone and iPad.

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _inlineMediaPlaybackRequiresPlaysInlineAttribute]):
(-[WKWebViewConfiguration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Set the value of WebKitAllowsInlineMediaPlayback / WKPreferencesSetMediaPlaybackAllowsInline()
to a consistent (true) value.

* DumpRenderTree/mac/DumpRenderTree.mm:
(setDefaultsToConsistentValuesForTesting):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:

* media/video-fullscreeen-only-controls.html:
* media/video-fullscreeen-only-controls-expected.txt:
* media/video-fullscreeen-only-playback.html:
* media/video-fullscreeen-only-playback-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
LayoutTests/ChangeLog
LayoutTests/media/video-fullscreeen-only-controls-expected.txt
LayoutTests/media/video-fullscreeen-only-controls.html
LayoutTests/media/video-fullscreeen-only-playback-expected.txt
LayoutTests/media/video-fullscreeen-only-playback.html
Source/WebCore/ChangeLog
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.in
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.h
Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
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/WKWebViewConfiguration.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm