cssnode: Only queue_validate() when node is visible

This avoids running animations in hidden toplevels.
This commit is contained in:
Benjamin Otte 2015-07-10 21:34:41 +02:00
parent adcb52e82b
commit 190f025f74

View File

@ -67,17 +67,20 @@ gtk_css_node_set_invalid (GtkCssNode *node,
node->invalid = invalid;
if (node->parent)
if (node->visible)
{
if (invalid && node->visible)
gtk_css_node_set_invalid (node->parent, TRUE);
}
else
{
if (invalid)
GTK_CSS_NODE_GET_CLASS (node)->queue_validate (node);
if (node->parent)
{
if (invalid)
gtk_css_node_set_invalid (node->parent, TRUE);
}
else
GTK_CSS_NODE_GET_CLASS (node)->dequeue_validate (node);
{
if (invalid)
GTK_CSS_NODE_GET_CLASS (node)->queue_validate (node);
else
GTK_CSS_NODE_GET_CLASS (node)->dequeue_validate (node);
}
}
}
@ -896,6 +899,22 @@ gtk_css_node_set_visible (GtkCssNode *cssnode,
cssnode->visible = visible;
g_object_notify_by_pspec (G_OBJECT (cssnode), cssnode_properties[PROP_VISIBLE]);
if (cssnode->invalid)
{
if (cssnode->visible)
{
if (cssnode->parent)
gtk_css_node_set_invalid (cssnode->parent, TRUE);
else
GTK_CSS_NODE_GET_CLASS (cssnode)->queue_validate (cssnode);
}
else
{
if (cssnode->parent == NULL)
GTK_CSS_NODE_GET_CLASS (cssnode)->dequeue_validate (cssnode);
}
}
if (cssnode->next_sibling)
gtk_css_node_invalidate (cssnode->next_sibling, GTK_CSS_CHANGE_ANY_SIBLING
| GTK_CSS_CHANGE_NTH_CHILD