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

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

Issue 2855063002: Gtk3: Add background class to tooltips (Closed)
Patch Set: Rebase Created 3 years, 8 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.h ('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 d393e54751642e486d901807409d8e4b359eea97..ef2cc34c7fe695812f23226037fb38c26977a1a2 100644
--- a/chrome/browser/ui/libgtkui/native_theme_gtk3.cc
+++ b/chrome/browser/ui/libgtkui/native_theme_gtk3.cc
@@ -38,6 +38,12 @@ std::string GetGtkSettingsStringProperty(GtkSettings* settings,
return prop_value;
}
+ScopedStyleContext GetTooltipContext() {
+ return AppendCssNodeToStyleContext(
+ nullptr, GtkVersionCheck(3, 20) ? "#tooltip.background"
+ : "GtkWindow#window.background.tooltip");
+}
+
SkBitmap GetWidgetBitmap(const gfx::Size& size,
GtkStyleContext* context,
BackgroundRenderMode bg_mode,
@@ -240,9 +246,12 @@ SkColor SkColorFromColorId(ui::NativeTheme::ColorId color_id) {
// Tooltips
case ui::NativeTheme::kColorId_TooltipBackground:
- return GetBgColor("GtkTooltip#tooltip");
- case ui::NativeTheme::kColorId_TooltipText:
- return GetFgColor("GtkTooltip#tooltip GtkLabel");
+ return GetBgColorFromStyleContext(GetTooltipContext());
+ case ui::NativeTheme::kColorId_TooltipText: {
+ auto context = GetTooltipContext();
+ context = AppendCssNodeToStyleContext(context, "GtkLabel");
+ return GetFgColorFromStyleContext(context);
+ }
// Trees and Tables (implemented on GTK using the same class)
case ui::NativeTheme::kColorId_TableBackground:
@@ -406,7 +415,6 @@ NativeThemeGtk3::NativeThemeGtk3() {
g_type_class_unref(g_type_class_ref(gtk_separator_get_type()));
g_type_class_unref(g_type_class_ref(gtk_spinner_get_type()));
g_type_class_unref(g_type_class_ref(gtk_text_view_get_type()));
- g_type_class_unref(g_type_class_ref(gtk_tooltip_get_type()));
g_type_class_unref(g_type_class_ref(gtk_tree_view_get_type()));
g_type_class_unref(g_type_class_ref(gtk_window_get_type()));
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698