From 55d65571f37d3f6428e418c4e8bc4171c24a9741 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 9 Nov 2012 10:15:23 +0100 Subject: [PATCH] Exit early in gtk_style_context_update_cache codepaths If lookup->missing is empty we don't need to continue looking. We short circuit in several places as this can happen after iteratively makeign lookup->missing smaller. --- gtk/gtkcssprovider.c | 3 +++ gtk/gtkstylecontext.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index 6f9e758f0..fbf997095 100644 --- a/gtk/gtkcssprovider.c +++ b/gtk/gtkcssprovider.c @@ -1603,6 +1603,9 @@ gtk_css_style_provider_lookup (GtkStyleProviderPrivate *provider, ruleset->styles[j].section, ruleset->styles[j].value); } + + if (_gtk_bitmask_is_empty (_gtk_css_lookup_get_missing (lookup))) + break; } } diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 33776d285..c0253a499 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -2943,6 +2943,9 @@ gtk_style_context_update_cache (GtkStyleContext *context, GHashTableIter iter; gpointer key, value; + if (_gtk_bitmask_is_empty (parent_changes)) + return; + priv = context->priv; g_hash_table_iter_init (&iter, priv->style_data); @@ -2959,7 +2962,8 @@ gtk_style_context_update_cache (GtkStyleContext *context, if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_FONT_SIZE)) changes = _gtk_bitmask_union (changes, data->store->depends_on_font_size); - build_properties (context, data->store, info, changes); + if (!_gtk_bitmask_is_empty (changes)) + build_properties (context, data->store, info, changes); _gtk_bitmask_free (changes); } -- 2.43.2