DescriptionDeal with backspace keycodes getting sent by IME during compositions.
As of KitKat, the standard Google IME always calls
deleteSurroundingText(1, 0) when the soft backspace button is pressed.
But Jellybean and below instead mixed in a backspace key event into the
IME stream, and the current Samsung keyboard still has this behavior.
If we only forward such key events to Blink during an ongoing
composition, then Blink will delete its string but the
BaseInputConnection won't update its state, leading to a desync
and strange bugs later.
Our sendKeyEvent method already had a workaround to call
deleteSurroundingText directly in such cases. sendKeyEvent is called
when Samsung keyboard is used with Chrome, but WebView instead goes
through the alternate Chrome.dispatchKeyEvent path. For that reason we
currently have a Samsung+WebView specific desync bug.
This patch changes dispatchKeyEvent to call sendKeyEvent, like
https://codereview.chromium.org/759033002 did before it was reverted, to
extend the workaround to WebView. This would have the unfortunate side
effect of causing a bug with backspace key-repeats on physical
keyboards, as the code there only applies backspace on keyup. So this
patch changes it to keydown (which is better UX even aside from
key repeat) and also forwards the system-supplied key events directly
instead of throwing them out and generating artificial ones.
BUG=483514
Committed: https://crrev.com/30b299cb04b4ba2330ef61a8a24c1e58513a0af2
Cr-Commit-Position: refs/heads/master@{#329954}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Collapse nested if statement for ACTION_DOWN/UP #Patch Set 3 : Add test #Patch Set 4 : Add another test for repeat keydowns #
Messages
Total messages: 10 (2 generated)
|