summaryrefslogtreecommitdiff
path: root/gtk/gtkcssnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/gtkcssnode.c')
-rw-r--r--gtk/gtkcssnode.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 676d0b27a8..a5dda31a5c 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -1529,7 +1529,7 @@ gtk_css_node_print (GtkCssNode *cssnode,
GString *string,
guint indent)
{
- GtkCssNode *node;
+ gboolean need_newline = FALSE;
g_string_append_printf (string, "%*s", indent, "");
@@ -1544,10 +1544,15 @@ gtk_css_node_print (GtkCssNode *cssnode,
g_string_append_c (string, '\n');
if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE)
- gtk_css_style_print (gtk_css_node_get_style (cssnode), string, indent + 2, TRUE);
+ need_newline = gtk_css_style_print (gtk_css_node_get_style (cssnode), string, indent + 2, TRUE);
if (flags & GTK_STYLE_CONTEXT_PRINT_RECURSE)
{
+ GtkCssNode *node;
+
+ if (need_newline && gtk_css_node_get_first_child (cssnode))
+ g_string_append_c (string, '\n');
+
for (node = gtk_css_node_get_first_child (cssnode); node; node = gtk_css_node_get_next_sibling (node))
gtk_css_node_print (node, flags, string, indent + 2);
}