[Cocoa] Set defaults for mediaContentTypesRequiringHardwareSupport setting
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jun 2017 18:28:55 +0000 (18:28 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jun 2017 18:28:55 +0000 (18:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173008

Reviewed by Eric Carlson.

Source/WebKit/mac:

Add a private preference (with default) for the mediaContentTypesRequiringHardwareSupport WebCore setting.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences mediaUserGestureInheritsFromDocument]):
(-[WebPreferences setMediaUserGestureInheritsFromDocument:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):

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

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/UIProcess/API/Cocoa/WKWebViewConfiguration.mm

index 6b5c6a2..49548be 100644 (file)
@@ -1,3 +1,21 @@
+2017-06-06  Jer Noble  <jer.noble@apple.com>
+
+        [Cocoa] Set defaults for mediaContentTypesRequiringHardwareSupport setting
+        https://bugs.webkit.org/show_bug.cgi?id=173008
+
+        Reviewed by Eric Carlson.
+
+        Add a private preference (with default) for the mediaContentTypesRequiringHardwareSupport WebCore setting.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences mediaUserGestureInheritsFromDocument]):
+        (-[WebPreferences setMediaUserGestureInheritsFromDocument:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-06-06  Youenn Fablet  <youenn@apple.com>
 
         Add an option to disable getUserMedia prompt in case of mock capture sources
index 61dc8e8..285170a 100644 (file)
 #define WebKitDisplayContentsEnabledPreferenceKey @"WebKitDisplayContentsEnabled"
 #define WebKitUserTimingEnabledPreferenceKey @"WebKitUserTimingEnabled"
 #define WebKitResourceTimingEnabledPreferenceKey @"WebKitResourceTimingEnabled"
+#define WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey @"WebKitMediaContentTypesRequiringHardwareSupport"
index 38bf921..fa15f17 100644 (file)
@@ -671,6 +671,7 @@ public:
         @NO, WebKitResourceTimingEnabledPreferenceKey,
         @NO, WebKitCredentialManagementEnabledPreferenceKey,
         @NO, WebKitMediaUserGestureInheritsFromDocument,
+        @"video/mp4;codecs=hvc1:video/mp4;codecs=hev1", WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
         nil];
 
 #if !PLATFORM(IOS)
@@ -3096,6 +3097,15 @@ static NSString *classIBCreatorID = nil;
 }
 #endif
 
+- (NSString *)mediaContentTypesRequiringHardwareSupport
+{
+    return [self _stringValueForKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
+}
+
+- (void)setMediaContentTypesRequiringHardwareSupport:(NSString *)value
+{
+    [self _setStringValue:value forKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
+}
 @end
 
 @implementation WebPreferences (WebInternal)
index cf3d988..8182263 100644 (file)
@@ -566,4 +566,6 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 @property (nonatomic) BOOL quickLookDocumentSavingEnabled;
 #endif
 
+@property (nonatomic) NSString *mediaContentTypesRequiringHardwareSupport;
+
 @end
index 00d5381..76d07b3 100644 (file)
@@ -2879,6 +2879,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings.setJavaScriptCanOpenWindowsAutomatically([preferences javaScriptCanOpenWindowsAutomatically] || shouldAllowWindowOpenWithoutUserGesture());
 
     settings.setVisualViewportEnabled([preferences visualViewportEnabled]);
+    settings.setMediaContentTypesRequiringHardwareSupport([preferences mediaContentTypesRequiringHardwareSupport]);
 
     switch ([preferences storageBlockingPolicy]) {
     case WebAllowAllStorage:
index 4f4d364..ad0bc90 100644 (file)
@@ -1,3 +1,13 @@
+2017-06-06  Jer Noble  <jer.noble@apple.com>
+
+        [Cocoa] Set defaults for mediaContentTypesRequiringHardwareSupport setting
+        https://bugs.webkit.org/show_bug.cgi?id=173008
+
+        Reviewed by Eric Carlson.
+
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]):
+
 2017-06-06  Joseph Pecoraro  <pecoraro@apple.com>
 
         Move Resource Timing / User Timing from experimental features into main preferences
index 4030d53..d1c726e 100644 (file)
@@ -200,6 +200,8 @@ private:
     _allowsBlockSelection = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDebugAllowBlockSelection"];
 #endif
 
+    _mediaContentTypesRequiringHardwareSupport = @"video/mp4;codecs=hvc1:video/mp4;codecs=hev1";
+
     return self;
 }