Add a way to dump css node change values
authorMatthias Clasen <mclasen@redhat.com>
Tue, 14 Jan 2020 00:18:31 +0000 (19:18 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 18 Jan 2020 04:47:34 +0000 (23:47 -0500)
Add a GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE flag that
tells gtk_style_context_to_string to include the
change values of nodes in the output. This will
help debugging css change tracking.

gtk/gtkcssnode.c
gtk/gtkstylecontext.h

index ad3b707f60163014be1ddddb52dd0e4c68703bd4..4fe350d5ffc83309a59d256f9fa9cc34d88afc01 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "gtkcssnodeprivate.h"
 
+#include "gtkcssstaticstyleprivate.h"
 #include "gtkcssanimatedstyleprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkintl.h"
@@ -1436,6 +1437,16 @@ gtk_css_node_print (GtkCssNode                *cssnode,
   if (!cssnode->visible)
     g_string_append_c (string, ']');
 
+  if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE)
+    {
+      GtkCssStyle *style = gtk_css_node_get_style (cssnode);
+      GtkCssChange change;
+
+      change = gtk_css_static_style_get_change (gtk_css_style_get_static_style (style));
+      g_string_append (string, "    ");
+      gtk_css_change_print (change, string); 
+    }
+
   g_string_append_c (string, '\n');
 
   if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE)
index b22bc106e633d6781fb5e5f184540c1d63499a9d..c7c5b78c59cd438a17c59f3412b75ae98f9efa98 100644 (file)
@@ -1053,7 +1053,8 @@ void        gtk_render_insertion_cursor
 typedef enum {
   GTK_STYLE_CONTEXT_PRINT_NONE         = 0,
   GTK_STYLE_CONTEXT_PRINT_RECURSE      = 1 << 0,
-  GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE   = 1 << 1
+  GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE   = 1 << 1,
+  GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE  = 1 << 2
 } GtkStyleContextPrintFlags;
 
 GDK_AVAILABLE_IN_ALL