GtkStyleContext: Avoid over-eager animation cancellation

When validating the style context, we are copying the animations
from one StyleValues instance to another, and cancel the old ones.
It turns out that sometimes the old and the new StyleValues are
the same, and in this case, we end up cancelling the animations
for good.

One case where breakage from this was observed is that the spinners
in gtk3-widget-factory stop spinning when you open and close a modal
dialog on page 2. This depends a bit on the window manager; the problem
can only be seen if opening the dialog causes a transition to backdrop.
This commit is contained in:
Matthias Clasen
2014-06-29 19:33:46 -04:00
parent 3d53e5d9c7
commit 9f008e3477

View File

@ -3058,12 +3058,13 @@ _gtk_style_context_validate (GtkStyleContext *context,
values = style_values_lookup (context);
_gtk_css_computed_values_create_animations (values,
priv->parent ? style_values_lookup (priv->parent) : NULL,
timestamp,
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
priv->scale,
gtk_style_context_should_create_transitions (context) ? current : NULL);
if (values != current)
_gtk_css_computed_values_create_animations (values,
priv->parent ? style_values_lookup (priv->parent) : NULL,
timestamp,
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
priv->scale,
gtk_style_context_should_create_transitions (context) ? current : NULL);
if (_gtk_css_computed_values_is_static (values))
change &= ~GTK_CSS_CHANGE_ANIMATE;
else
@ -3075,7 +3076,8 @@ _gtk_style_context_validate (GtkStyleContext *context,
changes = _gtk_css_computed_values_get_difference (values, current);
/* In the case where we keep the cache, we want unanimated values */
_gtk_css_computed_values_cancel_animations (current);
if (values != current)
_gtk_css_computed_values_cancel_animations (current);
}
else
{