Title: [245690] branches/safari-608.1.24.20-branch
Revision
245690
Author
[email protected]
Date
2019-05-23 10:01:00 -0700 (Thu, 23 May 2019)

Log Message

Cherry-pick r245661. rdar://problem/50613388

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245661 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog (245689 => 245690)


--- branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog	2019-05-23 17:00:56 UTC (rev 245689)
+++ branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog	2019-05-23 17:01:00 UTC (rev 245690)
@@ -1,3 +1,45 @@
+2019-05-23  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r245661. rdar://problem/50613388
+
+    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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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  Kocsen Chung  <[email protected]>
 
         Cherry-pick r245220. rdar://problem/50686229

Added: branches/safari-608.1.24.20-branch/LayoutTests/fast/forms/ios/inputmode-removing-none-expected.txt (0 => 245690)


--- branches/safari-608.1.24.20-branch/LayoutTests/fast/forms/ios/inputmode-removing-none-expected.txt	                        (rev 0)
+++ branches/safari-608.1.24.20-branch/LayoutTests/fast/forms/ios/inputmode-removing-none-expected.txt	2019-05-23 17:01:00 UTC (rev 245690)
@@ -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: branches/safari-608.1.24.20-branch/LayoutTests/fast/forms/ios/inputmode-removing-none.html (0 => 245690)


--- branches/safari-608.1.24.20-branch/LayoutTests/fast/forms/ios/inputmode-removing-none.html	                        (rev 0)
+++ branches/safari-608.1.24.20-branch/LayoutTests/fast/forms/ios/inputmode-removing-none.html	2019-05-23 17:01:00 UTC (rev 245690)
@@ -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: branches/safari-608.1.24.20-branch/Source/WebKit/ChangeLog (245689 => 245690)


--- branches/safari-608.1.24.20-branch/Source/WebKit/ChangeLog	2019-05-23 17:00:56 UTC (rev 245689)
+++ branches/safari-608.1.24.20-branch/Source/WebKit/ChangeLog	2019-05-23 17:01:00 UTC (rev 245690)
@@ -1,3 +1,50 @@
+2019-05-23  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r245661. rdar://problem/50613388
+
+    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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-20  Kocsen Chung  <[email protected]>
 
         Cherry-pick r245520. rdar://problem/50552974

Modified: branches/safari-608.1.24.20-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (245689 => 245690)


--- branches/safari-608.1.24.20-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-05-23 17:00:56 UTC (rev 245689)
+++ branches/safari-608.1.24.20-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-05-23 17:01:00 UTC (rev 245690)
@@ -1634,6 +1634,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:
@@ -1664,8 +1669,8 @@
 
 - (BOOL)_requiresKeyboardWhenFirstResponder
 {
-    // FIXME: Only create keyboard if [self shouldShowAutomaticKeyboardUI] returns YES or
-    // on first hardware keydown in a non-editable element. See <https://bugs.webkit.org/show_bug.cgi?id=197746>.
+    // FIXME: We should add the logic to handle keyboard visibility during focus redirects.
+    return [self _shouldShowAutomaticKeyboardUIIgnoringInputMode]
 #if USE(UIKIT_KEYBOARD_ADDITIONS)
     if (GSEventIsHardwareKeyboardAttached())
         return YES;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to