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

Side by Side Diff: chrome/browser/ui/libgtkui/gtk_util.cc

Issue 2622773004: Gtk3: Allow theme authors to style Chromium widgets specially (Closed)
Patch Set: Remove dependent CL 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 unified diff | Download patch
« no previous file with comments | « no previous file | docs/linux_gtk_theme_integration.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/libgtkui/gtk_util.h" 5 #include "chrome/browser/ui/libgtkui/gtk_util.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <gdk/gdk.h> 8 #include <gdk/gdk.h>
9 #include <gdk/gdkx.h> 9 #include <gdk/gdkx.h>
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 state_flag = pseudo_class_entry.state_flag; 287 state_flag = pseudo_class_entry.state_flag;
288 break; 288 break;
289 } 289 }
290 } 290 }
291 state = static_cast<GtkStateFlags>(state | state_flag); 291 state = static_cast<GtkStateFlags>(state | state_flag);
292 break; 292 break;
293 } 293 }
294 } 294 }
295 } 295 }
296 } 296 }
297
298 // Always add a "chromium" class so that themes can style chromium
299 // widgets specially if they want to.
300 gtk_widget_path_iter_add_class(path, -1, "chromium");
301
297 auto child_context = ScopedStyleContext(gtk_style_context_new()); 302 auto child_context = ScopedStyleContext(gtk_style_context_new());
298 gtk_style_context_set_path(child_context, path); 303 gtk_style_context_set_path(child_context, path);
299 gtk_style_context_set_state(child_context, state); 304 gtk_style_context_set_state(child_context, state);
300 gtk_style_context_set_parent(child_context, context); 305 gtk_style_context_set_parent(child_context, context);
301 gtk_widget_path_unref(path); 306 gtk_widget_path_unref(path);
302 return child_context; 307 return child_context;
303 } 308 }
304 309
305 ScopedStyleContext GetStyleContextFromCss(const char* css_selector) { 310 ScopedStyleContext GetStyleContextFromCss(const char* css_selector) {
306 // Prepend "GtkWindow.background" to the selector since all widgets must live 311 // Prepend "GtkWindow.background" to the selector since all widgets must live
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 438
434 AddBorders(context); 439 AddBorders(context);
435 PixelSurface surface; 440 PixelSurface surface;
436 RenderBackground(surface.cairo(), context); 441 RenderBackground(surface.cairo(), context);
437 gtk_render_frame(context, surface.cairo(), 0, 0, 1, 1); 442 gtk_render_frame(context, surface.cairo(), 0, 0, 1, 1);
438 return surface.GetPixelValue(); 443 return surface.GetPixelValue();
439 } 444 }
440 #endif 445 #endif
441 446
442 } // namespace libgtkui 447 } // namespace libgtkui
OLDNEW
« no previous file with comments | « no previous file | docs/linux_gtk_theme_integration.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698