diff options
author | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 03:34:48 +0000 |
---|---|---|
committer | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 03:34:48 +0000 |
commit | 4b6f2bd72042ee5906e5050432fd6059d86358c4 (patch) | |
tree | 19d250985be95dc3d0cdd5e63865d747125cc9b3 | |
parent | eabecbe43e7f5f238503383d481a01d39e4380cf (diff) | |
download | chromium_src-4b6f2bd72042ee5906e5050432fd6059d86358c4.zip chromium_src-4b6f2bd72042ee5906e5050432fd6059d86358c4.tar.gz chromium_src-4b6f2bd72042ee5906e5050432fd6059d86358c4.tar.bz2 |
Fix flashing issue when hitting escape while find bar is active.
When the View try's to focus to the last focused component, it can't, because ToolBarView is not Focusable, hence overriding IsFocusable will fix the flashing, but will create a focusable ring around the whole toolbar.
BUG=15228
TEST=ALT+SHIFT+T press left arrow until page menu, and select find in page. Press ESC numerous times, no more flashing issues for the find bar.
Review URL: http://codereview.chromium.org/265056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28789 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 14 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 8021553..1cdc877 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -648,6 +648,20 @@ void ToolbarView::WillLoseFocus() { GetWidget()->GetTooltipManager()->HideKeyboardTooltip(); } +void ToolbarView::RequestFocus() { + // When the toolbar needs to request focus, the default implementation of + // View::RequestFocus requires the View to be focusable. Since ToolbarView is + // not technically focused, we need to temporarily set and remove focus so + // that it can focus back to its MSAA focused state. + if (acc_focused_view_) { + SetFocusable(true); + View::RequestFocus(); + SetFocusable(false); + } else { + View::RequestFocus(); + } +} + bool ToolbarView::OnKeyPressed(const views::KeyEvent& e) { // Paranoia check, button should be initialized upon toolbar gaining focus. if (!acc_focused_view_) diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index f1ac12d..514265a 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -152,6 +152,7 @@ class ToolbarView : public views::View, virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture); virtual void DidGainFocus(); virtual void WillLoseFocus(); + virtual void RequestFocus(); virtual bool OnKeyPressed(const views::KeyEvent& e); virtual bool OnKeyReleased(const views::KeyEvent& e); virtual bool GetAccessibleName(std::wstring* name); |