Expose WebPreferences for viewport-fit and constant() properties
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jul 2017 09:00:49 +0000 (09:00 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jul 2017 09:00:49 +0000 (09:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174072
<rdar://problem/33096639>

Reviewed by Ryosuke Niwa.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences viewportFitEnabled]):
(-[WebPreferences setViewportFitEnabled:]):
(-[WebPreferences constantPropertiesEnabled]):
(-[WebPreferences setConstantPropertiesEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219066 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

index ca11476..a54c66b 100644 (file)
@@ -1,3 +1,21 @@
+2017-07-03  Tim Horton  <timothy_horton@apple.com>
+
+        Expose WebPreferences for viewport-fit and constant() properties
+        https://bugs.webkit.org/show_bug.cgi?id=174072
+        <rdar://problem/33096639>
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences viewportFitEnabled]):
+        (-[WebPreferences setViewportFitEnabled:]):
+        (-[WebPreferences constantPropertiesEnabled]):
+        (-[WebPreferences setConstantPropertiesEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-07-01  Tim Horton  <timothy_horton@apple.com>
 
         Expose viewport-fit value to UIKit via viewport arguments dictionary
index b8a21b1..3fe25ec 100644 (file)
 #define WebKitCredentialManagementEnabledPreferenceKey @"WebKitCredentialManagementEnabled"
 #define WebKitMediaUserGestureInheritsFromDocument @"WebKitMediaUserGestureInheritsFromDocument"
 #define WebKitIsSecureContextAttributeEnabledPreferenceKey @"WebKitIsSecureContextAttributeEnabled"
+#define WebKitViewportFitEnabledPreferenceKey @"WebKitViewportFitEnabled"
+#define WebKitConstantPropertiesEnabledPreferenceKey @"WebKitConstantPropertiesEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the
index cea4263..d738366 100644 (file)
@@ -675,6 +675,8 @@ public:
 #else
         @YES, WebKitLegacyEncryptedMediaAPIEnabledKey,
 #endif
+        @YES, WebKitViewportFitEnabledPreferenceKey,
+        @YES, WebKitConstantPropertiesEnabledPreferenceKey,
         (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
         nil];
 
@@ -3152,6 +3154,26 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
 }
 
+- (BOOL)viewportFitEnabled
+{
+    return [self _boolValueForKey:WebKitViewportFitEnabledPreferenceKey];
+}
+
+- (void)setViewportFitEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitViewportFitEnabledPreferenceKey];
+}
+
+- (BOOL)constantPropertiesEnabled
+{
+    return [self _boolValueForKey:WebKitConstantPropertiesEnabledPreferenceKey];
+}
+
+- (void)setConstantPropertiesEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitConstantPropertiesEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)
index 18eace2..e8f4783 100644 (file)
@@ -578,6 +578,8 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 @property (nonatomic) BOOL mediaUserGestureInheritsFromDocument;
 @property (nonatomic) BOOL isSecureContextAttributeEnabled;
 @property (nonatomic) BOOL legacyEncryptedMediaAPIEnabled;
+@property (nonatomic) BOOL viewportFitEnabled;
+@property (nonatomic) BOOL constantPropertiesEnabled;
 
 #if TARGET_OS_IPHONE
 @property (nonatomic) BOOL quickLookDocumentSavingEnabled;
index 4bde6d5..f5e6102 100644 (file)
@@ -2986,6 +2986,9 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
     settings.setResourceLoadStatisticsEnabled([preferences resourceLoadStatisticsEnabled]);
 
+    settings.setViewportFitEnabled([preferences viewportFitEnabled]);
+    settings.setConstantPropertiesEnabled([preferences constantPropertiesEnabled]);
+
 #if ENABLE(GAMEPAD)
     RuntimeEnabledFeatures::sharedFeatures().setGamepadsEnabled([preferences gamepadsEnabled]);
 #endif