iOS: inputmode="none" disables hardware keyboard's globe key
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 20:45:04 +0000 (20:45 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 20:45:04 +0000 (20:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193811
<rdar://problem/47406553>

Reviewed by Wenson Hsieh.

Source/WebKit:

Removed the support for inputmode="none" for now since we need a new SPI from UIKit
to properly implement this feature some time in the future.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _zoomToRevealFocusedElement]):
(-[WKContentView inputView]):
(-[WKContentView requiresAccessoryView]):
(-[WKContentView textInputTraits]):

LayoutTests:

Updated and renamed the test expecting the keyboard to update upon inputmode content attribute changed
to use inputmode="decimal" instead of inputmode="none", and updated another test to expect inputmode="none"
has no effect instead of hiding the keyboard.

* fast/forms/ios/inputmode-change-update-keyboard-expected.txt: Renamed from inputmode-none-removed-expected.txt.
* fast/forms/ios/inputmode-change-update-keyboard.html: Renamed from inputmode-none-removed.html.
* fast/forms/ios/inputmode-none-expected.txt:
* fast/forms/ios/inputmode-none.html:

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/inputmode-change-update-keyboard-expected.txt [moved from LayoutTests/fast/forms/ios/inputmode-none-removed-expected.txt with 70% similarity]
LayoutTests/fast/forms/ios/inputmode-change-update-keyboard.html [moved from LayoutTests/fast/forms/ios/inputmode-none-removed.html with 72% similarity]
LayoutTests/fast/forms/ios/inputmode-none-expected.txt
LayoutTests/fast/forms/ios/inputmode-none.html
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

index 2e7fdd5..d3f3445 100644 (file)
@@ -1,3 +1,20 @@
+2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
+
+        iOS: inputmode="none" disables hardware keyboard's globe key
+        https://bugs.webkit.org/show_bug.cgi?id=193811
+        <rdar://problem/47406553>
+
+        Reviewed by Wenson Hsieh.
+
+        Updated and renamed the test expecting the keyboard to update upon inputmode content attribute changed
+        to use inputmode="decimal" instead of inputmode="none", and updated another test to expect inputmode="none"
+        has no effect instead of hiding the keyboard.
+
+        * fast/forms/ios/inputmode-change-update-keyboard-expected.txt: Renamed from inputmode-none-removed-expected.txt.
+        * fast/forms/ios/inputmode-change-update-keyboard.html: Renamed from inputmode-none-removed.html.
+        * fast/forms/ios/inputmode-none-expected.txt:
+        * fast/forms/ios/inputmode-none.html:
+
 2019-01-25  Jonathan Bedard  <jbedard@apple.com>
 
         webkitpy: Implement device type specific expected results (Gardening)
@@ -4,11 +4,11 @@ To manually test, focus the input element below. The software keyboard should sh
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-Element has inputmode=none
-PASS keyboardRect.height is 0
+inputmode="text"
+PASS textHeight = keyboardRect.height; keyboardRect.height > 0 is true
 
-inputmode has been removed
-PASS keyboardRect.height > 0 is true
+inputmode="number"
+PASS keyboardRect.height is not textHeight
 PASS successfullyParsed is true
 
 TEST COMPLETE
@@ -6,7 +6,7 @@
 <script src="../../../resources/ui-helper.js"></script>
 </head>
 <body>
-<input inputmode="none">
+<input inputmode="text">
 <div id="countdown"></div>
 <script>
 jsTestIsAsync = true;
@@ -22,7 +22,7 @@ if (!window.testRunner) {
             document.getElementById('countdown').textContent = countdown ? countdown : '';
             if (!countdown) {
                 clearInterval(id);
-                input.removeAttribute('inputmode');
+                input.setAttribute('inputmode', 'decimal');
             }
             countdown--;
         }, 1000);
@@ -30,7 +30,7 @@ if (!window.testRunner) {
 }
 
 async function runTest() {
-    debug('Element has inputmode=none');
+    debug('inputmode="text"');
 
     let didResize = () => { };
     window.visualViewport.addEventListener('resize', () => didResize());
@@ -38,25 +38,25 @@ async function runTest() {
     if (window.testRunner) {
         await UIHelper.activateFormControl(input);
         window.keyboardRect = await UIHelper.inputViewBounds();
-        shouldBe('keyboardRect.height', '0');
+        shouldBeTrue('textHeight = keyboardRect.height; keyboardRect.height > 0');
     } else {
         await new Promise((resolve) => { didResize = resolve; });
-        shouldBeTrue('document.documentElement.clientHeight - visualViewport.height < 100');
+        shouldBeTrue('textHeight = document.documentElement.clientHeight - visualViewport.height; document.documentElement.clientHeight - visualViewport.height < 100');
     }
 
     if (window.testRunner)
-        input.removeAttribute('inputmode');
+        input.setAttribute('inputmode', 'decimal');
 
     await new Promise((resolve) => { didResize = resolve; });
 
     debug('');
-    debug('inputmode has been removed');
+    debug('inputmode="number"');
 
     if (window.testRunner) {
         window.keyboardRect = await UIHelper.inputViewBounds();
-        shouldBeTrue('keyboardRect.height > 0');
+        shouldNotBe('keyboardRect.height', 'textHeight');
     } else
-        shouldBeTrue('document.documentElement.clientHeight - visualViewport.height > 300');
+        shouldNotBe('document.documentElement.clientHeight - visualViewport.height', 'textHeight');
 
     finishJSTest();
 }
index 646bf6b..b1c4c83 100644 (file)
@@ -5,11 +5,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 ACTIVATE input with inputmode=text
-PASS systemKeyboardRect.height > 0 is true
+PASS textKeyboardHeight = systemKeyboardRect.height; systemKeyboardRect.height > 0 is true
 PASS inputWithSystemKeyboard.value is "Text"
 
 ACTIVATE input with inputmode=none
-PASS systemKeyboardRect.height === 0 is true
+PASS systemKeyboardRect.height is textKeyboardHeight
 
 TEST enter text in input with inputmode=none
 PASS inputWithoutSystemKeyboard.value is "None"
index f788565..f2f6a35 100644 (file)
@@ -20,14 +20,14 @@ async function runTest() {
     debug('\nACTIVATE input with inputmode=text');
     await UIHelper.activateFormControl(inputWithSystemKeyboard);
     systemKeyboardRect = await UIHelper.inputViewBounds();
-    shouldBe('systemKeyboardRect.height > 0', 'true');
+    shouldBe('textKeyboardHeight = systemKeyboardRect.height; systemKeyboardRect.height > 0', 'true');
     await UIHelper.enterText("Text");
     shouldBe('inputWithSystemKeyboard.value', '"Text"');
 
     debug('\nACTIVATE input with inputmode=none');
     await UIHelper.activateFormControl(inputWithoutSystemKeyboard);
     systemKeyboardRect = await UIHelper.inputViewBounds();
-    shouldBe('systemKeyboardRect.height === 0', 'true');
+    shouldBe('systemKeyboardRect.height', 'textKeyboardHeight');
 
     debug('\nTEST enter text in input with inputmode=none');
     await UIHelper.enterText("None");
index e30fd16..63a18c6 100644 (file)
@@ -1,3 +1,20 @@
+2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
+
+        iOS: inputmode="none" disables hardware keyboard's globe key
+        https://bugs.webkit.org/show_bug.cgi?id=193811
+        <rdar://problem/47406553>
+
+        Reviewed by Wenson Hsieh.
+
+        Removed the support for inputmode="none" for now since we need a new SPI from UIKit
+        to properly implement this feature some time in the future.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _zoomToRevealFocusedElement]):
+        (-[WKContentView inputView]):
+        (-[WKContentView requiresAccessoryView]):
+        (-[WKContentView textInputTraits]):
+
 2019-01-25  David Kilzer  <ddkilzer@apple.com>
 
         Move soft-linking of Lookup.framework out of LookupSPI.h
index 541a6c3..22de419 100644 (file)
@@ -1420,7 +1420,7 @@ static NSValue *nsSizeForTapHighlightBorderRadius(WebCore::IntSize borderRadius,
         minimumScale:_focusedElementInformation.minimumScaleFactor
         maximumScale:_focusedElementInformation.maximumScaleFactorIgnoringAlwaysScalable
         allowScaling:_focusedElementInformation.allowsUserScalingIgnoringAlwaysScalable && !currentUserInterfaceIdiomIsPad()
-        forceScroll:(_focusedElementInformation.inputMode == WebCore::InputMode::None) ? !currentUserInterfaceIdiomIsPad() : [self requiresAccessoryView]];
+        forceScroll:[self requiresAccessoryView]];
 }
 
 - (UIView *)inputView
@@ -1428,9 +1428,6 @@ static NSValue *nsSizeForTapHighlightBorderRadius(WebCore::IntSize borderRadius,
     if (!hasFocusedElement(_focusedElementInformation))
         return nil;
 
-    if (_focusedElementInformation.inputMode == WebCore::InputMode::None)
-        return [[UIView new] autorelease];
-
     if (!_inputPeripheral) {
         switch (_focusedElementInformation.elementType) {
         case WebKit::InputType::Select:
@@ -2208,9 +2205,6 @@ static void cancelPotentialTapIfNecessary(WKContentView* contentView)
     if ([_formInputSession customInputAccessoryView])
         return YES;
 
-    if (_focusedElementInformation.inputMode == WebCore::InputMode::None)
-        return NO;
-
     switch (_focusedElementInformation.elementType) {
     case WebKit::InputType::None:
     case WebKit::InputType::Drawing:
@@ -3812,6 +3806,7 @@ static NSString *contentTypeFromFieldName(WebCore::AutofillFieldName fieldName)
     }
 
     switch (_focusedElementInformation.inputMode) {
+    case WebCore::InputMode::None:
     case WebCore::InputMode::Unspecified:
         switch (_focusedElementInformation.elementType) {
         case WebKit::InputType::Phone:
@@ -3849,8 +3844,6 @@ static NSString *contentTypeFromFieldName(WebCore::AutofillFieldName fieldName)
             [_traits setKeyboardType:UIKeyboardTypeDefault];
         }
         break;
-    case WebCore::InputMode::None:
-        break;
     case WebCore::InputMode::Text:
         [_traits setKeyboardType:UIKeyboardTypeDefault];
         break;