Add a preference to prevent "user-scalable=no" from having any effect
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Mar 2015 00:03:44 +0000 (00:03 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Mar 2015 00:03:44 +0000 (00:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143032

Reviewed by Sam Weinig.

* Shared/WebPreferencesDefinitions.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Add a preference and push it to the ViewportConfiguration.

* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::ViewportConfiguration):
(WebCore::ViewportConfiguration::allowsUserScaling):
* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::setForceAlwaysUserScalable):
If forceAlwaysUserScalable is set to true, force "user-scalable=yes".

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

Source/WebCore/ChangeLog
Source/WebCore/page/ViewportConfiguration.cpp
Source/WebCore/page/ViewportConfiguration.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index b8e2d16..c9e6885 100644 (file)
@@ -1,3 +1,17 @@
+2015-03-25  Tim Horton  <timothy_horton@apple.com>
+
+        Add a preference to prevent "user-scalable=no" from having any effect
+        https://bugs.webkit.org/show_bug.cgi?id=143032
+
+        Reviewed by Sam Weinig.
+
+        * page/ViewportConfiguration.cpp:
+        (WebCore::ViewportConfiguration::ViewportConfiguration):
+        (WebCore::ViewportConfiguration::allowsUserScaling):
+        * page/ViewportConfiguration.h:
+        (WebCore::ViewportConfiguration::setForceAlwaysUserScalable):
+        If forceAlwaysUserScalable is set to true, force "user-scalable=yes".
+
 2015-03-25  Dan Bernstein  <mitz@apple.com>
 
         Another attempt to get the iOS EWS building again.
index dbdc521..af142c0 100644 (file)
@@ -47,6 +47,7 @@ static bool constraintsAreAllRelative(const ViewportConfiguration::Parameters& c
 ViewportConfiguration::ViewportConfiguration()
     : m_minimumLayoutSize(1024, 768)
     , m_canIgnoreScalingConstraints(false)
+    , m_forceAlwaysUserScalable(false)
 {
     // Setup a reasonable default configuration to avoid computing infinite scale/sizes.
     // Those are the original iPhone configuration.
@@ -178,7 +179,7 @@ double ViewportConfiguration::minimumScale() const
 
 bool ViewportConfiguration::allowsUserScaling() const
 {
-    return shouldIgnoreScalingConstraints() || m_configuration.allowsUserScaling;
+    return m_forceAlwaysUserScalable || shouldIgnoreScalingConstraints() || m_configuration.allowsUserScaling;
 }
 
 ViewportConfiguration::Parameters ViewportConfiguration::webpageParameters()
index e1acf6e..cbd0642 100644 (file)
@@ -78,6 +78,7 @@ public:
     WEBCORE_EXPORT void setViewportArguments(const ViewportArguments&);
 
     void setCanIgnoreScalingConstraints(bool canIgnoreScalingConstraints) { m_canIgnoreScalingConstraints = canIgnoreScalingConstraints; }
+    void setForceAlwaysUserScalable(bool forceAlwaysUserScalable) { m_forceAlwaysUserScalable = forceAlwaysUserScalable; }
 
     WEBCORE_EXPORT IntSize layoutSize() const;
     WEBCORE_EXPORT double initialScale() const;
@@ -113,6 +114,7 @@ private:
     ViewportArguments m_viewportArguments;
 
     bool m_canIgnoreScalingConstraints;
+    bool m_forceAlwaysUserScalable;
 };
 
 } // namespace WebCore
index 1f6a1b0..1cb5967 100644 (file)
@@ -1,3 +1,15 @@
+2015-03-25  Tim Horton  <timothy_horton@apple.com>
+
+        Add a preference to prevent "user-scalable=no" from having any effect
+        https://bugs.webkit.org/show_bug.cgi?id=143032
+
+        Reviewed by Sam Weinig.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+        Add a preference and push it to the ViewportConfiguration.
+
 2015-03-25  Beth Dakin  <bdakin@apple.com>
 
         REGRESSION (r181660): Force click url preview doesn't have a TextIndicator in Mail
index 5dc37b5..b21519c 100644 (file)
     macro(DeveloperExtrasEnabled, developerExtrasEnabled, Bool, bool, false) \
     macro(LogsPageMessagesToSystemConsoleEnabled, logsPageMessagesToSystemConsoleEnabled, Bool, bool, false) \
     macro(IgnoreViewportScalingConstraints, ignoreViewportScalingConstraints, Bool, bool, true) \
+    macro(ForceAlwaysUserScalable, forceAlwaysUserScalable, Bool, bool, false) \
     \
 
 #define FOR_EACH_WEBKIT_DEBUG_UINT32_PREFERENCE(macro) \
index 6e76570..669756f 100644 (file)
@@ -2867,6 +2867,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 
 #if PLATFORM(IOS)
     m_viewportConfiguration.setCanIgnoreScalingConstraints(store.getBoolValueForKey(WebPreferencesKey::ignoreViewportScalingConstraintsKey()));
+    m_viewportConfiguration.setForceAlwaysUserScalable(store.getBoolValueForKey(WebPreferencesKey::forceAlwaysUserScalableKey()));
 #endif
 }