diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-27 03:19:24 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-27 03:19:24 +0000 |
commit | 48d6a51299665bc82286967f896e81b15d383ff9 (patch) | |
tree | edf2e9853323f37e5a99ed076539cea4bc917d59 /ui/views/widget | |
parent | 460bbf18418f7870fba9fc60d0abdb90b6fc2991 (diff) | |
download | chromium_src-48d6a51299665bc82286967f896e81b15d383ff9.zip chromium_src-48d6a51299665bc82286967f896e81b15d383ff9.tar.gz chromium_src-48d6a51299665bc82286967f896e81b15d383ff9.tar.bz2 |
Fix Views Combobox and Tree View text input.
Make InputMethodBridge not a TextInputClient, use actual clients.
InputMethodBridge was simply forwarding to actual client views.
(e.g. NativeTextfieldViews and PrefixSelector for TreeView/Combobox)
Remove Views::InputMethod::On[Focus|Blur]() and their calls.
Simply update the host's TextInputClient on View focus changes.
Fixes r216992's regression (input not sent to Combobox/TreeView).
The IME mode indicator also now shows in dialogs more often :)
Ignore Widget activation in InputMethodBase::GetTextInputClient.
(fixes linux_chromeos initial omnibox input with this patch, seems ok)
Call View::On[Focus|Blur] from Combobox and TreeView.
(mostly for correctness and NotifyAccessibilityEvent, not critical)
Remove the OnCaretBoundsChanged call from TreeView.
(unnecessary and doesn't set correct candidate window bounds)
Remove unused DesktopRootWindowHost::OnNativeWidget[Focus|Blur].
Handle NULL TextInputClient* objects in TextInputTestHelper.
BUG=276720,271754,265337
TEST=Test Win (desktop, Win8 Metro, and Aura builds), CrOS, and Linux Aura's Omnibox, Find Bar, Bookmark Bubble, and Edit Bookmark Dialog's textfield text entry (and text input handling to select combobox and tree view elements) with EN, JA, and other IMEs, and related IME usage (Win+Space to change IME on Win8, Alt+` to change modes, etc.). Also test with --enable-text-services-framework. Note that IME candidate windows may not appear or may appear at incorrect positions for tree views and comboboxes, but this seems like a separate issue.
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/23245012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/widget')
8 files changed, 1 insertions, 62 deletions
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index 859decc..cac3cbd 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc @@ -862,17 +862,8 @@ void DesktopNativeWidgetAura::OnWindowActivated(aura::Window* gained_active, void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, aura::Window* lost_focus) { if (window_ == gained_focus) { - desktop_root_window_host_->OnNativeWidgetFocus(); native_widget_delegate_->OnNativeFocus(lost_focus); - - // If focus is moving from a descendant Window to |window_| then native - // activation hasn't changed. We still need to inform the InputMethod we've - // been focused though. - InputMethod* input_method = GetWidget()->GetInputMethod(); - if (input_method) - input_method->OnFocus(); } else if (window_ == lost_focus) { - desktop_root_window_host_->OnNativeWidgetBlur(); native_widget_delegate_->OnNativeBlur( aura::client::GetFocusClient(window_)->GetFocusedWindow()); } diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host.h b/ui/views/widget/desktop_aura/desktop_root_window_host.h index 9bdc946..9b4185e 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host.h @@ -108,11 +108,6 @@ class VIEWS_EXPORT DesktopRootWindowHost { virtual void InitModalType(ui::ModalType modal_type) = 0; virtual void FlashFrame(bool flash_frame) = 0; - - // Called when the DesktopNativeWidgetAura's aura::Window is focused and - // blurred. - virtual void OnNativeWidgetFocus() = 0; - virtual void OnNativeWidgetBlur() = 0; }; } // namespace views diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc index c2e2e88..04ea03c 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc @@ -28,7 +28,6 @@ #include "ui/views/corewm/focus_controller.h" #include "ui/views/corewm/input_method_event_filter.h" #include "ui/views/corewm/window_animations.h" -#include "ui/views/ime/input_method_bridge.h" #include "ui/views/widget/desktop_aura/desktop_activation_client.h" #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" @@ -374,13 +373,6 @@ void DesktopRootWindowHostWin::FlashFrame(bool flash_frame) { message_handler_->FlashFrame(flash_frame); } -void DesktopRootWindowHostWin::OnNativeWidgetFocus() { - // HWNDMessageHandler will perform the proper updating on its own. -} - -void DesktopRootWindowHostWin::OnNativeWidgetBlur() { -} - //////////////////////////////////////////////////////////////////////////////// // DesktopRootWindowHostWin, RootWindowHost implementation: @@ -757,16 +749,10 @@ void DesktopRootWindowHostWin::HandleFrameChanged() { void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { // TODO(beng): inform the native_widget_delegate_. - InputMethod* input_method = GetInputMethod(); - if (input_method) - input_method->OnFocus(); } void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { // TODO(beng): inform the native_widget_delegate_. - InputMethod* input_method = GetInputMethod(); - if (input_method) - input_method->OnBlur(); } bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.h b/ui/views/widget/desktop_aura/desktop_root_window_host_win.h index 028e608..af6d8be 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.h @@ -93,8 +93,6 @@ class VIEWS_EXPORT DesktopRootWindowHostWin const gfx::ImageSkia& app_icon) OVERRIDE; virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; virtual void FlashFrame(bool flash_frame) OVERRIDE; - virtual void OnNativeWidgetFocus() OVERRIDE; - virtual void OnNativeWidgetBlur() OVERRIDE; // Overridden from aura::RootWindowHost: virtual void SetDelegate(aura::RootWindowHostDelegate* delegate) OVERRIDE; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc index b6a1c13..0340b01 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc @@ -31,7 +31,6 @@ #include "ui/views/corewm/corewm_switches.h" #include "ui/views/corewm/cursor_manager.h" #include "ui/views/corewm/focus_controller.h" -#include "ui/views/ime/input_method.h" #include "ui/views/widget/desktop_aura/desktop_activation_client.h" #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater_aurax11.h" #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" @@ -536,15 +535,6 @@ void DesktopRootWindowHostX11::FlashFrame(bool flash_frame) { NOTIMPLEMENTED(); } -void DesktopRootWindowHostX11::OnNativeWidgetFocus() { - native_widget_delegate_->AsWidget()->GetInputMethod()->OnFocus(); -} - -void DesktopRootWindowHostX11::OnNativeWidgetBlur() { - if (xwindow_) - native_widget_delegate_->AsWidget()->GetInputMethod()->OnBlur(); -} - //////////////////////////////////////////////////////////////////////////////// // DesktopRootWindowHostX11, aura::RootWindowHost implementation: diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h index 65a135a..43fce3c 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h @@ -120,8 +120,6 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 : const gfx::ImageSkia& app_icon) OVERRIDE; virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; virtual void FlashFrame(bool flash_frame) OVERRIDE; - virtual void OnNativeWidgetFocus() OVERRIDE; - virtual void OnNativeWidgetBlur() OVERRIDE; // Overridden from aura::RootWindowHost: virtual void SetDelegate(aura::RootWindowHostDelegate* delegate) OVERRIDE; diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index f9ebed7..3efdf9a 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -888,23 +888,10 @@ void NativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, if (window_ == gained_focus) { // In aura, it is possible for child native widgets to take input and focus, // this differs from the behavior on windows. - if (GetWidget()->GetInputMethod()) // Null in tests. - GetWidget()->GetInputMethod()->OnFocus(); delegate_->OnNativeFocus(lost_focus); } else if (window_ == lost_focus) { - // GetInputMethod() recreates the input method if it's previously been - // destroyed. If we get called during destruction, the input method will be - // gone, and creating a new one and telling it that we lost the focus will - // trigger a DCHECK (the new input method doesn't think that we have the - // focus and doesn't expect a blur). OnBlur() shouldn't be called during - // destruction unless WIDGET_OWNS_NATIVE_WIDGET is set (which is just the - // case in tests). - if (!destroying_) { - if (GetWidget()->GetInputMethod()) - GetWidget()->GetInputMethod()->OnBlur(); - } else { + if (destroying_) DCHECK_EQ(ownership_, Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); - } aura::client::FocusClient* client = aura::client::GetFocusClient(window_); if (client) // NULL during destruction of aura::Window. diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index 472ff9c..6785825 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -737,16 +737,10 @@ void NativeWidgetWin::HandleFrameChanged() { void NativeWidgetWin::HandleNativeFocus(HWND last_focused_window) { delegate_->OnNativeFocus(last_focused_window); - InputMethod* input_method = GetInputMethod(); - if (input_method) - input_method->OnFocus(); } void NativeWidgetWin::HandleNativeBlur(HWND focused_window) { delegate_->OnNativeBlur(focused_window); - InputMethod* input_method = GetInputMethod(); - if (input_method) - input_method->OnBlur(); } bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) { |