Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| index d06fde40a5576d801c9d86386f99a1ca76309f37..6f4e093ac3d95af0413da2f5402a73d511999b7f 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -461,10 +461,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, |
| popup_parent_host_view_(NULL), |
| popup_child_host_view_(NULL), |
| is_loading_(false), |
| - text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| - text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
| - text_input_flags_(0), |
| - can_compose_inline_(true), |
| has_composition_text_(false), |
| accept_return_character_(false), |
| last_swapped_software_frame_scale_factor_(1.f), |
| @@ -1007,23 +1003,17 @@ void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
| UpdateCursorIfOverSelf(); |
| } |
| -void RenderWidgetHostViewAura::TextInputStateChanged( |
| - const ViewHostMsg_TextInputState_Params& params) { |
| - if (text_input_type_ != params.type || |
| - text_input_mode_ != params.mode || |
| - can_compose_inline_ != params.can_compose_inline || |
| - text_input_flags_ != params.flags) { |
| - text_input_type_ = params.type; |
| - text_input_mode_ = params.mode; |
| - can_compose_inline_ = params.can_compose_inline; |
| - text_input_flags_ = params.flags; |
| - if (GetInputMethod()) |
| - GetInputMethod()->OnTextInputTypeChanged(this); |
| - } |
| - if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) { |
| - if (GetInputMethod()) |
| - GetInputMethod()->ShowImeIfNeeded(); |
| - } |
| +void RenderWidgetHostViewAura::UpdateTextInputState() { |
| + RenderWidgetHostViewBase::UpdateTextInputState(); |
| + |
| + if (!GetInputMethod()) |
| + return; |
| + |
| + GetInputMethod()->OnTextInputTypeChanged(this); |
|
Shu Chen
2016/03/04 02:30:29
The original logic notifies InputMethod only when
EhsanK
2016/03/04 09:31:49
I actually removed that part due to this comment:
Shu Chen
2016/03/04 09:57:45
The original logic is:
if (anything changed) {
EhsanK
2016/03/08 05:21:03
Thanks for the detailed explanation. I realize the
|
| + |
| + const TextInputState* state = current_text_input_state(); |
| + if (state->show_ime_if_needed && state->type != ui::TEXT_INPUT_TYPE_NONE) |
| + GetInputMethod()->ShowImeIfNeeded(); |
| } |
| void RenderWidgetHostViewAura::ImeCancelComposition() { |
| @@ -1646,7 +1636,7 @@ void RenderWidgetHostViewAura::ClearCompositionText() { |
| } |
| void RenderWidgetHostViewAura::InsertText(const base::string16& text) { |
| - DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE); |
| + DCHECK(current_text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE); |
| if (host_) |
| host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false); |
| has_composition_text_ = false; |
| @@ -1667,19 +1657,19 @@ void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) { |
| } |
| ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { |
| - return text_input_type_; |
| + return current_text_input_state()->type; |
| } |
| ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { |
| - return text_input_mode_; |
| + return current_text_input_state()->mode; |
| } |
| int RenderWidgetHostViewAura::GetTextInputFlags() const { |
| - return text_input_flags_; |
| + return current_text_input_state()->flags; |
| } |
| bool RenderWidgetHostViewAura::CanComposeInline() const { |
| - return can_compose_inline_; |
| + return current_text_input_state()->can_compose_inline; |
| } |
| gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen( |