diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 16:20:49 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 16:20:49 +0000 |
commit | c06504a1ff40d8569a93b9898d9503f5f116ab0b (patch) | |
tree | 829eca8898cfd62c2a41baf95694bbc1a67ee9f5 /chrome/browser/autocomplete | |
parent | b535bf1e563f43dbc5d60307a425a6766b98d00b (diff) | |
download | chromium_src-c06504a1ff40d8569a93b9898d9503f5f116ab0b.zip chromium_src-c06504a1ff40d8569a93b9898d9503f5f116ab0b.tar.gz chromium_src-c06504a1ff40d8569a93b9898d9503f5f116ab0b.tar.bz2 |
GTK: Set the selection colors on the omnibox.
This prevents GTK theme colors from bleeding into the omnibox.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/1605026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index b74ec0a..e193736 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -27,6 +27,7 @@ #include "chrome/common/notification_service.h" #include "gfx/font.h" #include "gfx/gtk_util.h" +#include "gfx/skia_utils_gtk.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "net/base/escape.h" @@ -41,6 +42,8 @@ #include "chrome/browser/gtk/location_bar_view_gtk.h" #endif +using gfx::SkColorToGdkColor; + namespace { const char kTextBaseColor[] = "#808080"; @@ -597,6 +600,10 @@ void AutocompleteEditViewGtk::SetBaseColor() { if (use_gtk) { gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_base(text_view_, GTK_STATE_SELECTED, NULL); + gtk_widget_modify_text(text_view_, GTK_STATE_SELECTED, NULL); + gtk_widget_modify_base(text_view_, GTK_STATE_ACTIVE, NULL); + gtk_widget_modify_text(text_view_, GTK_STATE_ACTIVE, NULL); // Grab the text colors out of the style and set our tags to use them. GtkStyle* style = gtk_rc_get_style(text_view_); @@ -621,6 +628,23 @@ void AutocompleteEditViewGtk::SetBaseColor() { #endif gtk_widget_modify_base(text_view_, GTK_STATE_NORMAL, background_color_ptr); +#if !defined(TOOLKIT_VIEWS) + // Override the selected colors so we don't leak colors from the current + // gtk theme into the chrome-theme. + GdkColor c; + c = SkColorToGdkColor(theme_provider_->get_active_selection_bg_color()); + gtk_widget_modify_base(text_view_, GTK_STATE_SELECTED, &c); + + c = SkColorToGdkColor(theme_provider_->get_active_selection_fg_color()); + gtk_widget_modify_text(text_view_, GTK_STATE_SELECTED, &c); + + c = SkColorToGdkColor(theme_provider_->get_inactive_selection_bg_color()); + gtk_widget_modify_base(text_view_, GTK_STATE_ACTIVE, &c); + + c = SkColorToGdkColor(theme_provider_->get_inactive_selection_fg_color()); + gtk_widget_modify_text(text_view_, GTK_STATE_ACTIVE, &c); +#endif + g_object_set(faded_text_tag_, "foreground", kTextBaseColor, NULL); g_object_set(normal_text_tag_, "foreground", "#000000", NULL); } |