css: Make recomputing animated styles make more sense
When we look for what values need recomputing, we also determine what value we are going to use to recompute. For values that contain variables, that is the 'original' value, as returned by gtk_css_style_get_original_value. For values that we recompute because they may contain currentcolor, that is the specified value as returned by gtk_css_animated_style_get_intrinsic_value. The one issue here is that we currently don't preserve currentcolor in the computed value, so recomputing the value does not do us any good in the color case. That will be fixed separately.
This commit is contained in:
@@ -74,7 +74,6 @@ gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated, \
|
||||
GtkCssAnimationChange change) \
|
||||
{ \
|
||||
GtkCssStyle *style = (GtkCssStyle *)animated; \
|
||||
GtkCssValue **values = (GtkCssValue **)((guint8*)(animated->style->NAME) + sizeof (GtkCssValues)); \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < G_N_ELEMENTS (NAME ## _props); i++) \
|
||||
@@ -82,28 +81,31 @@ gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated, \
|
||||
guint id = NAME ## _props[i]; \
|
||||
GtkCssValue *original, *computed; \
|
||||
gboolean needs_recompute = FALSE; \
|
||||
\
|
||||
if (values[i] == NULL) \
|
||||
continue; \
|
||||
\
|
||||
original = gtk_css_style_get_original_value (style, id); \
|
||||
if (original == NULL) \
|
||||
continue; \
|
||||
\
|
||||
if ((change & GTK_CSS_ANIMATION_CHANGE_VARIABLES) && \
|
||||
original && \
|
||||
gtk_css_value_contains_variables (original)) \
|
||||
needs_recompute = TRUE; \
|
||||
{ \
|
||||
needs_recompute = TRUE; \
|
||||
} \
|
||||
\
|
||||
if ((change & GTK_CSS_ANIMATION_CHANGE_COLOR) && \
|
||||
property_has_color (id)) \
|
||||
needs_recompute = TRUE; \
|
||||
{ \
|
||||
needs_recompute = TRUE; \
|
||||
if (original == NULL) \
|
||||
original = gtk_css_animated_style_get_intrinsic_value (animated, id); \
|
||||
} \
|
||||
\
|
||||
if (!needs_recompute) \
|
||||
continue; \
|
||||
\
|
||||
computed = gtk_css_value_compute (original, \
|
||||
id, \
|
||||
context); \
|
||||
if (original == NULL) \
|
||||
continue; \
|
||||
\
|
||||
computed = gtk_css_value_compute (original, id, context); \
|
||||
if (computed == NULL) \
|
||||
continue; \
|
||||
\
|
||||
|
||||
Reference in New Issue
Block a user