| 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 02820033e888a3ac38ff3874f924c3bc55c52331..d2100101f7e2720b687b493c1e9d7e0d18ebfef8 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
| @@ -371,10 +371,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),
|
| @@ -861,23 +857,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() {
|
| @@ -1474,7 +1465,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);
|
| @@ -1497,19 +1491,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(
|
| @@ -2661,6 +2663,10 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() {
|
| if (cursor_client)
|
| cursor_client->RemoveObserver(this);
|
|
|
| + // The WebContentsImpl should be notified about us so that it will not hold
|
| + // an invalid text input state which was due to active text on this view.
|
| + NotifyHostDelegateAboutShutdown();
|
| +
|
| DetachFromInputMethod();
|
|
|
| window_->GetHost()->RemoveObserver(this);
|
|
|