Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased & removed views::View::GetTextInputClient & removed GetFocusedTextInputClient. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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())
yukawa 2015/06/16 02:45:03 Is there any chance to move this logic to TextInpu
Shu Chen 2015/06/16 05:15:27 I would prefer not to do that. Currently TextInput
yukawa 2015/06/16 05:34:10 It may make sense but how do you guarantee that Ge
Shu Chen 2015/06/16 06:53:59 GetInputMethod() returns NULL only when the View i
+ 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;

Powered by Google App Engine
This is Rietveld 408576698