snapshot: merge container nodes

A container node inside another container node doesn't make a lot of
sense, we can instead just use the parent container node and add the
child container node's children to it directly.
This commit is contained in:
Timm Bäder 2018-05-01 21:18:51 +02:00
parent 2815054820
commit 622a150bb4

View File

@ -1076,8 +1076,22 @@ gtk_snapshot_append_node_internal (GtkSnapshot *snapshot,
if (current_state) if (current_state)
{ {
g_ptr_array_add (snapshot->nodes, gsk_render_node_ref (node)); if (gsk_render_node_get_node_type (node) == GSK_CONTAINER_NODE)
current_state->n_nodes ++; {
guint i, p;
for (i = 0, p = gsk_container_node_get_n_children (node); i < p; i ++)
g_ptr_array_add (snapshot->nodes,
gsk_render_node_ref (gsk_container_node_get_child (node, i)));
current_state->n_nodes += p;
/* Don't unref @node... */
}
else
{
g_ptr_array_add (snapshot->nodes, gsk_render_node_ref (node));
current_state->n_nodes ++;
}
} }
else else
{ {