summaryrefslogtreecommitdiff
path: root/gtk/gtkcssnode.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-10-10 21:54:53 +0200
committerTimm Bäder <mail@baedert.org>2017-10-11 07:35:09 +0200
commitabed139a5901738a24c00d835c395b70ebfd4571 (patch)
tree5730be475a62adc8719c9c8e1f031b3cdfd6e035 /gtk/gtkcssnode.c
parent5d86d209e9a8e059f94aee4bf38ca9b345523dc1 (diff)
downloadgtk+-abed139a5901738a24c00d835c395b70ebfd4571.tar.gz
cssnode: Delay getting the parent style until we need it
There's an early return before. Look at all those saved cycles.
Diffstat (limited to 'gtk/gtkcssnode.c')
-rw-r--r--gtk/gtkcssnode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 94139cd510..95a687ffac 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,