diff options
author | Benjamin Otte <otte@redhat.com> | 2015-02-08 12:15:27 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2015-03-18 15:23:30 +0100 |
commit | 28043f0a9211fd7b2523030c7944995050cf93ec (patch) | |
tree | e1ca1a4cc739afe9cefcdde037ffe936e3abbde8 /gtk | |
parent | efda30c4956c129d975727d8ec658567b5195582 (diff) | |
download | gtk+-28043f0a9211fd7b2523030c7944995050cf93ec.tar.gz |
cssnode: Refactor invalidation propagation
We want to be sure to gtk_css_node_invalidate() all potential changes.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcontainer.c | 1 | ||||
-rw-r--r-- | gtk/gtkcssnode.c | 29 | ||||
-rw-r--r-- | gtk/gtkcssnodeprivate.h | 1 | ||||
-rw-r--r-- | gtk/gtkwindow.c | 1 |
4 files changed, 24 insertions, 8 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 186f89db08..6dc69b8c49 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -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); diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c index 9d7c0cbc76..36a108f16a 100644 --- a/gtk/gtkcssnode.c +++ b/gtk/gtkcssnode.c @@ -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); diff --git a/gtk/gtkcssnodeprivate.h b/gtk/gtkcssnodeprivate.h index e0f60e5b66..25e4cfa5ba 100644 --- a/gtk/gtkcssnodeprivate.h +++ b/gtk/gtkcssnodeprivate.h @@ -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); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 32a3b2c1f7..14d4723218 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -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); |