[gtk+/wip/cssnode3: 24/46] cssnode: Track pending changes here



commit da0514e3906925855b6884bad464f3e5dcafb40c
Author: Benjamin Otte <otte redhat com>
Date:   Tue Feb 3 15:36:01 2015 +0100

    cssnode: Track pending changes here
    
    ... instead of GtkCssWidgetNode.

 gtk/gtkcssnode.c              |    5 +++++
 gtk/gtkcssnodeprivate.h       |    4 +++-
 gtk/gtkcsswidgetnode.c        |   13 -------------
 gtk/gtkcsswidgetnodeprivate.h |    2 --
 4 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 4248451..34bc5e7 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -531,6 +531,8 @@ void
 gtk_css_node_invalidate (GtkCssNode   *cssnode,
                          GtkCssChange  change)
 {
+  cssnode->pending_changes |= change;
+
   GTK_CSS_NODE_GET_CLASS (cssnode)->invalidate (cssnode, change);
 
   gtk_css_node_set_invalid (cssnode, TRUE);
@@ -565,6 +567,9 @@ gtk_css_node_validate (GtkCssNode            *cssnode,
 
   gtk_css_node_set_invalid (cssnode, FALSE);
 
+  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);
diff --git a/gtk/gtkcssnodeprivate.h b/gtk/gtkcssnodeprivate.h
index 15afd6c..7d6cbed 100644
--- a/gtk/gtkcssnodeprivate.h
+++ b/gtk/gtkcssnodeprivate.h
@@ -47,7 +47,9 @@ struct _GtkCssNode
   GtkCssNodeDeclaration *decl;
   GtkCssStyle           *style;
 
-  guint                  invalid :1;    /* set if node or a child is invalid */
+  GtkCssChange           pending_changes;       /* changes that accumulated since the style was last 
computed */
+
+  guint                  invalid :1;            /* set if node or a child is invalid */
 };
 
 struct _GtkCssNodeClass
diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c
index 8c9a271..0f7e870 100644
--- a/gtk/gtkcsswidgetnode.c
+++ b/gtk/gtkcsswidgetnode.c
@@ -32,15 +32,6 @@
 G_DEFINE_TYPE (GtkCssWidgetNode, gtk_css_widget_node, GTK_TYPE_CSS_NODE)
 
 static void
-gtk_css_widget_node_invalidate (GtkCssNode   *node,
-                                GtkCssChange  change)
-{
-  GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
-
-  widget_node->pending_changes |= change;
-}
-
-static void
 gtk_css_widget_node_set_invalid (GtkCssNode *node,
                                  gboolean    invalid)
 {
@@ -86,9 +77,6 @@ gtk_css_widget_node_validate (GtkCssNode       *node,
   GtkBitmask *changes;
   GtkCssStyle *style;
 
-  change |= widget_node->pending_changes;
-  widget_node->pending_changes = 0;
-
   if (widget_node->widget == NULL)
     return _gtk_bitmask_new ();
 
@@ -218,7 +206,6 @@ gtk_css_widget_node_class_init (GtkCssWidgetNodeClass *klass)
 {
   GtkCssNodeClass *node_class = GTK_CSS_NODE_CLASS (klass);
 
-  node_class->invalidate = gtk_css_widget_node_invalidate;
   node_class->validate = gtk_css_widget_node_validate;
   node_class->set_invalid = gtk_css_widget_node_set_invalid;
   node_class->create_widget_path = gtk_css_widget_node_create_widget_path;
diff --git a/gtk/gtkcsswidgetnodeprivate.h b/gtk/gtkcsswidgetnodeprivate.h
index d34becc..a3a59c8 100644
--- a/gtk/gtkcsswidgetnodeprivate.h
+++ b/gtk/gtkcsswidgetnodeprivate.h
@@ -38,8 +38,6 @@ struct _GtkCssWidgetNode
   GtkCssNode node;
 
   GtkWidget *widget;
-
-  GtkCssChange pending_changes;
 };
 
 struct _GtkCssWidgetNodeClass


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]