[iOS] Adjust initial scale zooming heuristics when changing view scale
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 00:19:49 +0000 (00:19 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 00:19:49 +0000 (00:19 +0000)
commit75fa5939c5c99235c116c77a58e86bcbb064e7b2
tree54309ce3900684e0b6cab422b260f3a540f14c4e
parent4f4d0cbddfbb384b0012a6848ee43c88a33d0da5
[iOS] Adjust initial scale zooming heuristics when changing view scale
https://bugs.webkit.org/show_bug.cgi?id=194995

Reviewed by Tim Horton.

Source/WebKit:

Currently, we only zoom to the new initial scale iff we're exactly at initial scale before changing the view
scale. This was done so that if a user zoomed in really far and then increased the view scale, we wouldn't end
up zooming out as a result. However, this leads to confusing behavior in the case where the user has manually
changed the zoom scale to something close to (but not exactly) initial scale, and then attempts to zoom in
further using view scale. In this case, we'll end up keeping page scale the same, so it looks like nothing is
happening.

To fix this, we tweak our heuristics for determining whether to jump to initial scale; if the view scale is
increasing and the new initial scale is greater than the current scale, zoom to initial scale. Likewise, if the
view scale is decreasing and the new initial scale is less than the current scale, zoom to initial scale.

Test: fast/viewport/ios/initial-scale-after-changing-view-scale.html

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setViewportConfigurationViewLayoutSize):

LayoutTests:

Rebaseline and adjust an existing layout test.

* fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt:
* fast/viewport/ios/initial-scale-after-changing-view-scale.html:
* platform/ipad/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt: Removed.

Removed an iPad-specific test expectation, since initial scale zooming behavior should be the same now at both
device dimensions.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt
LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale.html
LayoutTests/platform/ipad/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt [deleted file]
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm