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..d5f395229b028973f25c685b44c739ca23e1060b 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,10 @@ Textfield::Textfield() |
} |
} |
-Textfield::~Textfield() {} |
+Textfield::~Textfield() { |
+ if (GetInputMethod()) |
sky
2015/06/29 02:17:41
Is it really possible to hit this? I would have as
Shu Chen
2015/06/29 02:56:34
You're right. The FocusManager should make sure th
sky
2015/06/29 17:03:49
DCHECK.
Shu Chen
2015/06/30 00:54:06
Done.
|
+ GetInputMethod()->DetachTextInputClient(this); |
+} |
void Textfield::SetReadOnly(bool read_only) { |
// Update read-only without changing the focusable state (or active, etc.). |
@@ -715,10 +718,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 +993,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 +1010,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; |