Clients of the WK2 C-API don't have their mediaContentTypesRequiringHardwareSupport...
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jun 2017 17:51:47 +0000 (17:51 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jun 2017 17:51:47 +0000 (17:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173091

Reviewed by Eric Carlson.

Source/WebCore:

Add a new default setting value, defined separately in Settings and SettingsCocoa.

* page/Settings.cpp:
(WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport):
* page/Settings.h:
* page/cocoa/SettingsCocoa.mm:
(WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport):

Source/WebKit/mac:

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):

Source/WebKit2:

Rather than add yet a third way of setting this preference, centralize everything by moving the
definition of the default value into WebCore.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

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

Source/WebCore/ChangeLog
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/page/cocoa/SettingsCocoa.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 8c71bd9..3634e08 100644 (file)
@@ -1,5 +1,20 @@
 2017-06-08  Jer Noble  <jer.noble@apple.com>
 
+        Clients of the WK2 C-API don't have their mediaContentTypesRequiringHardwareSupport setting initialized correctly.
+        https://bugs.webkit.org/show_bug.cgi?id=173091
+
+        Reviewed by Eric Carlson.
+
+        Add a new default setting value, defined separately in Settings and SettingsCocoa.
+
+        * page/Settings.cpp:
+        (WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport):
+        * page/Settings.h:
+        * page/cocoa/SettingsCocoa.mm:
+        (WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport):
+
+2017-06-08  Jer Noble  <jer.noble@apple.com>
+
         Take the mediaContentTypesRequiringHardwareSupport Setting into account when answering HTMLMediaElement::canPlayType()
         https://bugs.webkit.org/show_bug.cgi?id=173092
 
index f61dad6..562d575 100644 (file)
@@ -789,6 +789,13 @@ bool Settings::allowsAnySSLCertificate()
     return gAllowsAnySSLCertificate;
 }
 
+#if !PLATFORM(COCOA)
+const String& Settings::defaultMediaContentTypesRequiringHardwareSupport()
+{
+    return emptyString();
+}
+#endif
+
 void Settings::setMediaContentTypesRequiringHardwareSupport(const String& contentTypes)
 {
     m_mediaContentTypesRequiringHardwareSupport = contentTypes.split(":").map(ContentType::create);
index 91183e8..b9d3e73 100644 (file)
@@ -326,6 +326,7 @@ public:
     WEBCORE_EXPORT static void setAllowsAnySSLCertificate(bool);
     static bool allowsAnySSLCertificate();
 
+    WEBCORE_EXPORT static const String& defaultMediaContentTypesRequiringHardwareSupport();
     WEBCORE_EXPORT void setMediaContentTypesRequiringHardwareSupport(const Vector<ContentType>&);
     WEBCORE_EXPORT void setMediaContentTypesRequiringHardwareSupport(const String&);
     const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const { return m_mediaContentTypesRequiringHardwareSupport; }
index b4c8ed9..6fd7709 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "Settings.h"
 
+#include <wtf/NeverDestroyed.h>
+
 #if PLATFORM(IOS)
 #include "Device.h"
 #include "SoftLinking.h"
@@ -133,4 +135,10 @@ bool Settings::defaultTextAutosizingEnabled()
 
 #endif
 
+const String& Settings::defaultMediaContentTypesRequiringHardwareSupport()
+{
+    static NeverDestroyed<String> defaultMediaContentTypes { "video/mp4;codecs=hvc1:video/mp4;codecs=hev1" };
+    return defaultMediaContentTypes;
+}
+
 } // namespace WebCore
index 8a27da4..3e4958d 100644 (file)
@@ -1,3 +1,13 @@
+2017-06-08  Jer Noble  <jer.noble@apple.com>
+
+        Clients of the WK2 C-API don't have their mediaContentTypesRequiringHardwareSupport setting initialized correctly.
+        https://bugs.webkit.org/show_bug.cgi?id=173091
+
+        Reviewed by Eric Carlson.
+
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+
 2017-06-07  Jer Noble  <jer.noble@apple.com>
 
         Clean-up: RenderElement.h includes headers it doesn't use
index 3dc29f2..34052b3 100644 (file)
@@ -671,7 +671,7 @@ public:
         @NO, WebKitResourceTimingEnabledPreferenceKey,
         @NO, WebKitCredentialManagementEnabledPreferenceKey,
         @NO, WebKitMediaUserGestureInheritsFromDocument,
-        @"video/mp4;codecs=hvc1:video/mp4;codecs=hev1", WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
+        (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
         nil];
 
 #if !PLATFORM(IOS)
index 9f53687..9c0ada8 100644 (file)
@@ -1,5 +1,21 @@
 2017-06-08  Jer Noble  <jer.noble@apple.com>
 
+        Clients of the WK2 C-API don't have their mediaContentTypesRequiringHardwareSupport setting initialized correctly.
+        https://bugs.webkit.org/show_bug.cgi?id=173091
+
+        Reviewed by Eric Carlson.
+
+        Rather than add yet a third way of setting this preference, centralize everything by moving the
+        definition of the default value into WebCore.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
+2017-06-08  Jer Noble  <jer.noble@apple.com>
+
         [WK2] mediaContentTypesRequiringHardwareSupport setting not being propogated
         https://bugs.webkit.org/show_bug.cgi?id=173090
 
index 90e9c61..c482f57 100644 (file)
     FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
     macro(DefaultTextEncodingName, defaultTextEncodingName, String, String, defaultTextEncodingNameForSystemLanguage(), "", "") \
     macro(FTPDirectoryTemplatePath, ftpDirectoryTemplatePath, String, String, "", "", "") \
-    macro(MediaContentTypesRequiringHardwareSupport, mediaContentTypesRequiringHardwareSupport, String, String, "", "", "") \
+    macro(MediaContentTypesRequiringHardwareSupport, mediaContentTypesRequiringHardwareSupport, String, String, WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport(), "", "") \
     \
 
 #define FOR_EACH_WEBKIT_STRING_PREFERENCE_NOT_IN_WEBCORE(macro) \
index d1c726e..ff88cb6 100644 (file)
@@ -40,6 +40,7 @@
 #import "_WKVisitedLinkStore.h"
 #import "_WKWebsiteDataStoreInternal.h"
 #import <WebCore/RuntimeApplicationChecks.h>
+#import <WebCore/Settings.h>
 #import <WebCore/URLParser.h>
 #import <wtf/RetainPtr.h>
 
@@ -200,7 +201,7 @@ private:
     _allowsBlockSelection = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDebugAllowBlockSelection"];
 #endif
 
-    _mediaContentTypesRequiringHardwareSupport = @"video/mp4;codecs=hvc1:video/mp4;codecs=hev1";
+    _mediaContentTypesRequiringHardwareSupport = Settings::defaultMediaContentTypesRequiringHardwareSupport();
 
     return self;
 }
index 402a6da..bd8e5de 100644 (file)
@@ -3388,6 +3388,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings.setLargeImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::largeImageAsyncDecodingEnabledKey()));
     settings.setAnimatedImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::animatedImageAsyncDecodingEnabledKey()));
     settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(store.getBoolValueForKey(WebPreferencesKey::shouldSuppressKeyboardInputDuringProvisionalNavigationKey()));
+    settings.setMediaContentTypesRequiringHardwareSupport(store.getStringValueForKey(WebPreferencesKey::mediaContentTypesRequiringHardwareSupportKey()));
 }
 
 #if ENABLE(DATA_DETECTION)