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 27e1809f6bddcc0b111c28b764291fce6e35cad7..5cd14b9ca05fc4416d411beded9826101a4b775c 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -462,10 +462,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), |
@@ -1012,23 +1008,18 @@ 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::UpdateInputMethodIfNecessary( |
+ bool text_input_state_changed) { |
+ if (!GetInputMethod()) |
+ return; |
+ |
+ if (text_input_state_changed) |
+ GetInputMethod()->OnTextInputTypeChanged(this); |
+ |
+ TextInputState state = host_->delegate()->GetTextInputState(); |
+ |
+ if (state.show_ime_if_needed && state.type != ui::TEXT_INPUT_TYPE_NONE) |
+ GetInputMethod()->ShowImeIfNeeded(); |
} |
void RenderWidgetHostViewAura::ImeCancelComposition() { |
@@ -1661,7 +1652,10 @@ void RenderWidgetHostViewAura::ClearCompositionText() { |
} |
void RenderWidgetHostViewAura::InsertText(const base::string16& text) { |
- DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE); |
+ DCHECK(RenderWidgetHostImpl::From(GetRenderWidgetHost()) |
+ ->delegate() |
+ ->GetTextInputState() |
+ .type != ui::TEXT_INPUT_TYPE_NONE); |
// TODO(wjmaclean): can host_ ever be null? |
if (host_) |
host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false); |
@@ -1684,19 +1678,27 @@ void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) { |
} |
ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { |
- return text_input_type_; |
+ if (host_->delegate()) |
+ return host_->delegate()->GetTextInputState().type; |
+ return text_input_state()->type; |
} |
ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { |
- return text_input_mode_; |
+ if (host_->delegate()) |
+ return host_->delegate()->GetTextInputState().mode; |
+ return text_input_state()->mode; |
} |
int RenderWidgetHostViewAura::GetTextInputFlags() const { |
- return text_input_flags_; |
+ if (host_->delegate()) |
+ return host_->delegate()->GetTextInputState().flags; |
+ return text_input_state()->flags; |
} |
bool RenderWidgetHostViewAura::CanComposeInline() const { |
- return can_compose_inline_; |
+ if (host_->delegate()) |
+ return host_->delegate()->GetTextInputState().can_compose_inline; |
+ return text_input_state()->can_compose_inline; |
} |
gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen( |