diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 21:41:00 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 21:41:00 +0000 |
commit | 2d2dffc230e097791fc393da00b1cb6937488c12 (patch) | |
tree | 6c25eda664156428037589e672aa8f0c6ca4fffb /chrome | |
parent | 965c6974b0e9387384d4bd558b160a8feff35fd2 (diff) | |
download | chromium_src-2d2dffc230e097791fc393da00b1cb6937488c12.zip chromium_src-2d2dffc230e097791fc393da00b1cb6937488c12.tar.gz chromium_src-2d2dffc230e097791fc393da00b1cb6937488c12.tar.bz2 |
Fix 13570: Find box stops responding to browser window resize.
If you enter a search term and delete it, the Find box UI flag gets set as inactive and the box stops moving when the browser resizes. This fixes that.
BUG=13570
TEST=Open Find, press 'e', press Backspace, resize the window. The Find box should move.
Review URL: http://codereview.chromium.org/119383
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17980 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_win_browsertest.cc | 26 |
2 files changed, 30 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index a39f7eb..47b3eb2 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -970,7 +970,10 @@ void TabContents::StartFinding(string16 find_text, } void TabContents::StopFinding(bool clear_selection) { - find_ui_active_ = false; + // When |clear_selection| is true, it means the find string has been cleared + // by the user, but the UI has not been dismissed. + if (!clear_selection) + find_ui_active_ = false; find_op_aborted_ = true; last_search_result_ = FindNotificationDetails(); render_view_host()->StopFinding(clear_selection); diff --git a/chrome/browser/views/find_bar_win_browsertest.cc b/chrome/browser/views/find_bar_win_browsertest.cc index 98a8111..67b05ad 100644 --- a/chrome/browser/views/find_bar_win_browsertest.cc +++ b/chrome/browser/views/find_bar_win_browsertest.cc @@ -582,3 +582,29 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, AcceleratorRestoring) { // The accelerator for Escape should be back to what it was before. EXPECT_EQ(old_target, focus_manager->GetCurrentTargetForAccelerator(escape)); } + +// Make sure Find box does not become UI-inactive when no text is in the box as +// we switch to a tab contents with an empty find string. See issue 13570. +IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, StayActive) { + HTTPTestServer* server = StartHTTPServer(); + + // First we navigate to any page. + GURL url = server->TestServerPageW(kSimplePage); + ui_test_utils::NavigateToURL(browser(), url); + + // Open the Find window with animations disabled. + FindBarWin::disable_animations_during_testing_ = true; + browser()->ShowFindBar(); + + // Simulate a user clearing the search string. Ideally, we should be + // simulating keypresses here for searching for something and pressing + // backspace, but that's been proven flaky in the past, so we go straight to + // tab_contents. + TabContents* tab_contents = browser()->GetSelectedTabContents(); + // Stop the (non-existing) find operation, and clear the selection (which + // signals the UI is still active). + tab_contents->StopFinding(true); + // Make sure the Find UI flag hasn't been cleared, it must be so that the UI + // still responds to browser window resizing. + ASSERT_TRUE(tab_contents->find_ui_active()); +} |