From d758fe54ef98fd399a1e974c9856288811b5bd1e Mon Sep 17 00:00:00 2001 From: "tc@google.com" Date: Tue, 19 May 2009 18:27:17 +0000 Subject: Take 2 at forcing the foreground and background color of the omnibox text. I used a static for the black text tag, but we need a separate instance per omnibox (one per browser window). BUG=11450 Review URL: http://codereview.chromium.org/115521 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16393 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 14 +++++++++++++- chrome/browser/autocomplete/autocomplete_edit_view_gtk.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'chrome') diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index 4e6be71..272e5ab 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -89,6 +89,9 @@ void AutocompleteEditViewGtk::Init() { text_view_ = gtk_text_view_new_with_buffer(text_buffer_); // Until we switch to vector graphics, force the font size. gtk_util::ForceFontSizePixels(text_view_, 13.4); // 13.4px == 10pt @ 96dpi + // Override the background color for now. http://crbug.com/12195 + gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL, + &LocationBarViewGtk::kBackgroundColorByLevel[scheme_security_level_]); // The text view was floating. It will now be owned by the alignment. gtk_container_add(GTK_CONTAINER(alignment_.get()), text_view_); @@ -104,6 +107,8 @@ void AutocompleteEditViewGtk::Init() { NULL, "foreground", kSecureSchemeColor, NULL); insecure_scheme_tag_ = gtk_text_buffer_create_tag(text_buffer_, NULL, "foreground", kInsecureSchemeColor, NULL); + black_text_tag_ = gtk_text_buffer_create_tag(text_buffer_, + NULL, "foreground", "#000000", NULL); // NOTE: This code used to connect to "changed", however this was fired too // often and during bad times (our own buffer changes?). It works out much @@ -524,7 +529,14 @@ void AutocompleteEditViewGtk::EmphasizeURLComponents() { gtk_text_buffer_get_iter_at_line_index(text_buffer_, &end, 0, GetUTF8Offset(text, parts.host.end())); - gtk_text_buffer_remove_all_tags(text_buffer_, &start, &end); + // The following forces the text color to black. When we start obeying the + // user theme, we want to remove_all_tags (to get the user's default + // text color) rather than applying a color tag. http://crbug.com/12195 + gtk_text_buffer_apply_tag(text_buffer_, black_text_tag_, &start, &end); + } else { + // For now, force the text color to be black. Eventually, we should allow + // the user to override via gtk theming. http://crbug.com/12195 + gtk_text_buffer_apply_tag(text_buffer_, black_text_tag_, &start, &end); } // Emphasize the scheme for security UI display purposes (if necessary). diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h index 637cd87..80bb192 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h @@ -198,6 +198,7 @@ class AutocompleteEditViewGtk : public AutocompleteEditView { GtkTextTag* base_tag_; GtkTextTag* secure_scheme_tag_; GtkTextTag* insecure_scheme_tag_; + GtkTextTag* black_text_tag_; scoped_ptr model_; scoped_ptr popup_view_; -- cgit v1.1