Title: [242059] trunk
Revision
242059
Author
[email protected]
Date
2019-02-25 16:19:49 -0800 (Mon, 25 Feb 2019)

Log Message

[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.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (242058 => 242059)


--- trunk/LayoutTests/ChangeLog	2019-02-25 23:11:19 UTC (rev 242058)
+++ trunk/LayoutTests/ChangeLog	2019-02-26 00:19:49 UTC (rev 242059)
@@ -1,3 +1,19 @@
+2019-02-25  Wenson Hsieh  <[email protected]>
+
+        [iOS] Adjust initial scale zooming heuristics when changing view scale
+        https://bugs.webkit.org/show_bug.cgi?id=194995
+
+        Reviewed by Tim Horton.
+
+        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.
+
 2019-02-25  Frederic Wang  <[email protected]>
 
         Split iOS tests for hit testing in iframes

Modified: trunk/LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt (242058 => 242059)


--- trunk/LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt	2019-02-25 23:11:19 UTC (rev 242058)
+++ trunk/LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt	2019-02-26 00:19:49 UTC (rev 242059)
@@ -5,12 +5,12 @@
 
 Page scale after double tapping to zoom in  : 1.60
  - Page scale after setViewScale(1.25)      : 1.60
- - Page scale after setViewScale(0.75)      : 1.60
- - Page scale after setViewScale(1)         : 1.60
-
-Page scale after double tapping to zoom out : 1.00
- - Page scale after setViewScale(1.25)      : 1.25
  - Page scale after setViewScale(0.75)      : 0.75
  - Page scale after setViewScale(1)         : 1.00
 
+Page scale after double tapping to zoom in again : 1.60
+ - Page scale after setViewScale(0.75)           : 0.75
+ - Page scale after setViewScale(1.25)           : 1.25
+ - Page scale after setViewScale(1)              : 1.00
+
 This test verifies that changing the view scale zooms the page to initial scale, but only if the page was already at initial scale. To manually test, (1) change the zoom scale without changing the page scale in any way, and check that the page zooms to initial scale; (2) now double tap on the box to zoom in, and check that changing zoom levels does not change the page scale; (3) finally, double tap on the box again to zoom back out to initial scale, and check that changing zoom levels automatically zooms the page to initial scale once again.

Modified: trunk/LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale.html (242058 => 242059)


--- trunk/LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale.html	2019-02-25 23:11:19 UTC (rev 242058)
+++ trunk/LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale.html	2019-02-26 00:19:49 UTC (rev 242059)
@@ -70,10 +70,10 @@
         appendOutput(` - Page scale after setViewScale(0.75)      : ${await pageScaleAfterSettingViewScale(0.75)}`);
         appendOutput(` - Page scale after setViewScale(1)         : ${await pageScaleAfterSettingViewScale(1)}`);
         appendOutput("");
-        appendOutput(`Page scale after double tapping to zoom out : ${await pageScaleAfterDoubleTappingOnSquare()}`);
-        appendOutput(` - Page scale after setViewScale(1.25)      : ${await pageScaleAfterSettingViewScale(1.25)}`);
-        appendOutput(` - Page scale after setViewScale(0.75)      : ${await pageScaleAfterSettingViewScale(0.75)}`);
-        appendOutput(` - Page scale after setViewScale(1)         : ${await pageScaleAfterSettingViewScale(1)}`);
+        appendOutput(`Page scale after double tapping to zoom in again : ${await pageScaleAfterDoubleTappingOnSquare()}`);
+        appendOutput(` - Page scale after setViewScale(0.75)           : ${await pageScaleAfterSettingViewScale(0.75)}`);
+        appendOutput(` - Page scale after setViewScale(1.25)           : ${await pageScaleAfterSettingViewScale(1.25)}`);
+        appendOutput(` - Page scale after setViewScale(1)              : ${await pageScaleAfterSettingViewScale(1)}`);
         appendOutput("");
 
         testRunner.notifyDone();

Deleted: trunk/LayoutTests/platform/ipad/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt (242058 => 242059)


--- trunk/LayoutTests/platform/ipad/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt	2019-02-25 23:11:19 UTC (rev 242058)
+++ trunk/LayoutTests/platform/ipad/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt	2019-02-26 00:19:49 UTC (rev 242059)
@@ -1,16 +0,0 @@
-Initial page scale factor                   : 1.00
- - Page scale after setViewScale(1.25)      : 1.25
- - Page scale after setViewScale(0.75)      : 0.75
- - Page scale after setViewScale(1)         : 1.00
-
-Page scale after double tapping to zoom in  : 1.60
- - Page scale after setViewScale(1.25)      : 1.60
- - Page scale after setViewScale(0.75)      : 1.60
- - Page scale after setViewScale(1)         : 1.60
-
-Page scale after double tapping to zoom out : 1.00
- - Page scale after setViewScale(1.25)      : 1.25
- - Page scale after setViewScale(0.75)      : 1.25
- - Page scale after setViewScale(1)         : 1.25
-
-This test verifies that changing the view scale zooms the page to initial scale, but only if the page was already at initial scale. To manually test, (1) change the zoom scale without changing the page scale in any way, and check that the page zooms to initial scale; (2) now double tap on the box to zoom in, and check that changing zoom levels does not change the page scale; (3) finally, double tap on the box again to zoom back out to initial scale, and check that changing zoom levels automatically zooms the page to initial scale once again.

Modified: trunk/Source/WebKit/ChangeLog (242058 => 242059)


--- trunk/Source/WebKit/ChangeLog	2019-02-25 23:11:19 UTC (rev 242058)
+++ trunk/Source/WebKit/ChangeLog	2019-02-26 00:19:49 UTC (rev 242059)
@@ -1,3 +1,26 @@
+2019-02-25  Wenson Hsieh  <[email protected]>
+
+        [iOS] Adjust initial scale zooming heuristics when changing view scale
+        https://bugs.webkit.org/show_bug.cgi?id=194995
+
+        Reviewed by Tim Horton.
+
+        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):
+
 2019-02-25  John Wilander  <[email protected]>
 
         Introduce and adopt new class RegistrableDomain for eTLD+1

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (242058 => 242059)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-02-25 23:11:19 UTC (rev 242058)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-02-26 00:19:49 UTC (rev 242059)
@@ -2676,12 +2676,19 @@
 {
     LOG_WITH_STREAM(VisibleRects, stream << "WebPage " << m_pageID << " setViewportConfigurationViewLayoutSize " << size << " scaleFactor " << scaleFactor << " minimumEffectiveDeviceWidth " << minimumEffectiveDeviceWidth);
 
-    ZoomToInitialScale shouldZoomToInitialScale = ZoomToInitialScale::No;
-    if (m_viewportConfiguration.layoutSizeScaleFactor() != scaleFactor && areEssentiallyEqualAsFloat(m_viewportConfiguration.initialScale(), pageScaleFactor()))
-        shouldZoomToInitialScale = ZoomToInitialScale::Yes;
+    auto previousLayoutSizeScaleFactor = m_viewportConfiguration.layoutSizeScaleFactor();
+    if (!m_viewportConfiguration.setViewLayoutSize(size, scaleFactor, minimumEffectiveDeviceWidth))
+        return;
 
-    if (m_viewportConfiguration.setViewLayoutSize(size, scaleFactor, minimumEffectiveDeviceWidth))
-        viewportConfigurationChanged(shouldZoomToInitialScale);
+    auto zoomToInitialScale = ZoomToInitialScale::No;
+    auto newInitialScale = m_viewportConfiguration.initialScale();
+    auto currentPageScaleFactor = pageScaleFactor();
+    if (scaleFactor > previousLayoutSizeScaleFactor && newInitialScale > currentPageScaleFactor)
+        zoomToInitialScale = ZoomToInitialScale::Yes;
+    else if (scaleFactor < previousLayoutSizeScaleFactor && newInitialScale < currentPageScaleFactor)
+        zoomToInitialScale = ZoomToInitialScale::Yes;
+
+    viewportConfigurationChanged(zoomToInitialScale);
 }
 
 void WebPage::setMaximumUnobscuredSize(const FloatSize& maximumUnobscuredSize)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to