summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/find_bar_view.cc
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-06 00:34:57 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-06 00:34:57 +0000
commitf9c75df7fc8d1f93e9a1d1eb059496c3f8eeb6a0 (patch)
tree840c82fcbf9d78f7558dc7403c155fdbb5bc2318 /chrome/browser/views/find_bar_view.cc
parent1cfd24a00abbccb9cb979e55dc695a967698a935 (diff)
downloadchromium_src-f9c75df7fc8d1f93e9a1d1eb059496c3f8eeb6a0.zip
chromium_src-f9c75df7fc8d1f93e9a1d1eb059496c3f8eeb6a0.tar.gz
chromium_src-f9c75df7fc8d1f93e9a1d1eb059496c3f8eeb6a0.tar.bz2
Fixing two small regressions in the Find box:
1) If the Find textfield is populated when the Find box is shown, the FindPrevious and FindNext buttons should also be enabled. (issue 8369) 2) If you search for something that is not on the page, you get "0 of 0" in red. Press Esc and Ctrl+F and the label is gone but the red background color for the label remains (no bug on file, found during testing). BUG=8369 TEST=Open about:blank in Chrome. Press Ctrl+F, search for 'e' (get 0 of 0), close the Find box, reopen the Find box. Observe 'e' is in box, it is highlighted and no red is visible. Also, FindPrevious and FindNext buttons should be enabled. Review URL: http://codereview.chromium.org/39233 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11063 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/find_bar_view.cc')
-rw-r--r--chrome/browser/views/find_bar_view.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc
index aa59cf9..45616b1 100644
--- a/chrome/browser/views/find_bar_view.cc
+++ b/chrome/browser/views/find_bar_view.cc
@@ -214,9 +214,12 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result,
match_count_text_->SetText(std::wstring());
}
- if (search_string.empty() || result.number_of_matches() > 0) {
+ if (search_string.empty() || result.number_of_matches() > 0 ||
+ !have_valid_range) {
// If there was no text entered or there were results, the match_count label
- // should have a normal background color.
+ // should have a normal background color. We also reset the background if
+ // we don't have_valid_range, so that the text field will not show red
+ // background when reopened after an unsuccessful find.
ResetMatchCountBackground();
} else if (result.final_update()) {
// Otherwise we show an error background behind the match_count label.
@@ -235,7 +238,12 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result,
void FindBarView::SetFocusAndSelection() {
find_text_->RequestFocus();
- find_text_->SelectAll();
+ if (!find_text_->GetText().empty()) {
+ find_text_->SelectAll();
+
+ find_previous_button_->SetEnabled(true);
+ find_next_button_->SetEnabled(true);
+ }
}
///////////////////////////////////////////////////////////////////////////////