Commit 28043f0a authored by Benjamin Otte's avatar Benjamin Otte

cssnode: Refactor invalidation propagation

We want to be sure to gtk_css_node_invalidate() all potential changes.
parent efda30c4
......@@ -1855,7 +1855,6 @@ gtk_container_idle_sizer (GdkFrameClock *clock,
container->priv->restyle_pending = FALSE;
gtk_css_node_validate (gtk_style_context_get_root (gtk_widget_get_style_context (GTK_WIDGET (container))),
current_time,
0,
empty);
_gtk_bitmask_free (empty);
......
......@@ -628,12 +628,31 @@ gtk_css_node_invalidate (GtkCssNode *cssnode,
gtk_css_node_set_invalid (cssnode, TRUE);
}
static void
gtk_css_node_propagate_pending_changes (GtkCssNode *cssnode)
{
GtkCssChange change;
GtkCssNode *child;
if (!cssnode->invalid)
return;
change = _gtk_css_change_for_child (cssnode->pending_changes);
for (child = gtk_css_node_get_first_child (cssnode);
child;
child = gtk_css_node_get_next_sibling (child))
{
gtk_css_node_invalidate (child, change);
}
}
void
gtk_css_node_validate (GtkCssNode *cssnode,
gint64 timestamp,
GtkCssChange change,
const GtkBitmask *parent_changes)
{
GtkCssChange change;
GtkCssNode *child;
GtkBitmask *changes;
......@@ -655,20 +674,20 @@ gtk_css_node_validate (GtkCssNode *cssnode,
if (!cssnode->invalid && change == 0 && _gtk_bitmask_is_empty (parent_changes))
return;
gtk_css_node_propagate_pending_changes (cssnode);
gtk_css_node_set_invalid (cssnode, FALSE);
change |= cssnode->pending_changes;
change = cssnode->pending_changes;
cssnode->pending_changes = 0;
changes = GTK_CSS_NODE_GET_CLASS (cssnode)->validate (cssnode, timestamp, change, parent_changes);
change = _gtk_css_change_for_child (change);
for (child = gtk_css_node_get_first_child (cssnode);
child;
child = gtk_css_node_get_next_sibling (child))
{
gtk_css_node_validate (child, timestamp, change, changes);
gtk_css_node_validate (child, timestamp, changes);
}
_gtk_bitmask_free (changes);
......
......@@ -126,7 +126,6 @@ void gtk_css_node_invalidate (GtkCssNode *
GtkCssChange change);
void gtk_css_node_validate (GtkCssNode *cssnode,
gint64 timestamp,
GtkCssChange change,
const GtkBitmask *parent_changes);
void gtk_css_node_set_invalid (GtkCssNode *node,
gboolean invalid);
......
......@@ -5851,7 +5851,6 @@ gtk_window_show (GtkWidget *widget)
empty = _gtk_bitmask_new ();
gtk_css_node_validate (gtk_style_context_get_root (gtk_widget_get_style_context (widget)),
g_get_monotonic_time (),
0,
empty);
_gtk_bitmask_free (empty);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment