[gtk+/wip/cssnode3: 31/46] cssnode: Refactor invalidation propagation
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssnode3: 31/46] cssnode: Refactor invalidation propagation
- Date: Tue, 10 Feb 2015 01:57:43 +0000 (UTC)
commit c1b369e8d4bebf2ba5f90ab0b969805f76f6fa97
Author: Benjamin Otte <otte redhat com>
Date: Sun Feb 8 12:15:27 2015 +0100
cssnode: Refactor invalidation propagation
We want to be sure to gtk_css_node_invalidate() all potential changes.
gtk/gtkcontainer.c | 1 -
gtk/gtkcssnode.c | 29 ++++++++++++++++++++++++-----
gtk/gtkcssnodeprivate.h | 1 -
gtk/gtkwindow.c | 1 -
4 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 186f89d..6dc69b8 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 7a00c51..fccc43e 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -627,12 +627,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;
@@ -654,20 +673,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 e0f60e5..25e4cfa 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 a7548da..d5cdb4f 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5789,7 +5789,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]