[gtk+/wip/cssvalue: 136/142] stylecontext: Split out a function



commit 9bc22050493b6e4ef7a70a0e82cccfe4027f56ec
Author: Benjamin Otte <otte redhat com>
Date:   Sat Apr 7 10:53:43 2012 +0200

    stylecontext: Split out a function

 gtk/gtkstylecontext.c |   40 +++++++++++++++++++++++-----------------
 1 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index cbb806d..21e981c 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2759,8 +2759,23 @@ gtk_style_context_pop_animatable_region (GtkStyleContext *context)
 }
 
 static void
-gtk_style_context_do_invalidate (GtkStyleContext *context,
-                                 gboolean         clear_caches)
+gtk_style_context_clear_cache (GtkStyleContext *context)
+{
+  GtkStyleContextPrivate *priv;
+  GSList *list;
+
+  priv = context->priv;
+
+  for (list = priv->info_stack; list; list = list->next)
+    {
+      GtkStyleInfo *info = list->data;
+      info->data = NULL;
+    }
+  g_hash_table_remove_all (priv->style_data);
+}
+
+static void
+gtk_style_context_do_invalidate (GtkStyleContext *context)
 {
   GtkStyleContextPrivate *priv;
 
@@ -2774,18 +2789,6 @@ gtk_style_context_do_invalidate (GtkStyleContext *context,
 
   priv->invalidating_context = TRUE;
 
-  if (clear_caches)
-    {
-      GSList *list;
-
-      for (list = priv->info_stack; list; list = list->next)
-        {
-          GtkStyleInfo *info = list->data;
-          info->data = NULL;
-        }
-      g_hash_table_remove_all (priv->style_data);
-    }
-
   g_signal_emit (context, signals[CHANGED], 0);
 
   priv->invalidating_context = FALSE;
@@ -2836,10 +2839,12 @@ _gtk_style_context_validate (GtkStyleContext *context,
   if (priv->relevant_changes & change)
     {
       GtkStyleInfo *info = priv->info_stack->data;
-      gboolean clear_cache = ((priv->relevant_changes & change) & ~GTK_STYLE_CONTEXT_CACHED_CHANGE) != 0;
+
+      if ((priv->relevant_changes & change) & ~GTK_STYLE_CONTEXT_CACHED_CHANGE)
+        gtk_style_context_clear_cache (context);
 
       info->data = NULL;
-      gtk_style_context_do_invalidate (context, clear_cache);
+      gtk_style_context_do_invalidate (context);
     }
 
   change = _gtk_css_change_for_child (change);
@@ -2885,7 +2890,8 @@ gtk_style_context_invalidate (GtkStyleContext *context)
 {
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
 
-  gtk_style_context_do_invalidate (context, TRUE);
+  gtk_style_context_clear_cache (context);
+  gtk_style_context_do_invalidate (context);
 }
 
 /**



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