Commit 232211d7 authored by oshima@google.com's avatar oshima@google.com

Fix infinite loop in GetInputMethod.

RWHVV shouldn't update ime if there is no inputmethod associated with the view.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/7976028

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102225 0039d316-1c4b-4281-b951-d872f2087c98
parent 5afcbf4f
......@@ -271,14 +271,21 @@ void RenderWidgetHostViewViews::ImeUpdateTextInputState(
// as true. We need to support "can_compose_inline=false" for PPAPI plugins
// that may want to avoid drawing composition-text by themselves and pass
// the responsibility to the browser.
DCHECK(GetInputMethod());
// This is async message and by the time the ipc arrived,
// RWHVV may be detached from Top level widget, in which case
// GetInputMethod may return NULL;
views::InputMethod* input_method = GetInputMethod();
if (text_input_type_ != type) {
text_input_type_ = type;
GetInputMethod()->OnTextInputTypeChanged(this);
if (input_method)
input_method->OnTextInputTypeChanged(this);
}
if (caret_bounds_ != caret_rect) {
caret_bounds_ = caret_rect;
GetInputMethod()->OnCaretBoundsChanged(this);
if (input_method)
input_method->OnCaretBoundsChanged(this);
}
}
......
......@@ -622,7 +622,12 @@ InputMethod* Widget::GetInputMethod() {
return input_method_.get();
} else {
Widget* toplevel = GetTopLevelWidget();
return toplevel ? toplevel->GetInputMethod() : NULL;
// If GetTopLevelWidget() returns itself which is not toplevel,
// the widget is detached from toplevel widget.
// TODO(oshima): Fix GetTopLevelWidget() to return NULL
// if there is no toplevel. We probably need to add GetTopMostWidget()
// to replace some use cases.
return (toplevel && toplevel != this) ? toplevel->GetInputMethod() : NULL;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment