stylecontext: Clear animations for values kept in cache

This commit is contained in:
Benjamin Otte 2012-09-17 10:53:16 +02:00
parent 37dac2a481
commit 13cbd22d17
3 changed files with 20 additions and 0 deletions

View File

@ -565,3 +565,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;
}

View File

@ -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

View File

@ -3173,6 +3173,9 @@ _gtk_style_context_validate (GtkStyleContext *context,
change |= GTK_CSS_CHANGE_ANIMATE;
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);
}
else
{