| 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..3243b42e4357d6c3424bbfe21cfeffc3b3e0eda7 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())
|
| + 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;
|
| @@ -1459,21 +1460,6 @@ void Textfield::InsertChar(base::char16 ch, int flags) {
|
| }
|
| }
|
|
|
| -gfx::NativeWindow Textfield::GetAttachedWindow() const {
|
| - // Imagine the following hierarchy.
|
| - // [NativeWidget A] - FocusManager
|
| - // [View]
|
| - // [NativeWidget B]
|
| - // [View]
|
| - // [View X]
|
| - // An important thing is that [NativeWidget A] owns Win32 input focus even
|
| - // when [View X] is logically focused by FocusManager. As a result, an Win32
|
| - // IME may want to interact with the native view of [NativeWidget A] rather
|
| - // than that of [NativeWidget B]. This is why we need to call
|
| - // GetTopLevelWidget() here.
|
| - return GetWidget()->GetTopLevelWidget()->GetNativeWindow();
|
| -}
|
| -
|
| ui::TextInputType Textfield::GetTextInputType() const {
|
| if (read_only() || !enabled())
|
| return ui::TEXT_INPUT_TYPE_NONE;
|
|
|