[gtk/wip/matthiasc/css-change: 20/27] css: Mark the default style in debug dumps



commit 04fa4b15fe2be049d112586f18d513ea125949d8
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 15 00:58:56 2020 -0500

    css: Mark the default style in debug dumps
    
    This helps identifying unexpected situations,
    since the default style should never be seen
    in the wild.

 gtk/gtkcssstyle.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index d6ff5cbb84..effc2fb4d3 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -126,11 +126,17 @@ gtk_css_style_print (GtkCssStyle *style,
                      gboolean     skip_initial)
 {
   guint i;
+  GtkCssStyle *default_style;
   gboolean retval = FALSE;
 
   g_return_val_if_fail (GTK_IS_CSS_STYLE (style), FALSE);
   g_return_val_if_fail (string != NULL, FALSE);
 
+  default_style = gtk_css_static_style_get_default ();
+
+  if (style == default_style)
+    g_string_append_printf (string, "%*sDEFAULT STYLE\n", indent, "");
+
   for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
     {
       GtkCssSection *section;
@@ -143,7 +149,6 @@ gtk_css_style_print (GtkCssStyle *style,
       if (skip_initial)
         { 
           GtkCssValue *initial = _gtk_css_style_property_get_initial_value (prop);
-          GtkCssStyle *default_style = gtk_css_static_style_get_default ();
           GtkCssValue *computed = _gtk_css_value_compute (initial, i,
                                                           GTK_STYLE_PROVIDER (gtk_settings_get_default ()),
                                                           default_style,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]