Changeset 242059 in webkit


Ignore:
Timestamp:
Feb 25, 2019 4:19:49 PM (5 years ago)
Author:
Wenson Hsieh
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.

Location:
trunk
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242052 r242059  
     12019-02-25  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] Adjust initial scale zooming heuristics when changing view scale
     4        https://bugs.webkit.org/show_bug.cgi?id=194995
     5
     6        Reviewed by Tim Horton.
     7
     8        Rebaseline and adjust an existing layout test.
     9
     10        * fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt:
     11        * fast/viewport/ios/initial-scale-after-changing-view-scale.html:
     12        * platform/ipad/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt: Removed.
     13
     14        Removed an iPad-specific test expectation, since initial scale zooming behavior should be the same now at both
     15        device dimensions.
     16
    1172019-02-25  Frederic Wang  <fwang@igalia.com>
    218
  • trunk/LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt

    r237127 r242059  
    66Page scale after double tapping to zoom in  : 1.60
    77 - Page scale after setViewScale(1.25)      : 1.60
    8  - Page scale after setViewScale(0.75)      : 1.60
    9  - Page scale after setViewScale(1)         : 1.60
    10 
    11 Page scale after double tapping to zoom out : 1.00
    12  - Page scale after setViewScale(1.25)      : 1.25
    138 - Page scale after setViewScale(0.75)      : 0.75
    149 - Page scale after setViewScale(1)         : 1.00
    1510
     11Page scale after double tapping to zoom in again : 1.60
     12 - Page scale after setViewScale(0.75)           : 0.75
     13 - Page scale after setViewScale(1.25)           : 1.25
     14 - Page scale after setViewScale(1)              : 1.00
     15
    1616This 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.
  • trunk/LayoutTests/fast/viewport/ios/initial-scale-after-changing-view-scale.html

    r237127 r242059  
    7171        appendOutput(` - Page scale after setViewScale(1)         : ${await pageScaleAfterSettingViewScale(1)}`);
    7272        appendOutput("");
    73         appendOutput(`Page scale after double tapping to zoom out : ${await pageScaleAfterDoubleTappingOnSquare()}`);
    74         appendOutput(` - Page scale after setViewScale(1.25)      : ${await pageScaleAfterSettingViewScale(1.25)}`);
    75         appendOutput(` - Page scale after setViewScale(0.75)      : ${await pageScaleAfterSettingViewScale(0.75)}`);
    76         appendOutput(` - Page scale after setViewScale(1)         : ${await pageScaleAfterSettingViewScale(1)}`);
     73        appendOutput(`Page scale after double tapping to zoom in again : ${await pageScaleAfterDoubleTappingOnSquare()}`);
     74        appendOutput(` - Page scale after setViewScale(0.75)           : ${await pageScaleAfterSettingViewScale(0.75)}`);
     75        appendOutput(` - Page scale after setViewScale(1.25)           : ${await pageScaleAfterSettingViewScale(1.25)}`);
     76        appendOutput(` - Page scale after setViewScale(1)              : ${await pageScaleAfterSettingViewScale(1)}`);
    7777        appendOutput("");
    7878
  • trunk/Source/WebKit/ChangeLog

    r242056 r242059  
     12019-02-25  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] Adjust initial scale zooming heuristics when changing view scale
     4        https://bugs.webkit.org/show_bug.cgi?id=194995
     5
     6        Reviewed by Tim Horton.
     7
     8        Currently, we only zoom to the new initial scale iff we're exactly at initial scale before changing the view
     9        scale. This was done so that if a user zoomed in really far and then increased the view scale, we wouldn't end
     10        up zooming out as a result. However, this leads to confusing behavior in the case where the user has manually
     11        changed the zoom scale to something close to (but not exactly) initial scale, and then attempts to zoom in
     12        further using view scale. In this case, we'll end up keeping page scale the same, so it looks like nothing is
     13        happening.
     14
     15        To fix this, we tweak our heuristics for determining whether to jump to initial scale; if the view scale is
     16        increasing and the new initial scale is greater than the current scale, zoom to initial scale. Likewise, if the
     17        view scale is decreasing and the new initial scale is less than the current scale, zoom to initial scale.
     18
     19        Test: fast/viewport/ios/initial-scale-after-changing-view-scale.html
     20
     21        * WebProcess/WebPage/ios/WebPageIOS.mm:
     22        (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
     23
    1242019-02-25  John Wilander  <wilander@apple.com>
    225
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r242032 r242059  
    26772677    LOG_WITH_STREAM(VisibleRects, stream << "WebPage " << m_pageID << " setViewportConfigurationViewLayoutSize " << size << " scaleFactor " << scaleFactor << " minimumEffectiveDeviceWidth " << minimumEffectiveDeviceWidth);
    26782678
    2679     ZoomToInitialScale shouldZoomToInitialScale = ZoomToInitialScale::No;
    2680     if (m_viewportConfiguration.layoutSizeScaleFactor() != scaleFactor && areEssentiallyEqualAsFloat(m_viewportConfiguration.initialScale(), pageScaleFactor()))
    2681         shouldZoomToInitialScale = ZoomToInitialScale::Yes;
    2682 
    2683     if (m_viewportConfiguration.setViewLayoutSize(size, scaleFactor, minimumEffectiveDeviceWidth))
    2684         viewportConfigurationChanged(shouldZoomToInitialScale);
     2679    auto previousLayoutSizeScaleFactor = m_viewportConfiguration.layoutSizeScaleFactor();
     2680    if (!m_viewportConfiguration.setViewLayoutSize(size, scaleFactor, minimumEffectiveDeviceWidth))
     2681        return;
     2682
     2683    auto zoomToInitialScale = ZoomToInitialScale::No;
     2684    auto newInitialScale = m_viewportConfiguration.initialScale();
     2685    auto currentPageScaleFactor = pageScaleFactor();
     2686    if (scaleFactor > previousLayoutSizeScaleFactor && newInitialScale > currentPageScaleFactor)
     2687        zoomToInitialScale = ZoomToInitialScale::Yes;
     2688    else if (scaleFactor < previousLayoutSizeScaleFactor && newInitialScale < currentPageScaleFactor)
     2689        zoomToInitialScale = ZoomToInitialScale::Yes;
     2690
     2691    viewportConfigurationChanged(zoomToInitialScale);
    26852692}
    26862693
Note: See TracChangeset for help on using the changeset viewer.