[gtk+/wip/cssnode3: 78/91] cssnode: Change the way we invalidate timestamps



commit 6365dca7c27f8ea2f46f94d239eb1f8256eb62ab
Author: Benjamin Otte <otte redhat com>
Date:   Sat Feb 28 02:22:38 2015 +0100

    cssnode: Change the way we invalidate timestamps
    
    Do not propagate the TIMESTAMP change through the node tree, as that
    causes lots of uneeded markings of nodes as invalid.
    
    Instead, walk the node tree and find the nodes that have a non-static
    style and only invalidate timestamps on those.

 gtk/gtkcssnode.c |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 297068b..547cfb9 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -841,6 +841,23 @@ gtk_css_node_invalidate_style_provider (GtkCssNode *cssnode)
     }
 }
 
+static void
+gtk_css_node_invalidate_timestamp (GtkCssNode *cssnode)
+{
+  GtkCssNode *child;
+
+  if (!cssnode->invalid)
+    return;
+
+  if (!gtk_css_style_is_static (cssnode->style))
+    gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_TIMESTAMP);
+
+  for (child = cssnode->first_child; child; child = child->next_sibling)
+    {
+      gtk_css_node_invalidate_timestamp (child);
+    }
+}
+
 void
 gtk_css_node_invalidate_frame_clock (GtkCssNode *cssnode,
                                      gboolean    just_timestamp)
@@ -849,10 +866,10 @@ gtk_css_node_invalidate_frame_clock (GtkCssNode *cssnode,
   if (cssnode->parent)
     return;
 
-  if (just_timestamp)
-    gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_TIMESTAMP);
-  else
-    gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_TIMESTAMP | GTK_CSS_CHANGE_ANIMATIONS);
+  gtk_css_node_invalidate_timestamp (cssnode);
+
+  if (!just_timestamp)
+    gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_ANIMATIONS);
 }
 
 void


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