Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9091)

Unified Diff: chrome/browser/ui/views/find_bar_view.cc

Issue 8221027: Make views::Label and views::Link auto-color themselves to be readable over their background colo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/find_bar_view.cc
===================================================================
--- chrome/browser/ui/views/find_bar_view.cc (revision 104959)
+++ chrome/browser/ui/views/find_bar_view.cc (working copy)
@@ -89,7 +89,6 @@
match_count_text_ = new views::Label();
match_count_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont));
- match_count_text_->SetColor(kTextColorMatchCount);
match_count_text_->SetHorizontalAlignment(views::Label::ALIGN_CENTER);
AddChildView(match_count_text_);
@@ -183,22 +182,20 @@
find_text_->SelectAll();
}
- if (!find_text.empty() && have_valid_range) {
- match_count_text_->SetText(
- l10n_util::GetStringFUTF16(IDS_FIND_IN_PAGE_COUNT,
- base::IntToString16(result.active_match_ordinal()),
- base::IntToString16(result.number_of_matches())));
-
- UpdateMatchCountAppearance(result.number_of_matches() == 0 &&
- result.final_update());
- } else {
+ if (find_text.empty() || !have_valid_range) {
// If there was no text entered, we don't show anything in the result count
// area.
- match_count_text_->SetText(string16());
-
- UpdateMatchCountAppearance(false);
+ ClearMatchCount();
+ return;
}
+ match_count_text_->SetText(l10n_util::GetStringFUTF16(IDS_FIND_IN_PAGE_COUNT,
+ base::IntToString16(result.active_match_ordinal()),
+ base::IntToString16(result.number_of_matches())));
+
+ UpdateMatchCountAppearance(result.number_of_matches() == 0 &&
+ result.final_update());
+
// The match_count label may have increased/decreased in size so we need to
// do a layout and repaint the dialog so that the find text field doesn't
// partially overlap the match-count label when it increases on no matches.
@@ -454,12 +451,14 @@
if (no_match) {
match_count_text_->set_background(
views::Background::CreateSolidBackground(kBackgroundColorNoMatch));
- match_count_text_->SetColor(kTextColorNoMatch);
+ match_count_text_->SetEnabledColor(kTextColorNoMatch);
} else {
match_count_text_->set_background(
views::Background::CreateSolidBackground(kBackgroundColorMatch));
- match_count_text_->SetColor(kTextColorMatchCount);
+ match_count_text_->SetEnabledColor(kTextColorMatchCount);
}
+ match_count_text_->SetBackgroundColor(
+ match_count_text_->background()->get_color());
}
bool FindBarView::FocusForwarderView::OnMousePressed(
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_install_dialog_view.cc ('k') | chrome/browser/ui/views/first_run_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698