Title: [245661] trunk
Revision
245661
Author
[email protected]
Date
2019-05-22 17:30:23 -0700 (Wed, 22 May 2019)

Log Message

REGRESSION(r245148): Removing inputmode="none" does not bring up software keyboard
https://bugs.webkit.org/show_bug.cgi?id=198141

Reviewed by Geoffrey Garen.

Source/WebKit:

r245148 changed _requiresKeyboardWhenFirstResponder to return NO when shouldShowAutomaticKeyboardUI
returns NO with regards to software keyboard. This introduced a regression that removing inputmode="none"
no longer brings up the software keyboard. Fixed the bug by making it return YES when inputmode="none"
is present on an editable element in shouldShowAutomaticKeyboardUI, partially restoring the old behavior.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView shouldShowAutomaticKeyboardUI]):
(-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
(-[WKContentView _requiresKeyboardWhenFirstResponder]):

LayoutTests:

Added a regression test.

* fast/forms/ios/inputmode-removing-none-expected.txt: Added.
* fast/forms/ios/inputmode-removing-none.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (245660 => 245661)


--- trunk/LayoutTests/ChangeLog	2019-05-23 00:07:22 UTC (rev 245660)
+++ trunk/LayoutTests/ChangeLog	2019-05-23 00:30:23 UTC (rev 245661)
@@ -1,3 +1,15 @@
+2019-05-22  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r245148): Removing inputmode="none" does not bring up software keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=198141
+
+        Reviewed by Geoffrey Garen.
+
+        Added a regression test.
+
+        * fast/forms/ios/inputmode-removing-none-expected.txt: Added.
+        * fast/forms/ios/inputmode-removing-none.html: Added.
+
 2019-05-22  Simon Fraser  <[email protected]>
 
         <rdar://problem/50058173> REGRESSION (r243347) Layout tests fast/events/touch/ios/drag-block-without-overflow-scroll-and-passive-observer-on* are failing

Added: trunk/LayoutTests/fast/forms/ios/inputmode-removing-none-expected.txt (0 => 245661)


--- trunk/LayoutTests/fast/forms/ios/inputmode-removing-none-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/inputmode-removing-none-expected.txt	2019-05-23 00:30:23 UTC (rev 245661)
@@ -0,0 +1,18 @@
+This tests removing inputmode="none" from an input element after the element was focused.
+To manually test, detach a hardware keyboard and tap on the text field below. The software keyboard should come up.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+ACTIVATE input with inputmode=none
+PASS systemKeyboardRect.height is 0
+PASS input.value is "hello,"
+
+Removing inputmode=none
+PASS systemKeyboardRect.height > 0 is true
+PASS input.value is "hello, world"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  

Added: trunk/LayoutTests/fast/forms/ios/inputmode-removing-none.html (0 => 245661)


--- trunk/LayoutTests/fast/forms/ios/inputmode-removing-none.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/inputmode-removing-none.html	2019-05-23 00:30:23 UTC (rev 245661)
@@ -0,0 +1,61 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+<script src=""
+<script src=""
+</head>
+<body>
+<input inputmode="none">
+<script>
+
+description(`This tests removing inputmode="none" from an input element after the element was focused.<br>
+To manually test, detach a hardware keyboard and tap on the text field below. The software keyboard should come up.`);
+
+jsTestIsAsync = true;
+
+const input = document.querySelector('input');
+if (window.testRunner)
+    window._onload_ = runTest;
+else
+    input.addEventListener('click', () => this.removeAttribute('inputmode'));
+
+let systemKeyboardRect;
+async function runTest() {
+    await UIHelper.setHardwareKeyboardAttached(false);
+
+    // We insert a dummy input element to detect when the keyboard hides for an input element with inputmode="none".
+    const dummyInput = document.createElement('input');
+    document.body.appendChild(dummyInput);
+    await UIHelper.activateElementAndWaitForInputSession(dummyInput);
+
+    debug("\nACTIVATE input with inputmode=none");
+    input.focus();
+    await UIHelper.activateElement(input);
+    await UIHelper.waitForKeyboardToHide();
+    systemKeyboardRect = await UIHelper.inputViewBounds();
+    shouldBe("systemKeyboardRect.height", "0");
+
+    await UIHelper.enterText("hello,");
+    shouldBeEqualToString("input.value", "hello,");
+
+    debug("\nRemoving inputmode=none");
+    input.removeAttribute('inputmode');
+
+    await new Promise((resolve) => {
+        window.visualViewport.addEventListener('resize', resolve);
+        setTimeout(resolve, 3000); // Failed.
+    });
+
+    systemKeyboardRect = await UIHelper.inputViewBounds();
+    shouldBeTrue("systemKeyboardRect.height > 0");
+
+    await UIHelper.enterText(" world");
+    shouldBeEqualToString("input.value", "hello, world");
+
+    finishJSTest();
+}
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebKit/ChangeLog (245660 => 245661)


--- trunk/Source/WebKit/ChangeLog	2019-05-23 00:07:22 UTC (rev 245660)
+++ trunk/Source/WebKit/ChangeLog	2019-05-23 00:30:23 UTC (rev 245661)
@@ -1,3 +1,20 @@
+2019-05-22  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r245148): Removing inputmode="none" does not bring up software keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=198141
+
+        Reviewed by Geoffrey Garen.
+
+        r245148 changed _requiresKeyboardWhenFirstResponder to return NO when shouldShowAutomaticKeyboardUI
+        returns NO with regards to software keyboard. This introduced a regression that removing inputmode="none"
+        no longer brings up the software keyboard. Fixed the bug by making it return YES when inputmode="none"
+        is present on an editable element in shouldShowAutomaticKeyboardUI, partially restoring the old behavior.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView shouldShowAutomaticKeyboardUI]):
+        (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
+        (-[WKContentView _requiresKeyboardWhenFirstResponder]):
+
 2019-05-22  Tim Horton  <[email protected]>
 
         REGRESSION (r240552): PDF contents are not exposed to Accessibility (VO, etc.)

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (245660 => 245661)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-05-23 00:07:22 UTC (rev 245660)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-05-23 00:30:23 UTC (rev 245661)
@@ -1640,6 +1640,11 @@
     if (_focusedElementInformation.inputMode == WebCore::InputMode::None && !GSEventIsHardwareKeyboardAttached())
         return NO;
 
+    return [self _shouldShowAutomaticKeyboardUIIgnoringInputMode];
+}
+
+- (BOOL)_shouldShowAutomaticKeyboardUIIgnoringInputMode
+{
     switch (_focusedElementInformation.elementType) {
     case WebKit::InputType::None:
     case WebKit::InputType::Drawing:
@@ -1671,7 +1676,7 @@
 - (BOOL)_requiresKeyboardWhenFirstResponder
 {
     // FIXME: We should add the logic to handle keyboard visibility during focus redirects.
-    return [self shouldShowAutomaticKeyboardUI]
+    return [self _shouldShowAutomaticKeyboardUIIgnoringInputMode]
 #if USE(UIKIT_KEYBOARD_ADDITIONS)
         || _seenHardwareKeyDownInNonEditableElement
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to