Changeset 206626 in webkit


Ignore:
Timestamp:
Sep 29, 2016 5:38:18 PM (8 years ago)
Author:
n_wang@apple.com
Message:

AX: iOS: Tapping <input> in Safari zooms in a bit when page has max scale = 1
https://bugs.webkit.org/show_bug.cgi?id=162471

Reviewed by Simon Fraser.

Source/WebCore:

If the author has defined a maximum scale, we should honor that when keyboard focus moves
to a text field, instead of using the forceAlwaysUserScalableMaximumScale.

Tests: fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html

fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html
fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html

  • page/ViewportConfiguration.cpp:

(WebCore::ViewportConfiguration::allowsUserScaling):
(WebCore::ViewportConfiguration::allowsUserScalingIgnoringAlwaysScalable):
(WebCore::ViewportConfiguration::allowsUserScalingIgnoringForceAlwaysScaling): Deleted.

  • page/ViewportConfiguration.h:

(WebCore::ViewportConfiguration::maximumScaleIgnoringAlwaysScalable):
(WebCore::ViewportConfiguration::maximumScale): Deleted.

Source/WebKit2:

  • Shared/AssistedNodeInformation.cpp:

(WebKit::AssistedNodeInformation::encode):
(WebKit::AssistedNodeInformation::decode):

  • Shared/AssistedNodeInformation.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _displayFormNodeInputView]):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::maximumPageScaleFactorIgnoringAlwaysScalable):
(WebKit::WebPage::getAssistedNodeInformation):

LayoutTests:

Moved focus input related tests to the right place.

  • fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt: Added.
  • fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html: Added.
  • fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no-expected.txt: Added.
  • fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html: Added.
  • fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt: Added.
  • fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html: Added.
  • fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt: Removed.
  • fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html: Removed.
  • fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt: Removed.
  • fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html: Removed.
Location:
trunk
Files:
10 edited
2 copied
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206619 r206626  
     12016-09-29  Nan Wang  <n_wang@apple.com>
     2
     3        AX: iOS: Tapping <input> in Safari zooms in a bit when page has max scale = 1
     4        https://bugs.webkit.org/show_bug.cgi?id=162471
     5
     6        Reviewed by Simon Fraser.
     7
     8        Moved focus input related tests to the right place.
     9
     10        * fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt: Added.
     11        * fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html: Added.
     12        * fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no-expected.txt: Added.
     13        * fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html: Added.
     14        * fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt: Added.
     15        * fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html: Added.
     16        * fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt: Removed.
     17        * fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html: Removed.
     18        * fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt: Removed.
     19        * fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html: Removed.
     20
    1212016-09-29  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/LayoutTests/fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt

    r206621 r206626  
     1
    12This test has to run in iOS WebKitTestRunner.
    23
    3 
    4 This tests that even though force user scalable = true, we won't scale if a text field gets focus by default.
     4This tests that even though force user scalable = true, we won't scale if a text field gets focus and the page has maximum-scale=1
    55
    66On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    77
    88
    9 Maximum zoom scale was: 1
     9Zoom scale is: 1
    1010PASS successfullyParsed is true
    1111
  • trunk/LayoutTests/fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html

    r206621 r206626  
    1 <!DOCTYPE html>
     1<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
    22<html>
    33<head>
     
    66<script id="ui-script" type="text/plain">
    77    (function() {
    8        uiController.uiScriptComplete(uiController.zoomScale);
     8        uiController.didEndZoomingCallback = function() {
     9            uiController.uiScriptComplete(uiController.zoomScale);
     10        };
     11       
     12        uiController.singleTapAtPoint(10, 10, function() {});
    913    })();
    1014</script></head>
    1115
    1216<body onload="runTest();">
     17<input type="text" id="textfield">
    1318<p id="result">This test has to run in iOS WebKitTestRunner.</p>
    14 
    15 <input type="text" id="textfield">
    1619
    1720<p id="description"></p>
     
    1922
    2023<script>
    21     description("This tests that even though force user scalable = true, we won't scale if a text field gets focus by default.");
     24    description("This tests that even though force user scalable = true, we won't scale if a text field gets focus and the page has maximum-scale=1");
    2225
    2326    if (window.testRunner) {
     
    3033        if (testRunner.runUIScript) {
    3134            var uiScript = document.getElementById('ui-script').text;
    32             testRunner.setIgnoresViewportScaleLimits(false);
    33             document.getElementById("textfield").focus();
    3435            testRunner.runUIScript(document.getElementById('ui-script').text, function(result) {
    35                 debug("Maximum zoom scale was: " + result);
     36                debug("Zoom scale is: " + result);
    3637                finishJSTest();
    3738            });
  • trunk/LayoutTests/fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no-expected.txt

    r206621 r206626  
     1
    12This test has to run in iOS WebKitTestRunner.
    23
    3 
    4 This tests that when the author does not define a scale or width, that zooming in on focused nodes changes the scale.
     4This tests that even though force user scalable = true, we won't scale if a text field gets focus and the page has user-scalable=no
    55
    66On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    77
    88
    9 Maximum zoom scale was: 0.33
     9Zoom scale is: 1
    1010PASS successfullyParsed is true
    1111
  • trunk/LayoutTests/fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html

    r206621 r206626  
    1 <!DOCTYPE html>
     1<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
    22<html>
    33<head>
    44<script src="../../../resources/js-test-pre.js"></script>
    5 <meta name="viewport" content="width=device-width, maximum-scale=1">
     5<meta name="viewport" content="width=device-width, user-scalable=no">
    66<script id="ui-script" type="text/plain">
    77    (function() {
    8        uiController.uiScriptComplete(uiController.zoomScale);
     8        uiController.didEndZoomingCallback = function() {
     9            uiController.uiScriptComplete(uiController.zoomScale);
     10        };
     11       
     12        uiController.singleTapAtPoint(10, 10, function() {});
    913    })();
    1014</script></head>
    1115
    1216<body onload="runTest();">
     17<input type="text" id="textfield">
    1318<p id="result">This test has to run in iOS WebKitTestRunner.</p>
    14 
    15 <input type="text" id="textfield">
    1619
    1720<p id="description"></p>
     
    1922
    2023<script>
    21     description("This tests that even though force user scalable = true, we won't scale if a text field gets focus by default.");
     24    description("This tests that even though force user scalable = true, we won't scale if a text field gets focus and the page has user-scalable=no");
    2225
    2326    if (window.testRunner) {
     
    3033        if (testRunner.runUIScript) {
    3134            var uiScript = document.getElementById('ui-script').text;
    32             testRunner.setIgnoresViewportScaleLimits(false);
    33             document.getElementById("textfield").focus();
    3435            testRunner.runUIScript(document.getElementById('ui-script').text, function(result) {
    35                 debug("Maximum zoom scale was: " + result);
     36                debug("Zoom scale is: " + result);
    3637                finishJSTest();
    3738            });
  • trunk/LayoutTests/fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt

    r206621 r206626  
     1
    12This test has to run in iOS WebKitTestRunner.
    23
    3 
    4 This tests that when the author does not define a scale or width, that zooming in on focused nodes changes the scale.
     4This tests that when the author does not define a scale or set user-scalable=no, that zooming in on focused nodes changes the scale.
    55
    66On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    77
    88
    9 Maximum zoom scale was: 0.33
     9Zoom scale is: 1.45
    1010PASS successfullyParsed is true
    1111
  • trunk/LayoutTests/fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html

    r206621 r206626  
    1 <!DOCTYPE html>
     1<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
    22<html>
    33<head>
     
    66<script id="ui-script" type="text/plain">
    77    (function() {
    8        uiController.uiScriptComplete(uiController.zoomScale);
     8        uiController.didEndZoomingCallback = function() {
     9            uiController.uiScriptComplete(uiController.zoomScale);
     10        };
     11       
     12        uiController.singleTapAtPoint(10, 10, function() {});
    913    })();
    1014</script></head>
    1115
    1216<body onload="runTest();">
     17<input type="text" id="textfield">
    1318<p id="result">This test has to run in iOS WebKitTestRunner.</p>
    1419
    15 <input type="text" id="textfield">
    1620
    1721<p id="description"></p>
     
    1923
    2024<script>
    21     description("This tests that when the author does not define a scale or width, that zooming in on focused nodes changes the scale.");
     25    description("This tests that when the author does not define a scale or set user-scalable=no, that zooming in on focused nodes changes the scale.");
    2226
    2327    if (window.testRunner) {
     
    2933    {
    3034        if (testRunner.runUIScript) {
    31             var uiScript = document.getElementById('ui-script').text;
    32             testRunner.setIgnoresViewportScaleLimits(false);
     35            var uiScript = document.getElementById('ui-script').text;;
    3336            document.getElementById("textfield").focus();
    3437            testRunner.runUIScript(document.getElementById('ui-script').text, function(result) {
    35                 debug("Maximum zoom scale was: " + Number(result).toFixed(2));
     38                debug("Zoom scale is: " + Number(result).toFixed(2));
    3639                finishJSTest();
    3740            });
  • trunk/Source/WebCore/ChangeLog

    r206617 r206626  
     12016-09-29  Nan Wang  <n_wang@apple.com>
     2
     3        AX: iOS: Tapping <input> in Safari zooms in a bit when page has max scale = 1
     4        https://bugs.webkit.org/show_bug.cgi?id=162471
     5
     6        Reviewed by Simon Fraser.
     7
     8        If the author has defined a maximum scale, we should honor that when keyboard focus moves
     9        to a text field, instead of using the forceAlwaysUserScalableMaximumScale.
     10
     11        Tests: fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html
     12               fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html
     13               fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html
     14
     15        * page/ViewportConfiguration.cpp:
     16        (WebCore::ViewportConfiguration::allowsUserScaling):
     17        (WebCore::ViewportConfiguration::allowsUserScalingIgnoringAlwaysScalable):
     18        (WebCore::ViewportConfiguration::allowsUserScalingIgnoringForceAlwaysScaling): Deleted.
     19        * page/ViewportConfiguration.h:
     20        (WebCore::ViewportConfiguration::maximumScaleIgnoringAlwaysScalable):
     21        (WebCore::ViewportConfiguration::maximumScale): Deleted.
     22
    1232016-09-29  Alex Christensen  <achristensen@webkit.org>
    224
  • trunk/Source/WebCore/page/ViewportConfiguration.cpp

    r201294 r206626  
    210210bool ViewportConfiguration::allowsUserScaling() const
    211211{
    212     return m_forceAlwaysUserScalable || allowsUserScalingIgnoringForceAlwaysScaling();
     212    return m_forceAlwaysUserScalable || allowsUserScalingIgnoringAlwaysScalable();
    213213}
    214214   
    215 bool ViewportConfiguration::allowsUserScalingIgnoringForceAlwaysScaling() const
     215bool ViewportConfiguration::allowsUserScalingIgnoringAlwaysScalable() const
    216216{
    217217    return shouldIgnoreScalingConstraints() || m_configuration.allowsUserScaling;
  • trunk/Source/WebCore/page/ViewportConfiguration.h

    r201294 r206626  
    9393    WEBCORE_EXPORT double minimumScale() const;
    9494    double maximumScale() const { return m_forceAlwaysUserScalable ? forceAlwaysUserScalableMaximumScale : m_configuration.maximumScale; }
     95    double maximumScaleIgnoringAlwaysScalable() const { return m_configuration.maximumScale; }
    9596    WEBCORE_EXPORT bool allowsUserScaling() const;
    96     WEBCORE_EXPORT bool allowsUserScalingIgnoringForceAlwaysScaling() const;
     97    WEBCORE_EXPORT bool allowsUserScalingIgnoringAlwaysScalable() const;
    9798    bool allowsShrinkToFit() const;
    9899
  • trunk/Source/WebKit2/ChangeLog

    r206621 r206626  
     12016-09-29  Nan Wang  <n_wang@apple.com>
     2
     3        AX: iOS: Tapping <input> in Safari zooms in a bit when page has max scale = 1
     4        https://bugs.webkit.org/show_bug.cgi?id=162471
     5
     6        Reviewed by Simon Fraser.
     7
     8        * Shared/AssistedNodeInformation.cpp:
     9        (WebKit::AssistedNodeInformation::encode):
     10        (WebKit::AssistedNodeInformation::decode):
     11        * Shared/AssistedNodeInformation.h:
     12        * UIProcess/ios/WKContentViewInteraction.mm:
     13        (-[WKContentView _displayFormNodeInputView]):
     14        * WebProcess/WebPage/WebPage.h:
     15        * WebProcess/WebPage/ios/WebPageIOS.mm:
     16        (WebKit::WebPage::maximumPageScaleFactorIgnoringAlwaysScalable):
     17        (WebKit::WebPage::getAssistedNodeInformation):
     18
    1192016-09-29  Daniel Bates  <dabates@apple.com>
    220
  • trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp

    r204743 r206626  
    6767    encoder << minimumScaleFactor;
    6868    encoder << maximumScaleFactor;
     69    encoder << maximumScaleFactorIgnoringAlwaysScalable;
    6970    encoder << nodeFontSize;
    7071    encoder << hasNextNode;
     
    8081    encoder << isReadOnly;
    8182    encoder << allowsUserScaling;
    82     encoder << allowsUserScalingIgnoringForceAlwaysScaling;
     83    encoder << allowsUserScalingIgnoringAlwaysScalable;
    8384    encoder << insideFixedPosition;
    8485    encoder << value;
     
    100101
    101102    if (!decoder.decode(result.maximumScaleFactor))
     103        return false;
     104   
     105    if (!decoder.decode(result.maximumScaleFactorIgnoringAlwaysScalable))
    102106        return false;
    103107
     
    141145        return false;
    142146   
    143     if (!decoder.decode(result.allowsUserScalingIgnoringForceAlwaysScaling))
     147    if (!decoder.decode(result.allowsUserScalingIgnoringAlwaysScalable))
    144148        return false;
    145149
  • trunk/Source/WebKit2/Shared/AssistedNodeInformation.h

    r204668 r206626  
    9292    double minimumScaleFactor { -INFINITY };
    9393    double maximumScaleFactor { INFINITY };
     94    double maximumScaleFactorIgnoringAlwaysScalable { INFINITY };
    9495    double nodeFontSize { 0 };
    9596    bool hasNextNode { false };
     
    100101    bool isReadOnly {false };
    101102    bool allowsUserScaling { false };
    102     bool allowsUserScalingIgnoringForceAlwaysScaling { false };
     103    bool allowsUserScalingIgnoringAlwaysScalable { false };
    103104    bool insideFixedPosition { false };
    104105    WebAutocapitalizeType autocapitalizeType { WebAutocapitalizeTypeDefault };
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r206449 r206626  
    11031103                  fontSize:_assistedNodeInformation.nodeFontSize
    11041104              minimumScale:_assistedNodeInformation.minimumScaleFactor
    1105               maximumScale:_assistedNodeInformation.maximumScaleFactor
    1106               allowScaling:(_assistedNodeInformation.allowsUserScalingIgnoringForceAlwaysScaling && !UICurrentUserInterfaceIdiomIsPad())
     1105              maximumScale:_assistedNodeInformation.maximumScaleFactorIgnoringAlwaysScalable
     1106              allowScaling:(_assistedNodeInformation.allowsUserScalingIgnoringAlwaysScalable && !UICurrentUserInterfaceIdiomIsPad())
    11071107               forceScroll:[self requiresAccessoryView]];
    11081108
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r206527 r206626  
    519519    double minimumPageScaleFactor() const;
    520520    double maximumPageScaleFactor() const;
     521    double maximumPageScaleFactorIgnoringAlwaysScalable() const;
    521522    bool allowsUserScaling() const;
    522523    bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r205915 r206626  
    328328}
    329329
     330double WebPage::maximumPageScaleFactorIgnoringAlwaysScalable() const
     331{
     332    if (!m_viewportConfiguration.allowsUserScalingIgnoringAlwaysScalable())
     333        return m_page->pageScaleFactor();
     334    return m_viewportConfiguration.maximumScaleIgnoringAlwaysScalable();
     335}
     336
    330337bool WebPage::allowsUserScaling() const
    331338{
     
    25442551    information.minimumScaleFactor = minimumPageScaleFactor();
    25452552    information.maximumScaleFactor = maximumPageScaleFactor();
     2553    information.maximumScaleFactorIgnoringAlwaysScalable = maximumPageScaleFactorIgnoringAlwaysScalable();
    25462554    information.allowsUserScaling = m_viewportConfiguration.allowsUserScaling();
    2547     information.allowsUserScalingIgnoringForceAlwaysScaling = m_viewportConfiguration.allowsUserScalingIgnoringForceAlwaysScaling();
     2555    information.allowsUserScalingIgnoringAlwaysScalable = m_viewportConfiguration.allowsUserScalingIgnoringAlwaysScalable();
    25482556    information.hasNextNode = hasAssistableElement(m_assistedNode.get(), *m_page, true);
    25492557    information.hasPreviousNode = hasAssistableElement(m_assistedNode.get(), *m_page, false);
Note: See TracChangeset for help on using the changeset viewer.