Chromium Code Reviews| Index: content/renderer/input/render_widget_input_handler.cc |
| diff --git a/content/renderer/input/render_widget_input_handler.cc b/content/renderer/input/render_widget_input_handler.cc |
| index d5d5255c02f9c864a383a94ca1745f640d47461b..872a4e9b50365a72bf9ce0a4ac3779ea59c9ebba 100644 |
| --- a/content/renderer/input/render_widget_input_handler.cc |
| +++ b/content/renderer/input/render_widget_input_handler.cc |
| @@ -9,6 +9,7 @@ |
| #include <utility> |
| #include "base/auto_reset.h" |
| +#include "base/command_line.h" |
| #include "base/metrics/histogram_macros.h" |
| #include "base/trace_event/trace_event_synthetic_delay.h" |
| #include "build/build_config.h" |
| @@ -17,6 +18,7 @@ |
| #include "content/common/input/input_event_ack.h" |
| #include "content/common/input/input_event_ack_state.h" |
| #include "content/common/input/web_input_event_traits.h" |
| +#include "content/public/common/content_switches.h" |
| #include "content/renderer/gpu/render_widget_compositor.h" |
| #include "content/renderer/ime_event_guard.h" |
| #include "content/renderer/input/render_widget_input_handler_delegate.h" |
| @@ -208,12 +210,18 @@ void RenderWidgetInputHandler::HandleInputEvent( |
| #if defined(OS_ANDROID) |
| bool from_ime = false; |
| + bool use_ime_thread = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kUseImeThread); |
| // For most keyboard events, we want the change source to be FROM_IME because |
| // we don't need to update IME states in AdapterInputConnection. |
| if (WebInputEvent::isKeyboardEventType(input_event.type)) { |
| const WebKeyboardEvent& key_event = |
| *static_cast<const WebKeyboardEvent*>(&input_event); |
| + if (use_ime_thread) { |
| + // We do not send state update for synthetic keys that accompany |
| + // setComposingText / commitText. |
| + from_ime = key_event.nativeKeyCode != 229; |
|
aelias_OOO_until_Jul13
2016/01/21 07:43:05
But this line implies you're still setting FROM_IM
Changwan Ryu
2016/01/22 10:22:17
Done. Thanks for finding it! Fixed as suggested!
|
| // TODO(changwan): this if-condition is a stop-gap solution to update IME |
| // states in AdapterInputConnection when using DPAD navigation. This is not |
| // a correct solution because InputConnection#getTextBeforeCursor() |
| @@ -221,13 +229,14 @@ void RenderWidgetInputHandler::HandleInputEvent( |
| // correct value. The correct solution is either redesign the architecture |
| // or emulate the DPAD behavior in AdapterInputConnection, either is |
| // non-trivial. |
| - if (key_event.nativeKeyCode != AKEYCODE_TAB && |
| + } else if (key_event.nativeKeyCode != AKEYCODE_TAB && |
| key_event.nativeKeyCode != AKEYCODE_DPAD_CENTER && |
| key_event.nativeKeyCode != AKEYCODE_DPAD_LEFT && |
| key_event.nativeKeyCode != AKEYCODE_DPAD_RIGHT && |
| key_event.nativeKeyCode != AKEYCODE_DPAD_UP && |
| - key_event.nativeKeyCode != AKEYCODE_DPAD_DOWN) |
| + key_event.nativeKeyCode != AKEYCODE_DPAD_DOWN) { |
| from_ime = true; |
| + } |
| } |
| ImeEventGuard guard(widget_, false, from_ime); |