[gtk/wip/matthiasc/css-values: 21/23] css: Mark the default style in debug dumps



commit ab85bb761117c6d0b3bcffc86b6d791b0481eb59
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 ad2415d43c..0952c8b99f 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]