Title: [184707] branches/safari-601.1.32.2-branch/Source/WebCore

Diff

Modified: branches/safari-601.1.32.2-branch/Source/WebCore/ChangeLog (184706 => 184707)


--- branches/safari-601.1.32.2-branch/Source/WebCore/ChangeLog	2015-05-21 06:39:35 UTC (rev 184706)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/ChangeLog	2015-05-21 06:39:40 UTC (rev 184707)
@@ -1,5 +1,46 @@
 2015-05-20  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r184654. rdar://problem/21044514
+
+    2015-05-20  Tim Horton  <timothy_hor...@apple.com>
+
+            Add a mechanism to opt-out of the automatic scaling applied to not-really-responsive sites
+            https://bugs.webkit.org/show_bug.cgi?id=144760
+
+            Reviewed by Darin Adler.
+
+            Add a new viewport property, shrink-to-fit, which can be used to disable
+            the automatic scaling introduced in r181400. This provides sites with a
+            way to tell WebKit that they're really sure they want to be laid out at
+            window-width/height, even if they fail to fit within that size.
+
+            * dom/ViewportArguments.cpp:
+            (WebCore::ViewportArguments::resolve):
+            (WebCore::findBooleanValue):
+            (WebCore::setViewportFeature):
+            * dom/ViewportArguments.h:
+            (WebCore::ViewportArguments::ViewportArguments):
+            (WebCore::ViewportArguments::operator==):
+            * page/ViewportConfiguration.cpp:
+            (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints):
+            (WebCore::ViewportConfiguration::shouldIgnoreVerticalScalingConstraints):
+            (WebCore::ViewportConfiguration::webpageParameters):
+            (WebCore::ViewportConfiguration::textDocumentParameters):
+            (WebCore::ViewportConfiguration::imageDocumentParameters):
+            (WebCore::ViewportConfiguration::testingParameters):
+            (WebCore::booleanViewportArgumentIsSet):
+            (WebCore::ViewportConfiguration::updateConfiguration):
+            (WebCore::ViewportConfigurationTextStream::operator<<):
+            (WebCore::viewportArgumentUserZoomIsSet): Deleted.
+            * page/ViewportConfiguration.h:
+            (WebCore::ViewportConfiguration::Parameters::Parameters):
+            Plumb the shrink-to-fit viewport property through.
+            If shrink-to-fit is set to yes, or not set, we behave as usual; if it is
+            set to no, we will bail from shouldIgnore[Horizontal|Vertical]ScalingConstraints,
+            effectively disabling the automatic scaling introduced in r181400.
+
+2015-05-20  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r184681. rdar://problem/20924495
 
     2015-05-20  Enrica Casucci  <enr...@apple.com>

Modified: branches/safari-601.1.32.2-branch/Source/WebCore/dom/ViewportArguments.cpp (184706 => 184707)


--- branches/safari-601.1.32.2-branch/Source/WebCore/dom/ViewportArguments.cpp	2015-05-21 06:39:35 UTC (rev 184706)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/dom/ViewportArguments.cpp	2015-05-21 06:39:40 UTC (rev 184707)
@@ -86,7 +86,6 @@
     float resultZoom = zoom;
     float resultMinZoom = minZoom;
     float resultMaxZoom = maxZoom;
-    float resultUserZoom = userZoom;
 
     switch (int(resultWidth)) {
     case ViewportArguments::ValueDeviceWidth:
@@ -244,8 +243,9 @@
     // if (resultZoom == ViewportArguments::ValueAuto)
     //    result.initialScale = ViewportArguments::ValueAuto;
 
-    result.userScalable = resultUserZoom;
+    result.userScalable = userZoom;
     result.orientation = orientation;
+    result.shrinkToFit = shrinkToFit;
 
     return result;
 }
@@ -354,7 +354,7 @@
     return value;
 }
 
-static float findUserScalableValue(const String& keyString, const String& valueString, Document* document)
+static float findBooleanValue(const String& keyString, const String& valueString, Document* document)
 {
     // yes and no are used as keywords.
     // Numbers >= 1, numbers <= -1, device-width and device-height are mapped to yes.
@@ -392,12 +392,14 @@
     else if (keyString == "maximum-scale")
         arguments->maxZoom = findScaleValue(keyString, valueString, document);
     else if (keyString == "user-scalable")
-        arguments->userZoom = findUserScalableValue(keyString, valueString, document);
+        arguments->userZoom = findBooleanValue(keyString, valueString, document);
 #if PLATFORM(IOS)
     else if (keyString == "minimal-ui")
-        // FIXME: Ignore silently for now. This should eventually fallback to the warning.
+        // FIXME: Ignore silently for now. This should eventually fall back to the warning.
         { }
 #endif
+    else if (keyString == "shrink-to-fit")
+        arguments->shrinkToFit = findBooleanValue(keyString, valueString, document);
     else
         reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, keyString, String());
 }

Modified: branches/safari-601.1.32.2-branch/Source/WebCore/dom/ViewportArguments.h (184706 => 184707)


--- branches/safari-601.1.32.2-branch/Source/WebCore/dom/ViewportArguments.h	2015-05-21 06:39:35 UTC (rev 184706)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/dom/ViewportArguments.h	2015-05-21 06:39:40 UTC (rev 184707)
@@ -51,6 +51,7 @@
 
     float userScalable;
     float orientation;
+    float shrinkToFit;
 };
 
 struct ViewportArguments {
@@ -76,34 +77,24 @@
 
     explicit ViewportArguments(Type type = Implicit)
         : type(type)
-        , width(ValueAuto)
-        , minWidth(ValueAuto)
-        , maxWidth(ValueAuto)
-        , height(ValueAuto)
-        , minHeight(ValueAuto)
-        , maxHeight(ValueAuto)
-        , zoom(ValueAuto)
-        , minZoom(ValueAuto)
-        , maxZoom(ValueAuto)
-        , userZoom(ValueAuto)
-        , orientation(ValueAuto)
     {
     }
 
     // All arguments are in CSS units.
     ViewportAttributes resolve(const FloatSize& initialViewportSize, const FloatSize& deviceSize, int defaultWidth) const;
 
-    float width;
-    float minWidth;
-    float maxWidth;
-    float height;
-    float minHeight;
-    float maxHeight;
-    float zoom;
-    float minZoom;
-    float maxZoom;
-    float userZoom;
-    float orientation;
+    float width { ValueAuto };
+    float minWidth { ValueAuto };
+    float maxWidth { ValueAuto };
+    float height { ValueAuto };
+    float minHeight { ValueAuto };
+    float maxHeight { ValueAuto };
+    float zoom { ValueAuto };
+    float minZoom { ValueAuto };
+    float maxZoom { ValueAuto };
+    float userZoom { ValueAuto };
+    float orientation { ValueAuto };
+    float shrinkToFit { ValueAuto };
 
     bool operator==(const ViewportArguments& other) const
     {
@@ -119,7 +110,8 @@
             && minZoom == other.minZoom
             && maxZoom == other.maxZoom
             && userZoom == other.userZoom
-            && orientation == other.orientation;
+            && orientation == other.orientation
+            && shrinkToFit == other.shrinkToFit;
     }
 
     bool operator!=(const ViewportArguments& other) const

Modified: branches/safari-601.1.32.2-branch/Source/WebCore/page/ViewportConfiguration.cpp (184706 => 184707)


--- branches/safari-601.1.32.2-branch/Source/WebCore/page/ViewportConfiguration.cpp	2015-05-21 06:39:35 UTC (rev 184706)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/page/ViewportConfiguration.cpp	2015-05-21 06:39:40 UTC (rev 184707)
@@ -103,6 +103,9 @@
     if (!m_canIgnoreScalingConstraints)
         return false;
 
+    if (!m_configuration.allowsShrinkToFit)
+        return false;
+
     bool laidOutWiderThanViewport = m_contentSize.width() > layoutWidth();
     if (m_viewportArguments.width == ViewportArguments::ValueDeviceWidth)
         return laidOutWiderThanViewport;
@@ -118,6 +121,9 @@
     if (!m_canIgnoreScalingConstraints)
         return false;
 
+    if (!m_configuration.allowsShrinkToFit)
+        return false;
+
     bool laidOutTallerThanViewport = m_contentSize.height() > layoutHeight();
     if (m_viewportArguments.height == ViewportArguments::ValueDeviceHeight && m_viewportArguments.width == ViewportArguments::ValueAuto)
         return laidOutTallerThanViewport;
@@ -196,6 +202,7 @@
     parameters.width = 980;
     parameters.widthIsSet = true;
     parameters.allowsUserScaling = true;
+    parameters.allowsShrinkToFit = true;
     parameters.minimumScale = 0.25;
     parameters.maximumScale = 5;
     return parameters;
@@ -214,6 +221,7 @@
 
     parameters.widthIsSet = true;
     parameters.allowsUserScaling = true;
+    parameters.allowsShrinkToFit = false;
     parameters.minimumScale = 0.25;
     parameters.maximumScale = 5;
     return parameters;
@@ -225,6 +233,7 @@
     parameters.width = 980;
     parameters.widthIsSet = true;
     parameters.allowsUserScaling = true;
+    parameters.allowsShrinkToFit = false;
     parameters.minimumScale = 0.01;
     parameters.maximumScale = 5;
     return parameters;
@@ -242,6 +251,7 @@
     Parameters parameters;
     parameters.initialScale = 1;
     parameters.initialScaleIsSet = true;
+    parameters.allowsShrinkToFit = true;
     parameters.minimumScale = 1;
     parameters.maximumScale = 5;
     return parameters;
@@ -269,7 +279,7 @@
         valueIsSet = false;
 }
 
-static inline bool viewportArgumentUserZoomIsSet(float value)
+static inline bool booleanViewportArgumentIsSet(float value)
 {
     return !value || value == 1;
 }
@@ -300,8 +310,11 @@
         m_configuration.heightIsSet = viewportArgumentsOverridesHeight;
     }
 
-    if (viewportArgumentUserZoomIsSet(m_viewportArguments.userZoom))
+    if (booleanViewportArgumentIsSet(m_viewportArguments.userZoom))
         m_configuration.allowsUserScaling = m_viewportArguments.userZoom != 0.;
+
+    if (booleanViewportArgumentIsSet(m_viewportArguments.shrinkToFit))
+        m_configuration.allowsShrinkToFit = m_viewportArguments.shrinkToFit != 0.;
 }
 
 double ViewportConfiguration::viewportArgumentsLength(double length) const
@@ -445,6 +458,7 @@
     dumpProperty(ts, "minimumScale", parameters.minimumScale);
     dumpProperty(ts, "maximumScale", parameters.maximumScale);
     dumpProperty(ts, "allowsUserScaling", parameters.allowsUserScaling);
+    dumpProperty(ts, "allowsShrinkToFit", parameters.allowsShrinkToFit);
 
     return ts;
 }

Modified: branches/safari-601.1.32.2-branch/Source/WebCore/page/ViewportConfiguration.h (184706 => 184707)


--- branches/safari-601.1.32.2-branch/Source/WebCore/page/ViewportConfiguration.h	2015-05-21 06:39:35 UTC (rev 184706)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/page/ViewportConfiguration.h	2015-05-21 06:39:40 UTC (rev 184707)
@@ -45,6 +45,7 @@
             , minimumScale(0)
             , maximumScale(0)
             , allowsUserScaling(false)
+            , allowsShrinkToFit(false)
             , widthIsSet(false)
             , heightIsSet(false)
             , initialScaleIsSet(false)
@@ -57,6 +58,7 @@
         double minimumScale;
         double maximumScale;
         bool allowsUserScaling;
+        bool allowsShrinkToFit;
 
         bool widthIsSet;
         bool heightIsSet;
@@ -86,6 +88,7 @@
     WEBCORE_EXPORT double minimumScale() const;
     double maximumScale() const { return m_configuration.maximumScale; }
     WEBCORE_EXPORT bool allowsUserScaling() const;
+    bool allowsShrinkToFit() const;
 
     WEBCORE_EXPORT static Parameters webpageParameters();
     WEBCORE_EXPORT static Parameters textDocumentParameters();
@@ -97,7 +100,7 @@
     WTF::CString description() const;
     void dump() const;
 #endif
-    
+
 private:
     void updateConfiguration();
     double viewportArgumentsLength(double length) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to