static GtkBitmask * gtk_css_transition_set_values (GtkStyleAnimation *animation, GtkBitmask *changed, gint64 for_time_us, GtkCssComputedValues *values) { GtkCssTransition *transition = GTK_CSS_TRANSITION (animation); GtkCssValue *value; double progress; if (transition->start_time >= for_time_us) value = _gtk_css_value_ref (transition->start); else if (transition->end_time <= for_time_us) value = _gtk_css_value_ref (transition->end); else { progress = (double) (for_time_us - transition->start_time) / (transition->end_time - transition->start_time); progress = _gtk_css_ease_value_transform (transition->ease, progress); value = _gtk_css_value_transition (transition->start, transition->end, progress); if (value == NULL) value = _gtk_css_value_ref (transition->end); } _gtk_css_computed_values_set_value (values, transition->property, value, NULL); _gtk_css_value_unref (value); return _gtk_bitmask_set (changed, transition->property, TRUE); }
void _gtk_css_computed_values_compute_value (GtkCssComputedValues *values, GtkStyleProviderPrivate *provider, GtkCssComputedValues *parent_values, guint id, GtkCssValue *specified, GtkCssSection *section) { GtkCssDependencies dependencies; GtkCssValue *value; gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values)); gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider)); gtk_internal_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values)); /* http://www.w3.org/TR/css3-cascade/#cascade * Then, for every element, the value for each property can be found * by following this pseudo-algorithm: * 1) Identify all declarations that apply to the element */ if (specified == NULL) { GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (id); if (_gtk_css_style_property_is_inherit (prop)) specified = _gtk_css_inherit_value_new (); else specified = _gtk_css_initial_value_new (); } else _gtk_css_value_ref (specified); value = _gtk_css_value_compute (specified, id, provider, values, parent_values, &dependencies); _gtk_css_computed_values_set_value (values, id, value, dependencies, section); _gtk_css_value_unref (value); _gtk_css_value_unref (specified); }