Changeset 231168 in webkit
- Timestamp:
- Apr 30, 2018 1:56:39 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r231165 r231168 1 2018-04-30 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width 4 https://bugs.webkit.org/show_bug.cgi?id=185132 5 <rdar://problem/39834562> 6 7 Reviewed by Tim Horton. 8 9 Modifies an existing layout test to try out different values of `shrink-to-fit` instead of using the 10 `min-device-width` attribute. This test now begins with the default viewport configuration, then explicitly 11 disables `shrink-to-fit` by setting the attribute to a few different values (which should all achieve the same 12 effect), and lastly explicitly re-enables `shrink-to-fit` by setting the attribute value to several values that 13 should behave the same as `shrink-to-fit=yes`. 14 15 * fast/viewport/extrazoom/viewport-change-min-device-width.html: 16 1 17 2018-04-30 Chris Nardi <cnardi@chromium.org> 2 18 -
trunk/LayoutTests/fast/viewport/extrazoom/viewport-change-min-device-width.html
r231095 r231168 30 30 } 31 31 32 debug("1. Initial min-device-width");32 debug("1. Default viewport"); 33 33 await logWindowDimensionsAfterSettingViewportContent("width=150"); 34 34 await logWindowDimensionsAfterSettingViewportContent("width=device-width"); 35 scaleAtDeviceWidth ForInitialMinDeviceWidth= parseFloat(await UIHelper.zoomScale()).toFixed(3);35 scaleAtDeviceWidthWithInitialShrinkToFit = parseFloat(await UIHelper.zoomScale()).toFixed(3); 36 36 await logWindowDimensionsAfterSettingViewportContent("width=600"); 37 37 38 debug("\n2. min-device-width=0");39 await logWindowDimensionsAfterSettingViewportContent("width=150, min-device-width=0");40 await logWindowDimensionsAfterSettingViewportContent("width=device-width, min-device-width=0");41 scaleAtDeviceWidth ForMinDeviceWidth0= parseFloat(await UIHelper.zoomScale()).toFixed(3);42 await logWindowDimensionsAfterSettingViewportContent("width=600, min-device-width=0");38 debug("\n2. shrink-to-fit explicitly disabled"); 39 await logWindowDimensionsAfterSettingViewportContent("width=150, shrink-to-fit=no"); 40 await logWindowDimensionsAfterSettingViewportContent("width=device-width, shrink-to-fit=0"); 41 scaleAtDeviceWidthWithShrinkToFitDisabled = parseFloat(await UIHelper.zoomScale()).toFixed(3); 42 await logWindowDimensionsAfterSettingViewportContent("width=600, shrink-to-fit=-0.5"); 43 43 44 debug("\n3. min-device-width=500");45 await logWindowDimensionsAfterSettingViewportContent("width=150, min-device-width=500");46 await logWindowDimensionsAfterSettingViewportContent("width=device-width, min-device-width=500");47 scaleAtDeviceWidth ForMinDeviceWidth500= parseFloat(await UIHelper.zoomScale()).toFixed(3);48 await logWindowDimensionsAfterSettingViewportContent("width=600, min-device-width=500");44 debug("\n3. shrink-to-fit explicitly enabled"); 45 await logWindowDimensionsAfterSettingViewportContent("width=150, shrink-to-fit=yes"); 46 await logWindowDimensionsAfterSettingViewportContent("width=device-width, shrink-to-fit=1"); 47 scaleAtDeviceWidthWithShrinkToFitEnabled = parseFloat(await UIHelper.zoomScale()).toFixed(3); 48 await logWindowDimensionsAfterSettingViewportContent("width=600, shrink-to-fit=device-width"); 49 49 50 shouldBe("scaleAtDeviceWidth ForInitialMinDeviceWidth", "'0.488'");51 shouldBe("scaleAtDeviceWidth ForMinDeviceWidth0", "'1.000'");52 shouldBe("scaleAtDeviceWidth ForMinDeviceWidth500", "'0.312'");50 shouldBe("scaleAtDeviceWidthWithInitialShrinkToFit", "'0.488'"); 51 shouldBe("scaleAtDeviceWidthWithShrinkToFitDisabled", "'1.000'"); 52 shouldBe("scaleAtDeviceWidthWithShrinkToFitEnabled", "'0.488'"); 53 53 54 54 finishJSTest(); -
trunk/Source/WebCore/ChangeLog
r231165 r231168 1 2018-04-30 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width 4 https://bugs.webkit.org/show_bug.cgi?id=185132 5 <rdar://problem/39834562> 6 7 Reviewed by Tim Horton. 8 9 Removes the `min-device-width` attribute added in r231095. Instead, we key this behavior off of the 10 `shrink-to-fit` attribute introduced for multitasking on iPad, such that `shrink-to-fit=no` achieves the same 11 behavior as `min-device-width=0` in extra zoom mode. See comments below for more detail. 12 13 Adjusted an existing layout test: fast/viewport/extrazoom/viewport-change-min-device-width.html. 14 15 * dom/ViewportArguments.cpp: 16 (WebCore::setViewportFeature): 17 (WebCore::operator<<): 18 * dom/ViewportArguments.h: 19 20 Removes the `minDeviceWidth` viewport argument. 21 22 * page/RuntimeEnabledFeatures.h: 23 (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled): Deleted. 24 (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const): Deleted. 25 26 Removes the runtime switch for `min-device-width`. 27 28 * page/ViewportConfiguration.cpp: 29 (WebCore::platformDeviceWidthOverride): 30 31 Hard-code the override device width in extra zoom mode. 32 33 (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const): 34 35 In extra zoom mode, override the device width only if shrink-to-fit has not been expliticly disabled, and the 36 device width is less than the override device width. 37 38 (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const): 39 (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const): 40 (WebCore::ViewportConfiguration::updateConfiguration): 41 (WebCore::ViewportConfiguration::updateMinimumLayoutSize): 42 43 Do not override the minimum layout size if `shrink-to-fit` has been explicitly explicitly disabled, or if the 44 device width is greater than the override device width. 45 46 (WebCore::computedMinDeviceWidth): Deleted. 47 (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): Deleted. 48 * page/ViewportConfiguration.h: 49 1 50 2018-04-30 Chris Nardi <cnardi@chromium.org> 2 51 -
trunk/Source/WebCore/dom/ViewportArguments.cpp
r231106 r231168 422 422 else if (equalLettersIgnoringASCIICase(key, "viewport-fit") && document.settings().viewportFitEnabled()) 423 423 arguments.viewportFit = parseViewportFitValue(document, key, value); 424 else if (equalLettersIgnoringASCIICase(key, "min-device-width") && RuntimeEnabledFeatures::sharedFeatures().minDeviceWidthEnabled())425 arguments.minDeviceWidth = numericPrefix(document, key, value);426 424 else 427 425 reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, key); … … 479 477 TextStream::IndentScope indentScope(ts); 480 478 481 ts << "\n" << indent << "(width " << viewportArguments.width << ", minWidth " << viewportArguments.minWidth << ", maxWidth " << viewportArguments.maxWidth << " , minDeviceWidth " << viewportArguments.minDeviceWidth << ")";479 ts << "\n" << indent << "(width " << viewportArguments.width << ", minWidth " << viewportArguments.minWidth << ", maxWidth " << viewportArguments.maxWidth << ")"; 482 480 ts << "\n" << indent << "(height " << viewportArguments.height << ", minHeight " << viewportArguments.minHeight << ", maxHeight " << viewportArguments.maxHeight << ")"; 483 481 ts << "\n" << indent << "(zoom " << viewportArguments.zoom << ", minZoom " << viewportArguments.minZoom << ", maxZoom " << viewportArguments.maxZoom << ")"; -
trunk/Source/WebCore/dom/ViewportArguments.h
r231095 r231168 94 94 float minWidth { ValueAuto }; 95 95 float maxWidth { ValueAuto }; 96 float minDeviceWidth { ValueAuto };97 96 float height { ValueAuto }; 98 97 float minHeight { ValueAuto }; -
trunk/Source/WebCore/page/RuntimeEnabledFeatures.h
r231149 r231168 254 254 bool fromOriginResponseHeaderEnabled() const { return m_fromOriginResponseHeaderEnabled; } 255 255 256 void setMinDeviceWidthEnabled(bool isEnabled) { m_minDeviceWidthEnabled = isEnabled; }257 bool minDeviceWidthEnabled() const { return m_minDeviceWidthEnabled; }258 259 256 WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures(); 260 257 -
trunk/Source/WebCore/page/ViewportConfiguration.cpp
r231097 r231168 46 46 #endif 47 47 48 static float computedMinDeviceWidth(float minDeviceWidth) 49 { 50 if (minDeviceWidth != ViewportArguments::ValueAuto) 51 return minDeviceWidth; 52 48 static float platformDeviceWidthOverride() 49 { 53 50 #if ENABLE(EXTRA_ZOOM_MODE) 54 51 return 320; … … 136 133 } 137 134 138 bool ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth() const 139 { 140 return m_viewLayoutSize.width() < computedMinDeviceWidth(m_viewportArguments.minDeviceWidth); 135 bool ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit() const 136 { 137 auto viewWidth = m_viewLayoutSize.width(); 138 return m_viewportArguments.shrinkToFit != 0. && 0 < viewWidth && viewWidth < platformDeviceWidthOverride(); 141 139 } 142 140 … … 146 144 return false; 147 145 148 if (shouldOverrideDeviceWidth WithMinDeviceWidth())146 if (shouldOverrideDeviceWidthAndShrinkToFit()) 149 147 return true; 150 148 … … 184 182 bool ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize() const 185 183 { 186 return m_canIgnoreScalingConstraints && shouldOverrideDeviceWidth WithMinDeviceWidth();184 return m_canIgnoreScalingConstraints && shouldOverrideDeviceWidthAndShrinkToFit(); 187 185 } 188 186 … … 372 370 373 371 if (booleanViewportArgumentIsSet(m_viewportArguments.shrinkToFit)) 374 m_configuration.allowsShrinkToFit = shouldOverrideDeviceWidthWithMinDeviceWidth() ||m_viewportArguments.shrinkToFit != 0.;372 m_configuration.allowsShrinkToFit = m_viewportArguments.shrinkToFit != 0.; 375 373 376 374 m_configuration.avoidsUnsafeArea = m_viewportArguments.viewportFit != ViewportFit::Cover; … … 381 379 void ViewportConfiguration::updateMinimumLayoutSize() 382 380 { 383 if (! m_viewLayoutSize.width() || !shouldOverrideDeviceWidthWithMinDeviceWidth()) {381 if (!shouldOverrideDeviceWidthAndShrinkToFit()) { 384 382 m_minimumLayoutSize = m_viewLayoutSize; 385 383 return; 386 384 } 387 385 388 auto minDeviceWidth = computedMinDeviceWidth(m_viewportArguments.minDeviceWidth);386 float minDeviceWidth = platformDeviceWidthOverride(); 389 387 m_minimumLayoutSize = FloatSize(minDeviceWidth, std::roundf(m_viewLayoutSize.height() * (minDeviceWidth / m_viewLayoutSize.width()))); 390 388 } -
trunk/Source/WebCore/page/ViewportConfiguration.h
r231097 r231168 83 83 WEBCORE_EXPORT bool setViewportArguments(const ViewportArguments&); 84 84 85 bool shouldOverrideDeviceWidth WithMinDeviceWidth() const;85 bool shouldOverrideDeviceWidthAndShrinkToFit() const; 86 86 87 87 WEBCORE_EXPORT bool setCanIgnoreScalingConstraints(bool); -
trunk/Source/WebKit/ChangeLog
r231163 r231168 1 2018-04-30 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width 4 https://bugs.webkit.org/show_bug.cgi?id=185132 5 <rdar://problem/39834562> 6 7 Reviewed by Tim Horton. 8 9 Remove the experimental feature for `min-device-width`. 10 11 * Shared/WebPreferences.yaml: 12 1 13 2018-04-30 Keith Rollin <krollin@apple.com> 2 14 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r231106 r231168 1249 1249 category: experimental 1250 1250 webcoreBinding: RuntimeEnabledFeatures 1251 1252 MinDeviceWidthEnabled:1253 type: bool1254 defaultValue: DEFAULT_MIN_DEVICE_WIDTH_ENABLED1255 humanReadableName: "Minimum device width"1256 humanReadableDescription: "Enable the min-device-width viewport parameter"1257 category: experimental1258 webcoreBinding: RuntimeEnabledFeatures
Note: See TracChangeset
for help on using the changeset viewer.