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

Unified Diff: chrome/browser/ui/libgtkui/native_theme_gtk3.cc

Issue 2626373003: Gtk3: Fix link color in 3.12 and later (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtkui/native_theme_gtk3.cc
diff --git a/chrome/browser/ui/libgtkui/native_theme_gtk3.cc b/chrome/browser/ui/libgtkui/native_theme_gtk3.cc
index 9b2254946d84451d3f4ef7f37bd7189696b1bc74..4f02e634dd5e8c09454ea34a226b3b6a2fa55f8d 100644
--- a/chrome/browser/ui/libgtkui/native_theme_gtk3.cc
+++ b/chrome/browser/ui/libgtkui/native_theme_gtk3.cc
@@ -121,21 +121,30 @@ SkColor SkColorFromColorId(ui::NativeTheme::ColorId color_id) {
return SkColorSetA(
SkColorFromColorId(ui::NativeTheme::kColorId_LinkEnabled), 0xBB);
case ui::NativeTheme::kColorId_LinkPressed:
+ if (GtkVersionCheck(3, 12))
+ return GetFgColor("GtkLabel#label.link:link:hover:active");
+ // fallthrough
case ui::NativeTheme::kColorId_LinkEnabled: {
- // TODO(thomasanderson): Gtk changed the way links are colored in 3.12.
- // Add code for later versions.
+ if (GtkVersionCheck(3, 12)) {
+ return GetFgColor("GtkLabel#label.link:link");
+ }
auto link_context = GetStyleContextFromCss("GtkLabel#label.view");
GdkColor* color;
gtk_style_context_get_style(link_context, "link-color", &color, nullptr);
if (color) {
SkColor ret_color = SkColorSetRGB(color->red / 255, color->green / 255,
color->blue / 255);
+ // gdk_color_free() was deprecated in Gtk3.14. This code path is only
+ // taken on versions earlier than Gtk3.12, but the compiler doesn't know
+ // that, so silence the deprecation warnings.
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gdk_color_free(color);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
return ret_color;
- } else {
- // Default color comes from gtklinkbutton.c.
- return SkColorSetRGB(0x00, 0x00, 0xEE);
}
+
+ // Default color comes from gtklinkbutton.c.
+ return SkColorSetRGB(0x00, 0x00, 0xEE);
}
// Separator
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698