Changeset 245338 in webkit
- Timestamp:
- May 15, 2019 12:24:16 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r245337 r245338 1 2019-05-15 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 inputmode="numeric" should show a number pad with digits 0-9, instead of the numeric keyplane 4 https://bugs.webkit.org/show_bug.cgi?id=197916 5 <rdar://problem/50815427> 6 7 Reviewed by Timothy Hatcher. 8 9 Use UIKeyboardTypeNumberPad instead of UIKeyboardTypeNumbersAndPunctuation when presenting a keyboard for a 10 field with inputmode="numeric". While the WhatWG specification merely requires the UA to display a keyboard 11 "capable of numeric input", it suggests that the keyboard should be "useful for PIN entry", which loosely 12 implies a number pad. 13 14 This is also generally in line with feedback from web developers. 15 16 * UIProcess/ios/WKContentViewInteraction.mm: 17 (-[WKContentView textInputTraits]): 18 1 19 2019-05-15 Don Olmstead <don.olmstead@sony.com> 2 20 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r245283 r245338 4381 4381 break; 4382 4382 case WebCore::InputMode::Numeric: 4383 [_traits setKeyboardType:UIKeyboardTypeNumber sAndPunctuation];4383 [_traits setKeyboardType:UIKeyboardTypeNumberPad]; 4384 4384 break; 4385 4385 case WebCore::InputMode::Decimal: -
trunk/Tools/ChangeLog
r245328 r245338 1 2019-05-15 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 inputmode="numeric" should show a number pad with digits 0-9, instead of the numeric keyplane 4 https://bugs.webkit.org/show_bug.cgi?id=197916 5 <rdar://problem/50815427> 6 7 Reviewed by Timothy Hatcher. 8 9 Re-enable this previously flaky test, and rebaseline the result to to expect UIKeyboardTypeNumberPad for 10 inputmode="numeric". 11 12 * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: 13 (TestWebKitAPI::TEST): 14 1 15 2019-05-15 Youenn Fablet <youenn@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm
r244955 r245338 360 360 } 361 361 362 TEST(KeyboardInputTests, DISABLED_KeyboardTypeForInput)362 TEST(KeyboardInputTests, KeyboardTypeForInput) 363 363 { 364 364 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); … … 370 370 [webView _setInputDelegate:inputDelegate.get()]; 371 371 [webView synchronouslyLoadHTMLString:@"<input id='input'>"]; 372 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"input.focus()"]; 372 373 373 374 auto runTest = ^(NSString *inputType, NSString *inputMode, NSString *pattern, UIKeyboardType expectedKeyboardType) { 374 [webView stringByEvaluatingJavaScript:@"input.blur()"]; 375 [webView stringByEvaluatingJavaScript:[NSString stringWithFormat:@"input.type = '%@'; input.inputMode = '%@'; input.pattern = '%@'", inputType, inputMode, pattern]]; 376 [webView stringByEvaluatingJavaScript:@"input.focus()"]; 375 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"input.blur()"]; 376 [webView evaluateJavaScriptAndWaitForInputSessionToChange:[NSString stringWithFormat:@"input.type = '%@'; input.inputMode = '%@'; input.pattern = '%@'; input.focus()", inputType, inputMode, pattern]]; 377 377 378 378 UIView<UITextInputPrivate> *textInput = (UIView<UITextInputPrivate> *)[webView textInputContentView]; … … 402 402 @"url": @(UIKeyboardTypeURL), 403 403 @"email": @(UIKeyboardTypeEmailAddress), 404 @"numeric": @(UIKeyboardTypeNumber sAndPunctuation),404 @"numeric": @(UIKeyboardTypeNumberPad), 405 405 @"decimal": @(UIKeyboardTypeDecimalPad), 406 406 @"search": @(UIKeyboardTypeWebSearch) … … 413 413 }; 414 414 415 for (NSString *inputType in [expectedKeyboardTypeForInputType allKeys]) { 416 for (NSString *inputMode in [expectedKeyboardTypeForInputMode allKeys]) { 417 for (NSString *pattern in [expectedKeyboardTypeForPattern allKeys]) { 415 for (NSString *inputType in expectedKeyboardTypeForInputType) { 416 BOOL isNumberOrTextInput = [inputType isEqual:@"text"] || [inputType isEqual:@"number"]; 417 for (NSString *inputMode in expectedKeyboardTypeForInputMode) { 418 for (NSString *pattern in expectedKeyboardTypeForPattern) { 418 419 NSNumber *keyboardType; 419 420 if (inputMode.length) { … … 421 422 keyboardType = expectedKeyboardTypeForInputMode[inputMode]; 422 423 } else { 423 if (pattern.length && ([inputType isEqual: @"text"] || [inputType isEqual: @"number"])) { 424 // Special case for text and number inputs that have a numeric pattern. 425 keyboardType = expectedKeyboardTypeForPattern[pattern]; 426 } else { 427 // Otherwise, the input type determines the keyboard type. 428 keyboardType = expectedKeyboardTypeForInputType[inputType]; 429 } 424 // Special case for text and number inputs that have a numeric pattern. Otherwise, the input type determines the keyboard type. 425 keyboardType = pattern.length && isNumberOrTextInput ? expectedKeyboardTypeForPattern[pattern] : expectedKeyboardTypeForInputType[inputType]; 430 426 } 431 427
Note: See TracChangeset
for help on using the changeset viewer.