Chromium Code Reviews
DescriptionUnstrangle unhandled key event callback for webview
Currently, when typing on an input form using a BT keyboard or
when InputConnection#sendKeyEvent() is used, we end up getting unhandled
ACTION_UP event in WebViewClient#onUnhandledInputEvent(). Here's what
happens:
1) RawKeyDown event is not processed: we create Char event in
ime_adapter_android.cc and process it instead.
So RenderWidgetHostImpl::OnKeyboardEventAck() should normally propagate
to onUnhandledInputEvent() as the event was not processed. But
we've set the skip_in_browser flag in ime_adapter_android.cc so
OnKeyboardEventAck() does not propagate this event.
2) Char event is processed.
3) KeyUp event is not processed, and OnKeyboardEventAck() propagates the
event, and WebViewClient#onUnhandledInputEvent() is called.
The last one is an incorrect behavior, and we get unpaired
onUnhandledInputEvent() callback only for ACTION_UP.
Also, when ACTION_DOWN / ACTION_UP are not handled (when no input form is
focused), the following happens:
1) RawKeyDown event is not processed. But we set the skip_in_browser flag
so OnKeyboardEventAck() does not propagate the event.
(This is an incorrect behavior.)
2) Char event is not created.
3) KeyUp event is not processed, and OnKeyboardEventAck() propagates the
event, and onUnhandledInputEvent() is called.
We still get unpaired onUnhandledInputEvent() callback, only for ACTION_UP.
The first problem here is that return value of handleInputEvent() for
KeyUp event is different from that for RawKeyDown or Char events.
Another problem is that we sometimes create Char event and sometimes we
do not, but Char event cannot deliver (propagate) platform-specific event.
So for a proper fix, we need the following changes:
- When Char event is created, we set os_event such that if Char event is
not processed, we make sure onUnhandledInputEvent() is called.
- Change EventHandler::keyEvent to return the same value for KeyUp event
as the value returned for RawKeyDown or Char event.
BUG=538377
Patch Set 1 #
Total comments: 1
Patch Set 2 : new approach #Patch Set 3 : changed variable names and comments #
Total comments: 1
Messages
Total messages: 14 (6 generated)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||