mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-10 04:30:11 +00:00
css: Fix animations
Determine whether the style needs recomputation, then recompute the style, and then set the values from keyframes, so we don't end up overwriting keyframe changes by recomputing properties from their original values. Fixes: #6807
This commit is contained in:
parent
0b57bd5a53
commit
9948e0a564
@ -132,6 +132,29 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
|||||||
gtk_css_variable_value_unref (value);
|
gtk_css_variable_value_unref (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now deal with color */
|
||||||
|
for (i = 0; i < _gtk_css_keyframes_get_n_properties (resolved_keyframes); i++)
|
||||||
|
{
|
||||||
|
GtkCssValue *value;
|
||||||
|
guint property_id;
|
||||||
|
|
||||||
|
property_id = _gtk_css_keyframes_get_property_id (resolved_keyframes, i);
|
||||||
|
if (property_id != GTK_CSS_PROPERTY_COLOR)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
value = _gtk_css_keyframes_get_value (resolved_keyframes,
|
||||||
|
i,
|
||||||
|
progress,
|
||||||
|
gtk_css_animated_style_get_intrinsic_value (style, property_id));
|
||||||
|
gtk_css_animated_style_set_animated_value (style, property_id, value);
|
||||||
|
|
||||||
|
change |= GTK_CSS_ANIMATION_CHANGE_COLOR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (change != 0)
|
||||||
|
gtk_css_animated_style_recompute (style, change);
|
||||||
|
|
||||||
for (i = 0; i < _gtk_css_keyframes_get_n_properties (resolved_keyframes); i++)
|
for (i = 0; i < _gtk_css_keyframes_get_n_properties (resolved_keyframes); i++)
|
||||||
{
|
{
|
||||||
GtkCssValue *value;
|
GtkCssValue *value;
|
||||||
@ -144,14 +167,8 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
|||||||
progress,
|
progress,
|
||||||
gtk_css_animated_style_get_intrinsic_value (style, property_id));
|
gtk_css_animated_style_get_intrinsic_value (style, property_id));
|
||||||
gtk_css_animated_style_set_animated_value (style, property_id, value);
|
gtk_css_animated_style_set_animated_value (style, property_id, value);
|
||||||
|
|
||||||
if (property_id == GTK_CSS_PROPERTY_COLOR)
|
|
||||||
change |= GTK_CSS_ANIMATION_CHANGE_COLOR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change != 0)
|
|
||||||
gtk_css_animated_style_recompute (style, change);
|
|
||||||
|
|
||||||
_gtk_css_keyframes_unref (resolved_keyframes);
|
_gtk_css_keyframes_unref (resolved_keyframes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user