diff options
author | Alexander Larsson <alexl@redhat.com> | 2012-11-09 10:15:23 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2012-11-09 10:15:23 +0100 |
commit | 55d65571f37d3f6428e418c4e8bc4171c24a9741 (patch) | |
tree | dd9ddb39831c81a7085ad3c1bb191a5e155fef9f | |
parent | 77912a65e2aa6eb9cfee994fa93bbfbc6b9f8538 (diff) | |
download | gtk+-55d65571f37d3f6428e418c4e8bc4171c24a9741.tar.gz |
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.
-rw-r--r-- | gtk/gtkcssprovider.c | 3 | ||||
-rw-r--r-- | gtk/gtkstylecontext.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index 6f9e758f0d..fbf9970950 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 33776d285c..c0253a4993 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); } |