[gtk+] cssnode: Delay getting the parent style until we need it



commit abed139a5901738a24c00d835c395b70ebfd4571
Author: Timm Bäder <mail baedert org>
Date:   Tue Oct 10 21:54:53 2017 +0200

    cssnode: Delay getting the parent style until we need it
    
    There's an early return before.
    
    Look at all those saved cycles.

 gtk/gtkcssnode.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 94139cd..95a687f 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -361,12 +361,13 @@ gtk_css_node_create_style (GtkCssNode *cssnode)
   GtkCssStyle *style;
 
   decl = gtk_css_node_get_declaration (cssnode);
-  parent = cssnode->parent ? cssnode->parent->style : NULL;
 
   style = lookup_in_global_parent_cache (cssnode, decl);
   if (style)
     return g_object_ref (style);
 
+  parent = cssnode->parent ? cssnode->parent->style : NULL;
+
   if (gtk_css_node_init_matcher (cssnode, &matcher))
     style = gtk_css_static_style_new_compute (gtk_css_node_get_style_provider (cssnode),
                                               &matcher,


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