Title: [201294] trunk
Revision
201294
Author
[email protected]
Date
2016-05-23 13:44:06 -0700 (Mon, 23 May 2016)

Log Message

AX: iOS: when bringing focus to a text field we may zoom the page even if author wanted max scale = 1
https://bugs.webkit.org/show_bug.cgi?id=157771

Reviewed by Tim Horton.

Source/WebCore:

If the author requests scaling not to be enabled, we should not scale in when keyboard focus moves to a text field.
Scaling should only happen when the user performs a gesture to do so in this case.

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

* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::maximumScale):

Source/WebKit2:

* Shared/AssistedNodeInformation.cpp:
(WebKit::AssistedNodeInformation::encode):
(WebKit::AssistedNodeInformation::decode):
* Shared/AssistedNodeInformation.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _displayFormNodeInputView]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation):

Modified Paths

Added Paths

Diff

Added: trunk/LayoutTests/fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt (0 => 201294)


--- trunk/LayoutTests/fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt	2016-05-23 20:44:06 UTC (rev 201294)
@@ -0,0 +1,13 @@
+This test has to run in iOS WebKitTestRunner.
+
+
+This tests that even though force user scalable = true, we won't scale if a text field gets focus by default.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Maximum zoom scale was: 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html (0 => 201294)


--- trunk/LayoutTests/fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html	                        (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html	2016-05-23 20:44:06 UTC (rev 201294)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<meta name="viewport" content="width=device-width, maximum-scale=1">
+<script id="ui-script" type="text/plain">
+    (function() {
+       uiController.uiScriptComplete(uiController.zoomScale);
+    })();
+</script></head>
+
+<body _onload_="runTest();">
+<p id="result">This test has to run in iOS WebKitTestRunner.</p>
+
+<input type="text" id="textfield">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that even though force user scalable = true, we won't scale if a text field gets focus by default.");
+
+    window.internals.setViewportForceAlwaysUserScalable(true);
+    if (window.testRunner) {
+        window.jsTestIsAsync = true;
+    }
+
+    function runTest()
+    {
+        if (testRunner.runUIScript) {
+            var uiScript = document.getElementById('ui-script').text;
+            window.internals.setViewportForceAlwaysUserScalable(false);
+            document.getElementById("textfield").focus();
+            testRunner.runUIScript(document.getElementById('ui-script').text, function(result) {
+                debug("Maximum zoom scale was: " + result);
+                finishJSTest();
+            });
+        }
+    }
+</script>
+
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt (0 => 201294)


--- trunk/LayoutTests/fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt	2016-05-23 20:44:06 UTC (rev 201294)
@@ -0,0 +1,13 @@
+This test has to run in iOS WebKitTestRunner.
+
+
+This tests that when the author does not define a scale or width, that zooming in on focused nodes changes the scale.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Maximum zoom scale was: 0.33
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html (0 => 201294)


--- trunk/LayoutTests/fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html	                        (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html	2016-05-23 20:44:06 UTC (rev 201294)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<meta name="viewport">
+<script id="ui-script" type="text/plain">
+    (function() {
+       uiController.uiScriptComplete(uiController.zoomScale);
+    })();
+</script></head>
+
+<body _onload_="runTest();">
+<p id="result">This test has to run in iOS WebKitTestRunner.</p>
+
+<input type="text" id="textfield">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that when the author does not define a scale or width, that zooming in on focused nodes changes the scale.");
+
+    window.internals.setViewportForceAlwaysUserScalable(true);
+    if (window.testRunner) {
+        window.jsTestIsAsync = true;
+    }
+
+    function runTest()
+    {
+        if (testRunner.runUIScript) {
+            var uiScript = document.getElementById('ui-script').text;
+            window.internals.setViewportForceAlwaysUserScalable(false);
+            document.getElementById("textfield").focus();
+            testRunner.runUIScript(document.getElementById('ui-script').text, function(result) {
+                debug("Maximum zoom scale was: " + Number(result).toFixed(2));
+                finishJSTest();
+            });
+        }
+    }
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (201293 => 201294)


--- trunk/Source/WebCore/ChangeLog	2016-05-23 20:27:28 UTC (rev 201293)
+++ trunk/Source/WebCore/ChangeLog	2016-05-23 20:44:06 UTC (rev 201294)
@@ -1,3 +1,19 @@
+2016-05-23  Chris Fleizach  <[email protected]>
+
+        AX: iOS: when bringing focus to a text field we may zoom the page even if author wanted max scale = 1
+        https://bugs.webkit.org/show_bug.cgi?id=157771
+
+        Reviewed by Tim Horton.
+
+        If the author requests scaling not to be enabled, we should not scale in when keyboard focus moves to a text field.
+        Scaling should only happen when the user performs a gesture to do so in this case.
+
+        Tests: fast/viewport/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html
+               fast/viewport/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html
+
+        * page/ViewportConfiguration.h:
+        (WebCore::ViewportConfiguration::maximumScale):
+
 2016-05-23  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r200414.

Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (201293 => 201294)


--- trunk/Source/WebCore/page/ViewportConfiguration.cpp	2016-05-23 20:27:28 UTC (rev 201293)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp	2016-05-23 20:44:06 UTC (rev 201294)
@@ -209,8 +209,13 @@
 
 bool ViewportConfiguration::allowsUserScaling() const
 {
-    return m_forceAlwaysUserScalable || shouldIgnoreScalingConstraints() || m_configuration.allowsUserScaling;
+    return m_forceAlwaysUserScalable || allowsUserScalingIgnoringForceAlwaysScaling();
 }
+    
+bool ViewportConfiguration::allowsUserScalingIgnoringForceAlwaysScaling() const
+{
+    return shouldIgnoreScalingConstraints() || m_configuration.allowsUserScaling;
+}
 
 ViewportConfiguration::Parameters ViewportConfiguration::webpageParameters()
 {

Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (201293 => 201294)


--- trunk/Source/WebCore/page/ViewportConfiguration.h	2016-05-23 20:27:28 UTC (rev 201293)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h	2016-05-23 20:44:06 UTC (rev 201294)
@@ -93,6 +93,7 @@
     WEBCORE_EXPORT double minimumScale() const;
     double maximumScale() const { return m_forceAlwaysUserScalable ? forceAlwaysUserScalableMaximumScale : m_configuration.maximumScale; }
     WEBCORE_EXPORT bool allowsUserScaling() const;
+    WEBCORE_EXPORT bool allowsUserScalingIgnoringForceAlwaysScaling() const;
     bool allowsShrinkToFit() const;
 
     WEBCORE_EXPORT static Parameters webpageParameters();

Modified: trunk/Source/WebKit2/ChangeLog (201293 => 201294)


--- trunk/Source/WebKit2/ChangeLog	2016-05-23 20:27:28 UTC (rev 201293)
+++ trunk/Source/WebKit2/ChangeLog	2016-05-23 20:44:06 UTC (rev 201294)
@@ -1,3 +1,19 @@
+2016-05-23  Chris Fleizach  <[email protected]>
+
+        AX: iOS: when bringing focus to a text field we may zoom the page even if author wanted max scale = 1
+        https://bugs.webkit.org/show_bug.cgi?id=157771
+
+        Reviewed by Tim Horton.
+
+        * Shared/AssistedNodeInformation.cpp:
+        (WebKit::AssistedNodeInformation::encode):
+        (WebKit::AssistedNodeInformation::decode):
+        * Shared/AssistedNodeInformation.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _displayFormNodeInputView]):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getAssistedNodeInformation):
+
 2016-05-23  Miguel Gomez  <[email protected]>
 
         [ThreadedCompositor] Ensure that the BitmapTexture used by CoordinatedBackingStoreTile matches the opacity of the painted surface

Modified: trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp (201293 => 201294)


--- trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp	2016-05-23 20:27:28 UTC (rev 201293)
+++ trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp	2016-05-23 20:44:06 UTC (rev 201294)
@@ -80,6 +80,7 @@
     encoder << isMultiSelect;
     encoder << isReadOnly;
     encoder << allowsUserScaling;
+    encoder << allowsUserScalingIgnoringForceAlwaysScaling;
     encoder << insideFixedPosition;
     encoder << value;
     encoder << valueAsNumber;
@@ -139,6 +140,9 @@
 
     if (!decoder.decode(result.allowsUserScaling))
         return false;
+    
+    if (!decoder.decode(result.allowsUserScalingIgnoringForceAlwaysScaling))
+        return false;
 
     if (!decoder.decode(result.insideFixedPosition))
         return false;

Modified: trunk/Source/WebKit2/Shared/AssistedNodeInformation.h (201293 => 201294)


--- trunk/Source/WebKit2/Shared/AssistedNodeInformation.h	2016-05-23 20:27:28 UTC (rev 201293)
+++ trunk/Source/WebKit2/Shared/AssistedNodeInformation.h	2016-05-23 20:44:06 UTC (rev 201294)
@@ -99,6 +99,7 @@
     bool isMultiSelect { false };
     bool isReadOnly {false };
     bool allowsUserScaling { false };
+    bool allowsUserScalingIgnoringForceAlwaysScaling { false };
     bool insideFixedPosition { false };
     WebAutocapitalizeType autocapitalizeType { WebAutocapitalizeTypeDefault };
     InputType elementType { InputType::None };

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (201293 => 201294)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2016-05-23 20:27:28 UTC (rev 201293)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2016-05-23 20:44:06 UTC (rev 201294)
@@ -1045,12 +1045,14 @@
 
 - (void)_displayFormNodeInputView
 {
+    // In case user scaling is force enabled, do not use that scaling when zooming in with an input field.
+    // Zooming above the page's default scale factor should only happen when the user performs it.
     [self _zoomToFocusRect:_assistedNodeInformation.elementRect
              selectionRect: _didAccessoryTabInitiateFocus ? IntRect() : _assistedNodeInformation.selectionRect
                   fontSize:_assistedNodeInformation.nodeFontSize
               minimumScale:_assistedNodeInformation.minimumScaleFactor
               maximumScale:_assistedNodeInformation.maximumScaleFactor
-              allowScaling:(_assistedNodeInformation.allowsUserScaling && !UICurrentUserInterfaceIdiomIsPad())
+              allowScaling:(_assistedNodeInformation.allowsUserScalingIgnoringForceAlwaysScaling && !UICurrentUserInterfaceIdiomIsPad())
                forceScroll:[self requiresAccessoryView]];
     _didAccessoryTabInitiateFocus = NO;
     [self _ensureFormAccessoryView];

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (201293 => 201294)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-05-23 20:27:28 UTC (rev 201293)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-05-23 20:44:06 UTC (rev 201294)
@@ -2547,6 +2547,7 @@
     information.minimumScaleFactor = minimumPageScaleFactor();
     information.maximumScaleFactor = maximumPageScaleFactor();
     information.allowsUserScaling = m_viewportConfiguration.allowsUserScaling();
+    information.allowsUserScalingIgnoringForceAlwaysScaling = m_viewportConfiguration.allowsUserScalingIgnoringForceAlwaysScaling();
     information.hasNextNode = hasAssistableElement(m_assistedNode.get(), *m_page, true);
     information.hasPreviousNode = hasAssistableElement(m_assistedNode.get(), *m_page, false);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to