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

@ -1075,10 +1075,24 @@ gtk_snapshot_append_node_internal (GtkSnapshot *snapshot,
current_state = gtk_snapshot_get_current_state (snapshot);
if (current_state)
{
if (gsk_render_node_get_node_type (node) == GSK_CONTAINER_NODE)
{
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
{
g_critical ("Tried appending a node to an already finished snapshot.");