diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-03 20:58:01 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-03 20:58:01 +0000 |
commit | a071e653c8e2b9b77c412600c3d35de814541527 (patch) | |
tree | 4f6edf175b8090a8140d511b72ae0879fbacfec2 /chrome/browser/views/find_bar_view.cc | |
parent | d78f40f3543cd057d845625d1abce9cd79b0682c (diff) | |
download | chromium_src-a071e653c8e2b9b77c412600c3d35de814541527.zip chromium_src-a071e653c8e2b9b77c412600c3d35de814541527.tar.gz chromium_src-a071e653c8e2b9b77c412600c3d35de814541527.tar.bz2 |
Fix 9867: Activating the previous/next buttons with the keyboard in the find bar should not change the focus.
Add param const Event& event to ButtonPressed, so that recipients can find out more about the event that generated the ButtonPress message.
BUG=9687
TEST=Open www.google.com and open Find-in-page, search for 'e'. Press FindNext button with mouse and note that the focus should be on the textfield. Now press Tab twice to put focus on the FindNext button and press SpaceBar a few times. Note that the focus should stay on the FindNext button.
Review URL: http://codereview.chromium.org/188016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25367 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/find_bar_view.cc')
-rw-r--r-- | chrome/browser/views/find_bar_view.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc index da1acd1..857869c 100644 --- a/chrome/browser/views/find_bar_view.cc +++ b/chrome/browser/views/find_bar_view.cc @@ -406,7 +406,8 @@ gfx::Size FindBarView::GetPreferredSize() { //////////////////////////////////////////////////////////////////////////////// // FindBarView, views::ButtonListener implementation: -void FindBarView::ButtonPressed(views::Button* sender) { +void FindBarView::ButtonPressed( + views::Button* sender, const views::Event& event) { switch (sender->tag()) { case FIND_PREVIOUS_TAG: case FIND_NEXT_TAG: @@ -416,11 +417,14 @@ void FindBarView::ButtonPressed(views::Button* sender) { sender->tag() == FIND_NEXT_TAG, false); // Not case sensitive. } - // Move the focus back to the text-field, we don't want the button - // focused. - // TODO(jcampan): http://crbug.com/9867 we should not change the focus - // when teh button was pressed by pressing a key. - find_text_->RequestFocus(); + if (event.IsMouseEvent()) { + // If mouse event, we move the focus back to the text-field, so that the + // user doesn't have to click on the text field to change the search. We + // don't want to do this for keyboard clicks on the button, since the + // user is more likely to press FindNext again than change the search + // query. + find_text_->RequestFocus(); + } break; case CLOSE_TAG: container_->GetFindBarController()->EndFindSession(); |