From 830e2069f5c67d74cd4f2720438ea6a9609994c3 Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Fri, 13 Feb 2009 18:27:38 +0000 Subject: Don't focus unfocusable things. Review URL: http://codereview.chromium.org/20348 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9765 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/views/base_button.cc | 3 +-- chrome/views/menu_button.cc | 3 +-- chrome/views/native_button.cc | 3 +-- chrome/views/view.cc | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) (limited to 'chrome/views') diff --git a/chrome/views/base_button.cc b/chrome/views/base_button.cc index bd4987b..bea0c2f 100644 --- a/chrome/views/base_button.cc +++ b/chrome/views/base_button.cc @@ -147,8 +147,7 @@ bool BaseButton::OnMousePressed(const MouseEvent& e) { if (IsTriggerableEvent(e) && HitTest(e.location())) { SetState(BS_PUSHED); } - if (IsFocusable()) - RequestFocus(); + RequestFocus(); } return true; } diff --git a/chrome/views/menu_button.cc b/chrome/views/menu_button.cc index 0b696ff..ff0400a 100644 --- a/chrome/views/menu_button.cc +++ b/chrome/views/menu_button.cc @@ -180,8 +180,7 @@ bool MenuButton::Activate() { } bool MenuButton::OnMousePressed(const MouseEvent& e) { - if (IsFocusable()) - RequestFocus(); + RequestFocus(); if (GetState() != BS_DISABLED) { // If we're draggable (GetDragOperations returns a non-zero value), then // don't pop on press, instead wait for release. diff --git a/chrome/views/native_button.cc b/chrome/views/native_button.cc index 00aea52..d6db326 100644 --- a/chrome/views/native_button.cc +++ b/chrome/views/native_button.cc @@ -191,8 +191,7 @@ void NativeButton::Init(const std::wstring& label, bool is_default) { void NativeButton::Clicked() { DCHECK(enabled_); // Give the focus to the button. - if (IsFocusable()) - RequestFocus(); + RequestFocus(); if (listener_) listener_->ButtonPressed(this); diff --git a/chrome/views/view.cc b/chrome/views/view.cc index 3a06c3b..59e5b73 100644 --- a/chrome/views/view.cc +++ b/chrome/views/view.cc @@ -1372,9 +1372,8 @@ bool View::IsVisibleInRootView() const { void View::RequestFocus() { RootView* rv = GetRootView(); - if (rv) { + if (rv && IsFocusable()) rv->FocusView(this); - } } void View::WillGainFocus() { -- cgit v1.1