summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 00:36:28 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 00:36:28 +0000
commit0714e9e0fbf563159a4e0f69cde0a4c6dfc653f5 (patch)
tree5eae2955615a26f748e2ec41bf3bd551313a8f92 /ui
parentfc5a2e233e6a2d0ade47974e6949d840f0c6b5fe (diff)
downloadchromium_src-0714e9e0fbf563159a4e0f69cde0a4c6dfc653f5.zip
chromium_src-0714e9e0fbf563159a4e0f69cde0a4c6dfc653f5.tar.gz
chromium_src-0714e9e0fbf563159a4e0f69cde0a4c6dfc653f5.tar.bz2
General Focus/Activation/Keyboard input fixes for Aura Desktop.
Saw these issues while running Chrome Aura in desktop mode. 1. Focus issues:- A. When desktop chrome is launched we set focus to the content window. This ensures that keystrokes like backspace, etc make it through to the omnibox if it has focus. B. When we click on the WebView focus should transition away reliably from the omnibox to the WebView. This was not happening because the DesktopActivationClient class which implements the ActivationClient interface returns false in its DesktopActivationClient::CanActivateWindow implementation where it only allows activation if the window is a child of the root window which is not the case for the HTML page WebView window. C. Clicking back on the omnibox when the page has focus caused a bug whereby both views ended up showing the blinking cursor. Keyboard focus was with the omnibox though. This was because we save away the last focused view in the aura::client::ActivationDelegate::OnLostActive notification which is too late in the process. The new view which is already focused by that point. Fix is to save away the focused view in the OnBlur notification which happens before the new window is activated. 2. Text field selection:- When we lose focus in a text field we should clear the selection. 3. Infinite loop while processing keyboard input:- The DesktopNativeWidgetAura::OnKeyEvent calls the GetWidget()->GetInputMethod()->DispatchKeyEvent function which causes the keyboard input to be sent back to the DesktopNativeWidgetAura::OnKeyEvent class which causes an infinite loop. We should pass the keyboard event to the underlying native widget delegate. BUG=none R=beng Review URL: https://codereview.chromium.org/11234015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163974 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/desktop/desktop_activation_client.cc3
-rw-r--r--ui/views/controls/textfield/native_textfield_views.cc2
-rw-r--r--ui/views/widget/desktop_native_widget_aura.cc8
-rw-r--r--ui/views/widget/desktop_root_window_host_win.cc1
4 files changed, 8 insertions, 6 deletions
diff --git a/ui/aura/desktop/desktop_activation_client.cc b/ui/aura/desktop/desktop_activation_client.cc
index 7219081..4699a50 100644
--- a/ui/aura/desktop/desktop_activation_client.cc
+++ b/ui/aura/desktop/desktop_activation_client.cc
@@ -122,8 +122,7 @@ bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const {
return window &&
window->IsVisible() &&
(!aura::client::GetActivationDelegate(window) ||
- aura::client::GetActivationDelegate(window)->ShouldActivate(NULL)) &&
- IsChildOfRootWindow(window);
+ aura::client::GetActivationDelegate(window)->ShouldActivate(NULL));
}
aura::Window* DesktopActivationClient::GetActivatableWindow(
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index bbecc17..02e4c49 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -560,6 +560,8 @@ void NativeTextfieldViews::HandleBlur() {
if (touch_selection_controller_.get())
touch_selection_controller_->ClientViewLostFocus();
+
+ ClearSelection();
}
ui::TextInputClient* NativeTextfieldViews::GetTextInputClient() {
diff --git a/ui/views/widget/desktop_native_widget_aura.cc b/ui/views/widget/desktop_native_widget_aura.cc
index 8a23d2e..0c14d74 100644
--- a/ui/views/widget/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_native_widget_aura.cc
@@ -418,6 +418,8 @@ void DesktopNativeWidgetAura::OnFocus(aura::Window* old_focused_window) {
}
void DesktopNativeWidgetAura::OnBlur() {
+ if (GetWidget()->HasFocusManager())
+ GetWidget()->GetFocusManager()->StoreFocusedView();
desktop_root_window_host_->OnNativeWidgetBlur();
native_widget_delegate_->OnNativeBlur(
window_->GetFocusManager()->GetFocusedWindow());
@@ -499,8 +501,8 @@ ui::EventResult DesktopNativeWidgetAura::OnKeyEvent(ui::KeyEvent* event) {
// and the window may be invisible by that time.
if (!window_->IsVisible())
return ui::ER_UNHANDLED;
- GetWidget()->GetInputMethod()->DispatchKeyEvent(*event);
- return ui::ER_HANDLED;
+ return native_widget_delegate_->OnKeyEvent(*event) ?
+ ui::ER_HANDLED : ui::ER_UNHANDLED;;
}
ui::EventResult DesktopNativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
@@ -549,8 +551,6 @@ void DesktopNativeWidgetAura::OnActivated() {
}
void DesktopNativeWidgetAura::OnLostActive() {
- if (GetWidget()->HasFocusManager())
- GetWidget()->GetFocusManager()->StoreFocusedView();
native_widget_delegate_->OnNativeWidgetActivationChanged(false);
if (IsVisible() && GetWidget()->non_client_view())
GetWidget()->non_client_view()->SchedulePaint();
diff --git a/ui/views/widget/desktop_root_window_host_win.cc b/ui/views/widget/desktop_root_window_host_win.cc
index 3a319b5..4cdaa67 100644
--- a/ui/views/widget/desktop_root_window_host_win.cc
+++ b/ui/views/widget/desktop_root_window_host_win.cc
@@ -114,6 +114,7 @@ aura::RootWindow* DesktopRootWindowHostWin::Init(
input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_);
root_window_event_filter_->AddFilter(input_method_filter_.get());
+ focus_manager_->SetFocusedWindow(content_window_, NULL);
return root_window_;
}