Changeset 248292 in webkit
- Timestamp:
- Aug 6, 2019, 7:49:25 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/viewport/ios/non-responsive-viewport-after-changing-view-scale-expected.txt (added)
-
LayoutTests/fast/viewport/ios/non-responsive-viewport-after-changing-view-scale.html (added)
-
LayoutTests/fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale-expected.txt (added)
-
LayoutTests/fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale.html (added)
-
LayoutTests/platform/ipad/fast/viewport/ios/non-responsive-viewport-after-changing-view-scale-expected.txt (added)
-
LayoutTests/platform/ipad/fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale-expected.txt (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/ViewportConfiguration.cpp (modified) (4 diffs)
-
Source/WebCore/page/ViewportConfiguration.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r248289 r248292 1 2019-08-06 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iPadOS] Unable to increase zoom level on Google using the Aa menu 4 https://bugs.webkit.org/show_bug.cgi?id=200453 5 <rdar://problem/52278579> 6 7 Reviewed by Tim Horton. 8 9 Adds a couple of layout tests (with device-specific expectations) to verify that the two scenarios targeted by 10 this change are fixed. 11 12 * fast/viewport/ios/non-responsive-viewport-after-changing-view-scale-expected.txt: Added. 13 * fast/viewport/ios/non-responsive-viewport-after-changing-view-scale.html: Added. 14 15 Verifies that, for a page with no viewport meta tag (where we fall back to a fixed 980px viewport on iPhone), 16 changing view scale still changes page scale and window size. 17 18 * fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale-expected.txt: Added. 19 * fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale.html: Added. 20 21 Verifies that, for a page with a responsive meta viewport tag containing a fixed-width element that forces a 22 minimum width for the page, setting the view scale such that the page scrolls horizontally (2.5) doesn't result 23 in the initial scale being adjusted back to the maximum scale that would accomodate the full contents of the 24 page (2). 25 26 * platform/ipad/fast/viewport/ios/non-responsive-viewport-after-changing-view-scale-expected.txt: Added. 27 * platform/ipad/fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale-expected.txt: Added. 28 1 29 2019-08-05 Devin Rousso <drousso@apple.com> 2 30 -
trunk/Source/WebCore/ChangeLog
r248290 r248292 1 2019-08-06 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iPadOS] Unable to increase zoom level on Google using the Aa menu 4 https://bugs.webkit.org/show_bug.cgi?id=200453 5 <rdar://problem/52278579> 6 7 Reviewed by Tim Horton. 8 9 Makes a couple of minor adjustments to how layout size scale factor is handled in ViewportConfiguration, to 10 address some scenarios in which adjusting WKWebView's _viewScale does not have any apparent effect on the page. 11 See changes below for more detail. 12 13 Tests: fast/viewport/ios/non-responsive-viewport-after-changing-view-scale.html 14 fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale.html 15 16 * page/ViewportConfiguration.cpp: 17 (WebCore::ViewportConfiguration::initialScaleFromSize const): 18 19 When the page is either zoomed in or zoomed out using _viewScale, let the specified initial scale take 20 precedence over the scale computed by fitting the content width to the view width, or the scale computed by 21 fitting the content height to the view height. 22 23 This avoids a scenario in which nothing happens when increasing view scale in a responsively designed web page 24 that has a fixed minimum width. Before this change, when computing the initial scale at a view scale that would 25 not allow the entire content width of the page to fit within the viewport, the new initial scale would remain 26 unchanged if the initial scale in the meta viewport is not also set to 1, because a new initial scale would be 27 computed in ViewportConfiguration::initialScaleFromSize to accomodate for the entire content width. 28 29 Our new behavior allows us to zoom into the page, even if doing so would cause horizontal scrolling. 30 31 (WebCore::ViewportConfiguration::updateConfiguration): 32 33 When the page is either zoomed in or zoomed out using _viewScale and the default viewport configuration has a 34 fixed width (e.g. on iPhone), then adjust the width of the default viewport configuration to account for the 35 _viewScale. For example, the default width of a viewport-less web page is 980px on iPhone; at a view scale of 2, 36 this would become 490px instead, and at 0.5 view scale, it would become 1960px. 37 38 This ensures that on iPhone, for web pages without a meta viewport, changing the view scale still changes the 39 layout and initial scale of the web page. 40 41 * page/ViewportConfiguration.h: 42 (WebCore::ViewportConfiguration::layoutSizeIsExplicitlyScaled const): 43 1 44 2019-08-05 Zalan Bujtas <zalan@apple.com> 2 45 -
trunk/Source/WebCore/page/ViewportConfiguration.cpp
r244849 r248292 247 247 ASSERT(!constraintsAreAllRelative(m_configuration)); 248 248 249 auto clampToMinimumAndMaximumScales = [&] (double initialScale) { 250 return clampTo<double>(initialScale, shouldIgnoreScalingConstraints ? m_defaultConfiguration.minimumScale : m_configuration.minimumScale, m_configuration.maximumScale); 251 }; 252 253 if (layoutSizeIsExplicitlyScaled()) { 254 if (m_configuration.initialScaleIsSet) 255 return clampToMinimumAndMaximumScales(m_configuration.initialScale); 256 257 if (m_configuration.width > 0) 258 return clampToMinimumAndMaximumScales(m_viewLayoutSize.width() / m_configuration.width); 259 } 260 249 261 // If the document has specified its own initial scale, use it regardless. 250 262 // This is guaranteed to be sanity checked already, so no need for MIN/MAX. … … 262 274 initialScale = m_viewLayoutSize.height() / height; 263 275 264 return std::min(std::max(initialScale, shouldIgnoreScalingConstraints ? m_defaultConfiguration.minimumScale : m_configuration.minimumScale), m_configuration.maximumScale);276 return clampToMinimumAndMaximumScales(initialScale); 265 277 } 266 278 … … 459 471 bool viewportArgumentsOverridesHeight; 460 472 473 auto effectiveLayoutScale = effectiveLayoutSizeScaleFactor(); 474 475 if (layoutSizeIsExplicitlyScaled()) 476 m_configuration.width /= effectiveLayoutScale; 477 461 478 applyViewportArgument(m_configuration.minimumScale, m_viewportArguments.minZoom, minimumViewportArgumentsScaleFactor, maximumViewportArgumentsScaleFactor); 462 479 applyViewportArgument(m_configuration.maximumScale, m_viewportArguments.maxZoom, m_configuration.minimumScale, maximumViewportArgumentsScaleFactor); … … 487 504 m_configuration.avoidsUnsafeArea = m_viewportArguments.viewportFit != ViewportFit::Cover; 488 505 m_configuration.initialScaleIgnoringLayoutScaleFactor = m_configuration.initialScale; 489 float effectiveLayoutScale = effectiveLayoutSizeScaleFactor();490 506 m_configuration.initialScale *= effectiveLayoutScale; 491 507 m_configuration.minimumScale *= effectiveLayoutScale; -
trunk/Source/WebCore/page/ViewportConfiguration.h
r244944 r248292 157 157 bool canOverrideConfigurationParameters() const; 158 158 159 constexpr bool layoutSizeIsExplicitlyScaled() const 160 { 161 return m_layoutSizeScaleFactor != 1; 162 } 163 159 164 constexpr double forceAlwaysUserScalableMaximumScale() const 160 165 {
Note:
See TracChangeset
for help on using the changeset viewer.