[gtk+/wip/css: 32/36] stylecontext: Clear animations for values kept in cache



commit 2382c60d9ff2b5ef32f7d3edbc12dbd96e084d96
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 17 10:53:16 2012 +0200

    stylecontext: Clear animations for values kept in cache

 gtk/gtkcsscomputedvalues.c        |   16 ++++++++++++++++
 gtk/gtkcsscomputedvaluesprivate.h |    1 +
 gtk/gtkstylecontext.c             |    2 ++
 3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c
index f271ddf..d8a33ba 100644
--- a/gtk/gtkcsscomputedvalues.c
+++ b/gtk/gtkcsscomputedvalues.c
@@ -568,3 +568,19 @@ _gtk_css_computed_values_is_static (GtkCssComputedValues *values)
 
   return TRUE;
 }
+
+void
+_gtk_css_computed_values_cancel_animations (GtkCssComputedValues *values)
+{
+  g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
+
+  if (values->animated_values)
+    {
+      g_ptr_array_unref (values->animated_values);
+      values->animated_values = NULL;
+    }
+
+  g_slist_free_full (values->animations, g_object_unref);
+  values->animations = NULL;
+}
+
diff --git a/gtk/gtkcsscomputedvaluesprivate.h b/gtk/gtkcsscomputedvaluesprivate.h
index 32b70bc..b9b7618 100644
--- a/gtk/gtkcsscomputedvaluesprivate.h
+++ b/gtk/gtkcsscomputedvaluesprivate.h
@@ -94,6 +94,7 @@ void                    _gtk_css_computed_values_create_animations    (GtkCssCom
                                                                        GtkStyleContext          *context);
 GtkBitmask *            _gtk_css_computed_values_advance              (GtkCssComputedValues     *values,
                                                                        gint64                    timestamp);
+void                    _gtk_css_computed_values_cancel_animations    (GtkCssComputedValues     *values);
 gboolean                _gtk_css_computed_values_is_static            (GtkCssComputedValues     *values);
 
 G_END_DECLS
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 79c8804..5c1f94a 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -3174,6 +3174,8 @@ _gtk_style_context_validate (GtkStyleContext  *context,
 
           changes = _gtk_css_computed_values_get_difference (data->store, current->store);
 
+          /* In the case where we keep the cache, we want unanimated values */
+          _gtk_css_computed_values_cancel_animations (current->store);
           style_data_unref (current);
         }
       else



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