Bug 164077

Summary: iOS autocorrection does not trigger an input event of inputType "insertReplacementText"
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: UI EventsAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, enrica, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 163112    
Attachments:
Description Flags
Patch
simon.fraser: review+
[For EWS] Fix DRT and implement feedback
none
[For EWS] Fix iOS OpenSource build.
none
Patch for landing none

Wenson Hsieh
Reported 2016-10-27 14:00:42 PDT
With input events on: - Start typing something in an editable area (e.g. “tes”). The candidate bar on iOS should show an autocompletion candidate (e.g. “test” or “testing”) - Select the candidate - Observe that `beforeinput` and `input` events of type “insertText” were fired, when they should really be of type “insertReplacementText”.
Attachments
Patch (32.63 KB, patch)
2016-10-28 15:16 PDT, Wenson Hsieh
simon.fraser: review+
[For EWS] Fix DRT and implement feedback (33.90 KB, patch)
2016-10-28 16:41 PDT, Wenson Hsieh
no flags
[For EWS] Fix iOS OpenSource build. (34.38 KB, patch)
2016-10-28 17:08 PDT, Wenson Hsieh
no flags
Patch for landing (34.37 KB, patch)
2016-10-28 17:33 PDT, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2016-10-27 14:01:30 PDT
Wenson Hsieh
Comment 2 2016-10-28 15:16:46 PDT
Simon Fraser (smfr)
Comment 3 2016-10-28 15:29:38 PDT
Comment on attachment 293229 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=293229&action=review > Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:260 > + ASSERT(index >= 0 && index < 3); This should not assert if it's possible for the JS to send in arbitrary values, but ideally it would trigger an error if too big. > Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:283 > + float offsetX = (index * 2 + 1) * CGRectGetWidth(predictionViewFrame) / 6; > + float offsetY = CGRectGetHeight(webView.window.frame) - CGRectGetHeight([UIKeyboardPredictionView activeInstance].superview.frame) + CGRectGetHeight(predictionViewFrame) / 2; > + [[HIDEventGenerator sharedHIDEventGenerator] tap:CGPointMake(offsetX, offsetY) completionBlock:^{ > + if (m_context) > + m_context->asyncTaskComplete(callbackID); > + }]; Seems fragile in the face of UI changes, but oh well. > LayoutTests/fast/events/ios/before-input-events-prevent-candidate-insertion.html:16 > + uiController.singleTapAtPoint(100, 50, function() {}); You should get the coordinates via getBoundingClientRect, like other tests. > LayoutTests/fast/events/ios/input-events-insert-replacement-text.html:16 > + uiController.singleTapAtPoint(100, 100, function() {}); Ditto.
Wenson Hsieh
Comment 4 2016-10-28 16:41:06 PDT
Created attachment 293244 [details] [For EWS] Fix DRT and implement feedback
Wenson Hsieh
Comment 5 2016-10-28 16:43:44 PDT
Comment on attachment 293229 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=293229&action=review >> Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:260 >> + ASSERT(index >= 0 && index < 3); > > This should not assert if it's possible for the JS to send in arbitrary values, but ideally it would trigger an error if too big. Yes, this is reasonable. There are a few other places where we should use exceptions (e.g. typeCharacterUsingHardwareKeyboard with an invalid string, or zoomToScale with a negative scale). I'll file a followup to make these throw exceptions on receiving bad arguments. >> Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:283 >> + }]; > > Seems fragile in the face of UI changes, but oh well. I agree :( Since we want to eventually test using the software keyboard as well, we should reach out to the keyboards team and see if we can get any SPI to make this more robust. >> LayoutTests/fast/events/ios/before-input-events-prevent-candidate-insertion.html:16 >> + uiController.singleTapAtPoint(100, 50, function() {}); > > You should get the coordinates via getBoundingClientRect, like other tests. Sounds good! Done. >> LayoutTests/fast/events/ios/input-events-insert-replacement-text.html:16 >> + uiController.singleTapAtPoint(100, 100, function() {}); > > Ditto. Done.
Wenson Hsieh
Comment 6 2016-10-28 17:08:12 PDT
Created attachment 293249 [details] [For EWS] Fix iOS OpenSource build.
Wenson Hsieh
Comment 7 2016-10-28 17:33:24 PDT
Created attachment 293257 [details] Patch for landing
WebKit Commit Bot
Comment 8 2016-10-28 18:09:06 PDT
Comment on attachment 293257 [details] Patch for landing Clearing flags on attachment: 293257 Committed r208090: <http://trac.webkit.org/changeset/208090>
Wenson Hsieh
Comment 9 2016-10-28 22:19:04 PDT
Build fix in r208094
Note You need to log in before you can comment on or make changes to this bug.