| Index: ui/views/controls/textfield/textfield.cc
|
| diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
|
| index cc2d492a3cb2e1d43c7e4830fd0561637ddc5922..c259f776b87ef7b016b44a2fcb8e064a2e20b5c3 100644
|
| --- a/ui/views/controls/textfield/textfield.cc
|
| +++ b/ui/views/controls/textfield/textfield.cc
|
| @@ -12,6 +12,7 @@
|
| #include "ui/base/cursor/cursor.h"
|
| #include "ui/base/dragdrop/drag_drop_types.h"
|
| #include "ui/base/dragdrop/drag_utils.h"
|
| +#include "ui/base/ime/input_method.h"
|
| #include "ui/base/touch/selection_bound.h"
|
| #include "ui/base/ui_base_switches_util.h"
|
| #include "ui/compositor/canvas_painter.h"
|
| @@ -31,7 +32,6 @@
|
| #include "ui/views/controls/native/native_view_host.h"
|
| #include "ui/views/controls/textfield/textfield_controller.h"
|
| #include "ui/views/drag_utils.h"
|
| -#include "ui/views/ime/input_method.h"
|
| #include "ui/views/metrics.h"
|
| #include "ui/views/native_cursor.h"
|
| #include "ui/views/painter.h"
|
| @@ -291,7 +291,12 @@ Textfield::Textfield()
|
| }
|
| }
|
|
|
| -Textfield::~Textfield() {}
|
| +Textfield::~Textfield() {
|
| + if (GetInputMethod()) {
|
| + // The textfield should have been blurred before destroy.
|
| + DCHECK(this != GetInputMethod()->GetTextInputClient());
|
| + }
|
| +}
|
|
|
| void Textfield::SetReadOnly(bool read_only) {
|
| // Update read-only without changing the focusable state (or active, etc.).
|
| @@ -715,10 +720,6 @@ bool Textfield::OnKeyPressed(const ui::KeyEvent& event) {
|
| return handled;
|
| }
|
|
|
| -ui::TextInputClient* Textfield::GetTextInputClient() {
|
| - return this;
|
| -}
|
| -
|
| void Textfield::OnGestureEvent(ui::GestureEvent* event) {
|
| switch (event->type()) {
|
| case ui::ET_GESTURE_TAP_DOWN:
|
| @@ -994,7 +995,8 @@ void Textfield::OnFocus() {
|
| GetRenderText()->set_focused(true);
|
| cursor_visible_ = true;
|
| SchedulePaint();
|
| - GetInputMethod()->OnFocus();
|
| + if (GetInputMethod())
|
| + GetInputMethod()->SetFocusedTextInputClient(this);
|
| OnCaretBoundsChanged();
|
|
|
| const size_t caret_blink_ms = Textfield::GetCaretBlinkMs();
|
| @@ -1010,7 +1012,8 @@ void Textfield::OnFocus() {
|
|
|
| void Textfield::OnBlur() {
|
| GetRenderText()->set_focused(false);
|
| - GetInputMethod()->OnBlur();
|
| + if (GetInputMethod())
|
| + GetInputMethod()->DetachTextInputClient(this);
|
| cursor_repaint_timer_.Stop();
|
| if (cursor_visible_) {
|
| cursor_visible_ = false;
|
|
|