diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-09 20:11:39 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-09 20:11:39 +0000 |
commit | efba8d707b56c019f6d1d13a22285d0a39850fa4 (patch) | |
tree | 217f2161c2b9d3674d445500f4171f9d4ffe6ccd /chrome/common/gtk_util.cc | |
parent | 5cd4d0d559ea23eb56604bae8de670e2c663c1f7 (diff) | |
download | chromium_src-efba8d707b56c019f6d1d13a22285d0a39850fa4.zip chromium_src-efba8d707b56c019f6d1d13a22285d0a39850fa4.tar.gz chromium_src-efba8d707b56c019f6d1d13a22285d0a39850fa4.tar.bz2 |
linux: theme scrollbars from GTK theme
Pick the color of the slider's thumbpart and rail from the GTK theme.
We cannot match the exact visual appearance of the GTK theme, as
rendering engines can make arbitrary changes to the actual visual
appearance. But by sampling a representative set of pixels, we ensure
that we will at least match the general color scheme.
BUG=10949
patch by <markus [at] chromium>
original review: http://codereview.chromium.org/400027/show
Review URL: http://codereview.chromium.org/466080
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gtk_util.cc')
-rw-r--r-- | chrome/common/gtk_util.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index c6c08e4..5c9f870 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -13,6 +13,7 @@ #include "app/resource_bundle.h" #include "base/linux_util.h" #include "base/logging.h" +#include "chrome/browser/gtk/gtk_theme_provider.h" #include "chrome/common/renderer_preferences.h" #include "grit/theme_resources.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -418,7 +419,8 @@ GtkWidget* IndentWidget(GtkWidget* content) { return content_alignment; } -void InitRendererPrefsFromGtkSettings(RendererPreferences* prefs) { +void InitRendererPrefsFromGtkSettings(RendererPreferences* prefs, + bool use_gtk_theme) { DCHECK(prefs); gint antialias = 0; @@ -475,6 +477,24 @@ void InitRendererPrefsFromGtkSettings(RendererPreferences* prefs) { prefs->focus_ring_color = SkColorSetRGB(color.red / 257, color.green / 257, color.blue / 257); + GdkColor thumb_active_color, thumb_inactive_color, track_color; + GtkThemeProvider::GetScrollbarColors(&thumb_active_color, + &thumb_inactive_color, + &track_color, + use_gtk_theme); + prefs->thumb_active_color = + SkColorSetRGB(thumb_active_color.red / 257, + thumb_active_color.green / 257, + thumb_active_color.blue / 257); + prefs->thumb_inactive_color = + SkColorSetRGB(thumb_inactive_color.red / 257, + thumb_inactive_color.green / 257, + thumb_inactive_color.blue / 257); + prefs->track_color = + SkColorSetRGB(track_color.red / 257, + track_color.green / 257, + track_color.blue / 257); + if (hint_style) g_free(hint_style); if (rgba_style) |