Add an experimental feature flag for viewport "min-device-width"
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Apr 2018 18:03:15 +0000 (18:03 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Apr 2018 18:03:15 +0000 (18:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185050
<rdar://problem/39624038>

Reviewed by Tim Horton.

Source/WebCore:

Add MinDeviceWidthEnabled as a new runtime-enabled feature.

* dom/ViewportArguments.cpp:
(WebCore::setViewportFeature):

Gate the parsing of "min-device-width" on the runtime-enabled feature being flipped on.

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled):
(WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const):

Source/WebKit:

Add MinDeviceWidthEnabled as a new experimental feature, on by default in extra zoom mode and off elsewhere.

* Shared/WebPreferences.yaml:
* Shared/WebPreferencesDefaultValues.h:

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

Source/WebCore/ChangeLog
Source/WebCore/dom/ViewportArguments.cpp
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/Shared/WebPreferencesDefaultValues.h

index 05ebb31..ea0f6c2 100644 (file)
@@ -1,3 +1,22 @@
+2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Add an experimental feature flag for viewport "min-device-width"
+        https://bugs.webkit.org/show_bug.cgi?id=185050
+        <rdar://problem/39624038>
+
+        Reviewed by Tim Horton.
+
+        Add MinDeviceWidthEnabled as a new runtime-enabled feature.
+
+        * dom/ViewportArguments.cpp:
+        (WebCore::setViewportFeature):
+
+        Gate the parsing of "min-device-width" on the runtime-enabled feature being flipped on.
+
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled):
+        (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const):
+
 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
 
         Make color-filter transform gradient colors
index 71a3c5d..a77b979 100644 (file)
@@ -31,6 +31,7 @@
 #include "Document.h"
 #include "Frame.h"
 #include "IntSize.h"
+#include "RuntimeEnabledFeatures.h"
 #include "ScriptableDocumentParser.h"
 #include "Settings.h"
 #include <wtf/text/TextStream.h>
@@ -420,7 +421,7 @@ void setViewportFeature(ViewportArguments& arguments, Document& document, String
         arguments.shrinkToFit = findBooleanValue(document, key, value);
     else if (equalLettersIgnoringASCIICase(key, "viewport-fit") && document.settings().viewportFitEnabled())
         arguments.viewportFit = parseViewportFitValue(document, key, value);
-    else if (equalLettersIgnoringASCIICase(key, "min-device-width"))
+    else if (equalLettersIgnoringASCIICase(key, "min-device-width") && RuntimeEnabledFeatures::sharedFeatures().minDeviceWidthEnabled())
         arguments.minDeviceWidth = numericPrefix(document, key, value);
     else
         reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, key);
index 35a3b8f..29c49d1 100644 (file)
@@ -253,6 +253,9 @@ public:
     void setFromOriginResponseHeaderEnabled(bool isEnabled) { m_fromOriginResponseHeaderEnabled = isEnabled; }
     bool fromOriginResponseHeaderEnabled() const { return m_fromOriginResponseHeaderEnabled; }
 
+    void setMinDeviceWidthEnabled(bool isEnabled) { m_minDeviceWidthEnabled = isEnabled; }
+    bool minDeviceWidthEnabled() const { return m_minDeviceWidthEnabled; }
+
     WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
 
 private:
@@ -389,6 +392,8 @@ private:
 
     bool m_fromOriginResponseHeaderEnabled { false };
 
+    bool m_minDeviceWidthEnabled { false };
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 
index 4948836..70f977f 100644 (file)
@@ -1,3 +1,16 @@
+2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Add an experimental feature flag for viewport "min-device-width"
+        https://bugs.webkit.org/show_bug.cgi?id=185050
+        <rdar://problem/39624038>
+
+        Reviewed by Tim Horton.
+
+        Add MinDeviceWidthEnabled as a new experimental feature, on by default in extra zoom mode and off elsewhere.
+
+        * Shared/WebPreferences.yaml:
+        * Shared/WebPreferencesDefaultValues.h:
+
 2018-04-27  Daniel Bates  <dabates@apple.com>
 
         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
index b5f62c7..f44c7d7 100644 (file)
@@ -781,7 +781,7 @@ DataTransferItemsEnabled:
 CustomPasteboardDataEnabled:
   type: bool
   defaultValue: defaultCustomPasteboardDataEnabled()
-  humanReadableName: "Custom pateboard data"
+  humanReadableName: "Custom pasteboard data"
   humanReadableDescription: "Enable custom clipboard types and better security model for clipboard API."
   webcoreBinding: RuntimeEnabledFeatures
 
@@ -1248,3 +1248,11 @@ FromOriginResponseHeaderEnabled:
     humanReadableDescription: "Support for the From-Origin Response Header"
     category: experimental
     webcoreBinding: RuntimeEnabledFeatures
+
+MinDeviceWidthEnabled:
+  type: bool
+  defaultValue: DEFAULT_MIN_DEVICE_WIDTH_ENABLED
+  humanReadableName: "Minimum device width"
+  humanReadableDescription: "Enable the min-device-width viewport parameter"
+  category: experimental
+  webcoreBinding: RuntimeEnabledFeatures
index e75f3d4..194e026 100644 (file)
 #define DEFAULT_VISUAL_VIEWPORT_HEIGHT_EXPANSION_FACTOR 0
 #endif
 
+#if ENABLE(EXTRA_ZOOM_MODE)
+#define DEFAULT_MIN_DEVICE_WIDTH_ENABLED 1
+#else
+#define DEFAULT_MIN_DEVICE_WIDTH_ENABLED 0
+#endif
+
 // Cocoa ports must disable experimental features on release branches for now.
 #if ENABLE(EXPERIMENTAL_FEATURES) || PLATFORM(COCOA)
 #define DEFAULT_EXPERIMENTAL_FEATURES_ENABLED true