Chromium Code Reviews| Index: content/renderer/render_widget.cc |
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
| index ddd60cb9e6f1a7dace2cb3c442c7f8a78ed5de40..eebff7059efe60a43730f5062ef0f1a2e425804a 100644 |
| --- a/content/renderer/render_widget.cc |
| +++ b/content/renderer/render_widget.cc |
| @@ -714,6 +714,8 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) { |
| IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceIdNamespace, OnSetSurfaceIdNamespace) |
| #if defined(OS_ANDROID) |
| IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
| + IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
| + OnRequestTextInputStateUpdate) |
| IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
| #endif |
| IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
| @@ -1295,9 +1297,16 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime, |
| bool new_can_compose_inline = CanComposeInline(); |
| + bool use_ime_thread = false; |
|
aelias_OOO_until_Jul13
2016/01/23 03:21:39
Let's make this default true on non-Android so tha
Changwan Ryu
2016/01/26 03:25:29
Hmm... For other platforms if we set this as true
aelias_OOO_until_Jul13
2016/01/26 05:21:18
No, that shouldn't happen because change_source is
|
| +#if defined(OS_ANDROID) |
| + use_ime_thread = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kUseImeThread); |
| +#endif |
| + |
| // Only sends text input params if they are changed or if the ime should be |
| // shown. |
| if (show_ime == ShowIme::IF_NEEDED || |
| + (use_ime_thread && change_source == ChangeSource::FROM_IME) || |
| (text_input_type_ != new_type || text_input_mode_ != new_mode || |
| text_input_info_ != new_info || |
| can_compose_inline_ != new_can_compose_inline) |
| @@ -1795,12 +1804,19 @@ void RenderWidget::OnImeEventAck() { |
| DCHECK_GE(text_input_info_history_.size(), 1u); |
| text_input_info_history_.pop_front(); |
| } |
| + |
| +void RenderWidget::OnRequestTextInputStateUpdate() { |
| + ImeEventGuard guard(this, false, true); |
|
aelias_OOO_until_Jul13
2016/01/23 03:21:39
This can't be nested so it seems unnecessarily ind
Changwan Ryu
2016/01/26 03:25:29
Done.
|
| +} |
| #endif |
| bool RenderWidget::ShouldHandleImeEvent() { |
| #if defined(OS_ANDROID) |
| if (!webwidget_) |
| return false; |
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kUseImeThread)) |
| + return true; |
| // We cannot handle IME events if there is any chance that the event we are |
| // receiving here from the browser is based on the state that is different |
| @@ -1893,6 +1909,18 @@ void RenderWidget::set_next_paint_is_repaint_ack() { |
| next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; |
| } |
| +bool RenderWidget::IsFromImeDefault() { |
| +#if defined(OS_ANDROID) |
| + // When ChromiumInputConnection is used, we want to make sure that FROM_IME |
| + // is set only for OnRequestTextInputStateUpdate() so that we can distinguish |
| + // it from other updates so that we can wait for it safely. |
| + return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kUseImeThread); |
| +#else |
| + return true; |
|
aelias_OOO_until_Jul13
2016/01/23 03:21:40
Let's make this default false on non-Android. It'
Changwan Ryu
2016/01/26 03:25:29
Done.
|
| +#endif |
| +} |
| + |
| void RenderWidget::OnImeEventGuardStart(ImeEventGuard* guard) { |
| if (!ime_event_guard_) |
| ime_event_guard_ = guard; |
| @@ -2189,7 +2217,9 @@ void RenderWidget::setTouchAction( |
| void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { |
| #if defined(OS_ANDROID) |
| - text_field_is_dirty_ = true; |
| + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kUseImeThread)) |
| + text_field_is_dirty_ = true; |
| #endif |
| } |