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

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

Issue 2612363004: Gtk3: Fix background colors (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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtkui/gtk_util.cc
diff --git a/chrome/browser/ui/libgtkui/gtk_util.cc b/chrome/browser/ui/libgtkui/gtk_util.cc
index 826af71dd3016bc2c85745439b350af735af74da..81fefa61d5249e56a8007adbb555deca41fcf528 100644
--- a/chrome/browser/ui/libgtkui/gtk_util.cc
+++ b/chrome/browser/ui/libgtkui/gtk_util.cc
@@ -394,6 +394,13 @@ class PixelSurface {
cairo_t* cairo_;
};
+void RenderBackground(cairo_t* cr, GtkStyleContext* context) {
+ if (!context)
+ return;
+ RenderBackground(cr, gtk_style_context_get_parent(context));
+ gtk_render_background(context, cr, 0, 0, 1, 1);
+}
+
SkColor GetBgColor(const char* css_selector) {
// Backgrounds are more general than solid colors (eg. gradients),
// but chromium requires us to boil this down to one color. We
@@ -404,7 +411,7 @@ SkColor GetBgColor(const char* css_selector) {
auto context = GetStyleContextFromCss(css_selector);
RemoveBorders(context);
PixelSurface surface;
- gtk_render_background(context, surface.cairo(), 0, 0, 1, 1);
+ RenderBackground(surface.cairo(), context);
return surface.GetPixelValue();
}
@@ -426,6 +433,7 @@ SkColor GetBorderColor(const char* css_selector) {
AddBorders(context);
PixelSurface surface;
+ RenderBackground(surface.cairo(), context);
gtk_render_frame(context, surface.cairo(), 0, 0, 1, 1);
return surface.GetPixelValue();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698