[gtk/matthiasc/css-change-tracking-4: 4/12] Add a way to dump css node change values
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/css-change-tracking-4: 4/12] Add a way to dump css node change values
- Date: Fri, 17 Jan 2020 22:27:13 +0000 (UTC)
commit 2ef96ec67480ac5f4c889b90c647fe8d8a7efc4b
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jan 13 19:18:31 2020 -0500
Add a way to dump css node change values
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 | 14 ++++++++++++++
gtk/gtkstylecontext.h | 3 ++-
2 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index b921b8ba73..957577fae1 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -19,6 +19,7 @@
#include "gtkcssnodeprivate.h"
+#include "gtkcssstaticstyleprivate.h"
#include "gtkcssanimatedstyleprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkintl.h"
@@ -1431,6 +1432,19 @@ 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;
+
+ if (!GTK_IS_CSS_STATIC_STYLE (style))
+ style = GTK_CSS_ANIMATED_STYLE (style)->style;
+
+ change = gtk_css_static_style_get_change (GTK_CSS_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)
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index b22bc106e6..c7c5b78c59 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]