[gtk+/gtk-3-6] Exit early in gtk_style_context_update_cache codepaths



commit 1bbb7555f0efe5bc10fc1ec909934984d9f792cc
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Nov 9 10:15:23 2012 +0100

    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.
    (cherry picked from commit 55d65571f37d3f6428e418c4e8bc4171c24a9741)
    
    Conflicts:
    	gtk/gtkstylecontext.c

 gtk/gtkcssprovider.c  |    3 +++
 gtk/gtkstylecontext.c |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 9fffd6b..75b5e3a 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 a6b7369..8fd6f6f 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2962,6 +2962,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);
@@ -2978,7 +2981,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);
     }
 }
 



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