- Revision
- 231168
- Author
- wenson_hs...@apple.com
- Date
- 2018-04-30 13:56:39 -0700 (Mon, 30 Apr 2018)
Log Message
[Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
https://bugs.webkit.org/show_bug.cgi?id=185132
<rdar://problem/39834562>
Reviewed by Tim Horton.
Source/WebCore:
Removes the `min-device-width` attribute added in r231095. Instead, we key this behavior off of the
`shrink-to-fit` attribute introduced for multitasking on iPad, such that `shrink-to-fit=no` achieves the same
behavior as `min-device-width=0` in extra zoom mode. See comments below for more detail.
Adjusted an existing layout test: fast/viewport/extrazoom/viewport-change-min-device-width.html.
* dom/ViewportArguments.cpp:
(WebCore::setViewportFeature):
(WebCore::operator<<):
* dom/ViewportArguments.h:
Removes the `minDeviceWidth` viewport argument.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const): Deleted.
Removes the runtime switch for `min-device-width`.
* page/ViewportConfiguration.cpp:
(WebCore::platformDeviceWidthOverride):
Hard-code the override device width in extra zoom mode.
(WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
In extra zoom mode, override the device width only if shrink-to-fit has not been expliticly disabled, and the
device width is less than the override device width.
(WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
(WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
(WebCore::ViewportConfiguration::updateConfiguration):
(WebCore::ViewportConfiguration::updateMinimumLayoutSize):
Do not override the minimum layout size if `shrink-to-fit` has been explicitly explicitly disabled, or if the
device width is greater than the override device width.
(WebCore::computedMinDeviceWidth): Deleted.
(WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): Deleted.
* page/ViewportConfiguration.h:
Source/WebKit:
Remove the experimental feature for `min-device-width`.
* Shared/WebPreferences.yaml:
LayoutTests:
Modifies an existing layout test to try out different values of `shrink-to-fit` instead of using the
`min-device-width` attribute. This test now begins with the default viewport configuration, then explicitly
disables `shrink-to-fit` by setting the attribute to a few different values (which should all achieve the same
effect), and lastly explicitly re-enables `shrink-to-fit` by setting the attribute value to several values that
should behave the same as `shrink-to-fit=yes`.
* fast/viewport/extrazoom/viewport-change-min-device-width.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (231167 => 231168)
--- trunk/LayoutTests/ChangeLog 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/LayoutTests/ChangeLog 2018-04-30 20:56:39 UTC (rev 231168)
@@ -1,3 +1,19 @@
+2018-04-30 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
+ https://bugs.webkit.org/show_bug.cgi?id=185132
+ <rdar://problem/39834562>
+
+ Reviewed by Tim Horton.
+
+ Modifies an existing layout test to try out different values of `shrink-to-fit` instead of using the
+ `min-device-width` attribute. This test now begins with the default viewport configuration, then explicitly
+ disables `shrink-to-fit` by setting the attribute to a few different values (which should all achieve the same
+ effect), and lastly explicitly re-enables `shrink-to-fit` by setting the attribute value to several values that
+ should behave the same as `shrink-to-fit=yes`.
+
+ * fast/viewport/extrazoom/viewport-change-min-device-width.html:
+
2018-04-30 Chris Nardi <cna...@chromium.org>
Serialize font-variation-settings with double-quotes per spec
Modified: trunk/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html (231167 => 231168)
--- trunk/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html 2018-04-30 20:56:39 UTC (rev 231168)
@@ -29,27 +29,27 @@
return;
}
- debug("1. Initial min-device-width");
+ debug("1. Default viewport");
await logWindowDimensionsAfterSettingViewportContent("width=150");
await logWindowDimensionsAfterSettingViewportContent("width=device-width");
- scaleAtDeviceWidthForInitialMinDeviceWidth = parseFloat(await UIHelper.zoomScale()).toFixed(3);
+ scaleAtDeviceWidthWithInitialShrinkToFit = parseFloat(await UIHelper.zoomScale()).toFixed(3);
await logWindowDimensionsAfterSettingViewportContent("width=600");
- debug("\n2. min-device-width=0");
- await logWindowDimensionsAfterSettingViewportContent("width=150, min-device-width=0");
- await logWindowDimensionsAfterSettingViewportContent("width=device-width, min-device-width=0");
- scaleAtDeviceWidthForMinDeviceWidth0 = parseFloat(await UIHelper.zoomScale()).toFixed(3);
- await logWindowDimensionsAfterSettingViewportContent("width=600, min-device-width=0");
+ debug("\n2. shrink-to-fit explicitly disabled");
+ await logWindowDimensionsAfterSettingViewportContent("width=150, shrink-to-fit=no");
+ await logWindowDimensionsAfterSettingViewportContent("width=device-width, shrink-to-fit=0");
+ scaleAtDeviceWidthWithShrinkToFitDisabled = parseFloat(await UIHelper.zoomScale()).toFixed(3);
+ await logWindowDimensionsAfterSettingViewportContent("width=600, shrink-to-fit=-0.5");
- debug("\n3. min-device-width=500");
- await logWindowDimensionsAfterSettingViewportContent("width=150, min-device-width=500");
- await logWindowDimensionsAfterSettingViewportContent("width=device-width, min-device-width=500");
- scaleAtDeviceWidthForMinDeviceWidth500 = parseFloat(await UIHelper.zoomScale()).toFixed(3);
- await logWindowDimensionsAfterSettingViewportContent("width=600, min-device-width=500");
+ debug("\n3. shrink-to-fit explicitly enabled");
+ await logWindowDimensionsAfterSettingViewportContent("width=150, shrink-to-fit=yes");
+ await logWindowDimensionsAfterSettingViewportContent("width=device-width, shrink-to-fit=1");
+ scaleAtDeviceWidthWithShrinkToFitEnabled = parseFloat(await UIHelper.zoomScale()).toFixed(3);
+ await logWindowDimensionsAfterSettingViewportContent("width=600, shrink-to-fit=device-width");
- shouldBe("scaleAtDeviceWidthForInitialMinDeviceWidth", "'0.488'");
- shouldBe("scaleAtDeviceWidthForMinDeviceWidth0", "'1.000'");
- shouldBe("scaleAtDeviceWidthForMinDeviceWidth500", "'0.312'");
+ shouldBe("scaleAtDeviceWidthWithInitialShrinkToFit", "'0.488'");
+ shouldBe("scaleAtDeviceWidthWithShrinkToFitDisabled", "'1.000'");
+ shouldBe("scaleAtDeviceWidthWithShrinkToFitEnabled", "'0.488'");
finishJSTest();
}
Modified: trunk/Source/WebCore/ChangeLog (231167 => 231168)
--- trunk/Source/WebCore/ChangeLog 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/Source/WebCore/ChangeLog 2018-04-30 20:56:39 UTC (rev 231168)
@@ -1,3 +1,52 @@
+2018-04-30 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
+ https://bugs.webkit.org/show_bug.cgi?id=185132
+ <rdar://problem/39834562>
+
+ Reviewed by Tim Horton.
+
+ Removes the `min-device-width` attribute added in r231095. Instead, we key this behavior off of the
+ `shrink-to-fit` attribute introduced for multitasking on iPad, such that `shrink-to-fit=no` achieves the same
+ behavior as `min-device-width=0` in extra zoom mode. See comments below for more detail.
+
+ Adjusted an existing layout test: fast/viewport/extrazoom/viewport-change-min-device-width.html.
+
+ * dom/ViewportArguments.cpp:
+ (WebCore::setViewportFeature):
+ (WebCore::operator<<):
+ * dom/ViewportArguments.h:
+
+ Removes the `minDeviceWidth` viewport argument.
+
+ * page/RuntimeEnabledFeatures.h:
+ (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled): Deleted.
+ (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const): Deleted.
+
+ Removes the runtime switch for `min-device-width`.
+
+ * page/ViewportConfiguration.cpp:
+ (WebCore::platformDeviceWidthOverride):
+
+ Hard-code the override device width in extra zoom mode.
+
+ (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
+
+ In extra zoom mode, override the device width only if shrink-to-fit has not been expliticly disabled, and the
+ device width is less than the override device width.
+
+ (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
+ (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
+ (WebCore::ViewportConfiguration::updateConfiguration):
+ (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
+
+ Do not override the minimum layout size if `shrink-to-fit` has been explicitly explicitly disabled, or if the
+ device width is greater than the override device width.
+
+ (WebCore::computedMinDeviceWidth): Deleted.
+ (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): Deleted.
+ * page/ViewportConfiguration.h:
+
2018-04-30 Chris Nardi <cna...@chromium.org>
Serialize font-variation-settings with double-quotes per spec
Modified: trunk/Source/WebCore/dom/ViewportArguments.cpp (231167 => 231168)
--- trunk/Source/WebCore/dom/ViewportArguments.cpp 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/Source/WebCore/dom/ViewportArguments.cpp 2018-04-30 20:56:39 UTC (rev 231168)
@@ -421,8 +421,6 @@
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") && RuntimeEnabledFeatures::sharedFeatures().minDeviceWidthEnabled())
- arguments.minDeviceWidth = numericPrefix(document, key, value);
else
reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, key);
}
@@ -478,7 +476,7 @@
{
TextStream::IndentScope indentScope(ts);
- ts << "\n" << indent << "(width " << viewportArguments.width << ", minWidth " << viewportArguments.minWidth << ", maxWidth " << viewportArguments.maxWidth << ", minDeviceWidth " << viewportArguments.minDeviceWidth << ")";
+ ts << "\n" << indent << "(width " << viewportArguments.width << ", minWidth " << viewportArguments.minWidth << ", maxWidth " << viewportArguments.maxWidth << ")";
ts << "\n" << indent << "(height " << viewportArguments.height << ", minHeight " << viewportArguments.minHeight << ", maxHeight " << viewportArguments.maxHeight << ")";
ts << "\n" << indent << "(zoom " << viewportArguments.zoom << ", minZoom " << viewportArguments.minZoom << ", maxZoom " << viewportArguments.maxZoom << ")";
Modified: trunk/Source/WebCore/dom/ViewportArguments.h (231167 => 231168)
--- trunk/Source/WebCore/dom/ViewportArguments.h 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/Source/WebCore/dom/ViewportArguments.h 2018-04-30 20:56:39 UTC (rev 231168)
@@ -93,7 +93,6 @@
float width { ValueAuto };
float minWidth { ValueAuto };
float maxWidth { ValueAuto };
- float minDeviceWidth { ValueAuto };
float height { ValueAuto };
float minHeight { ValueAuto };
float maxHeight { ValueAuto };
Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (231167 => 231168)
--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2018-04-30 20:56:39 UTC (rev 231168)
@@ -253,9 +253,6 @@
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:
Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (231167 => 231168)
--- trunk/Source/WebCore/page/ViewportConfiguration.cpp 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp 2018-04-30 20:56:39 UTC (rev 231168)
@@ -45,11 +45,8 @@
}
#endif
-static float computedMinDeviceWidth(float minDeviceWidth)
+static float platformDeviceWidthOverride()
{
- if (minDeviceWidth != ViewportArguments::ValueAuto)
- return minDeviceWidth;
-
#if ENABLE(EXTRA_ZOOM_MODE)
return 320;
#else
@@ -135,9 +132,10 @@
return IntSize(layoutWidth(), layoutHeight());
}
-bool ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth() const
+bool ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit() const
{
- return m_viewLayoutSize.width() < computedMinDeviceWidth(m_viewportArguments.minDeviceWidth);
+ auto viewWidth = m_viewLayoutSize.width();
+ return m_viewportArguments.shrinkToFit != 0. && 0 < viewWidth && viewWidth < platformDeviceWidthOverride();
}
bool ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints() const
@@ -145,7 +143,7 @@
if (!m_canIgnoreScalingConstraints)
return false;
- if (shouldOverrideDeviceWidthWithMinDeviceWidth())
+ if (shouldOverrideDeviceWidthAndShrinkToFit())
return true;
if (!m_configuration.allowsShrinkToFit)
@@ -183,7 +181,7 @@
bool ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize() const
{
- return m_canIgnoreScalingConstraints && shouldOverrideDeviceWidthWithMinDeviceWidth();
+ return m_canIgnoreScalingConstraints && shouldOverrideDeviceWidthAndShrinkToFit();
}
double ViewportConfiguration::initialScaleFromSize(double width, double height, bool shouldIgnoreScalingConstraints) const
@@ -371,7 +369,7 @@
m_configuration.allowsUserScaling = m_viewportArguments.userZoom != 0.;
if (booleanViewportArgumentIsSet(m_viewportArguments.shrinkToFit))
- m_configuration.allowsShrinkToFit = shouldOverrideDeviceWidthWithMinDeviceWidth() || m_viewportArguments.shrinkToFit != 0.;
+ m_configuration.allowsShrinkToFit = m_viewportArguments.shrinkToFit != 0.;
m_configuration.avoidsUnsafeArea = m_viewportArguments.viewportFit != ViewportFit::Cover;
@@ -380,12 +378,12 @@
void ViewportConfiguration::updateMinimumLayoutSize()
{
- if (!m_viewLayoutSize.width() || !shouldOverrideDeviceWidthWithMinDeviceWidth()) {
+ if (!shouldOverrideDeviceWidthAndShrinkToFit()) {
m_minimumLayoutSize = m_viewLayoutSize;
return;
}
- auto minDeviceWidth = computedMinDeviceWidth(m_viewportArguments.minDeviceWidth);
+ float minDeviceWidth = platformDeviceWidthOverride();
m_minimumLayoutSize = FloatSize(minDeviceWidth, std::roundf(m_viewLayoutSize.height() * (minDeviceWidth / m_viewLayoutSize.width())));
}
Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (231167 => 231168)
--- trunk/Source/WebCore/page/ViewportConfiguration.h 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h 2018-04-30 20:56:39 UTC (rev 231168)
@@ -82,7 +82,7 @@
const ViewportArguments& viewportArguments() const { return m_viewportArguments; }
WEBCORE_EXPORT bool setViewportArguments(const ViewportArguments&);
- bool shouldOverrideDeviceWidthWithMinDeviceWidth() const;
+ bool shouldOverrideDeviceWidthAndShrinkToFit() const;
WEBCORE_EXPORT bool setCanIgnoreScalingConstraints(bool);
void setForceAlwaysUserScalable(bool forceAlwaysUserScalable) { m_forceAlwaysUserScalable = forceAlwaysUserScalable; }
Modified: trunk/Source/WebKit/ChangeLog (231167 => 231168)
--- trunk/Source/WebKit/ChangeLog 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/Source/WebKit/ChangeLog 2018-04-30 20:56:39 UTC (rev 231168)
@@ -1,3 +1,15 @@
+2018-04-30 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
+ https://bugs.webkit.org/show_bug.cgi?id=185132
+ <rdar://problem/39834562>
+
+ Reviewed by Tim Horton.
+
+ Remove the experimental feature for `min-device-width`.
+
+ * Shared/WebPreferences.yaml:
+
2018-04-30 Keith Rollin <krol...@apple.com>
Include breadcrumb for tracking resource loading into CFNetwork
Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (231167 => 231168)
--- trunk/Source/WebKit/Shared/WebPreferences.yaml 2018-04-30 20:28:22 UTC (rev 231167)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml 2018-04-30 20:56:39 UTC (rev 231168)
@@ -1248,11 +1248,3 @@
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