Commit 980923c7 authored by Benjamin Otte's avatar Benjamin Otte

cssanimatedstyle: Merge two functions

parent 0bab285f
...@@ -119,20 +119,6 @@ gtk_css_animated_style_init (GtkCssAnimatedStyle *style) ...@@ -119,20 +119,6 @@ gtk_css_animated_style_init (GtkCssAnimatedStyle *style)
{ {
} }
GtkCssStyle *
gtk_css_animated_style_new (GtkCssStyle *style)
{
GtkCssAnimatedStyle *result;
g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
result = g_object_new (GTK_TYPE_CSS_ANIMATED_STYLE, NULL);
result->style = g_object_ref (style);
return GTK_CSS_STYLE (result);
}
void void
gtk_css_animated_style_set_animated_value (GtkCssAnimatedStyle *style, gtk_css_animated_style_set_animated_value (GtkCssAnimatedStyle *style,
guint id, guint id,
...@@ -398,17 +384,30 @@ gtk_css_animated_style_create_css_animations (GtkCssAnimatedStyle *style, ...@@ -398,17 +384,30 @@ gtk_css_animated_style_create_css_animations (GtkCssAnimatedStyle *style,
/* PUBLIC API */ /* PUBLIC API */
void GtkCssStyle *
gtk_css_animated_style_create_animations (GtkCssAnimatedStyle *style, gtk_css_animated_style_new (GtkCssStyle *base_style,
GtkCssStyle *parent_style, GtkCssStyle *parent_style,
gint64 timestamp, gint64 timestamp,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, int scale,
GtkCssStyle *source) GtkCssStyle *previous_style)
{ {
if (source != NULL) GtkCssAnimatedStyle *result;
gtk_css_animated_style_create_css_transitions (style, timestamp, source);
gtk_css_animated_style_create_css_animations (style, parent_style, timestamp, provider, scale, source); gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base_style), NULL);
gtk_internal_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
gtk_internal_return_val_if_fail (previous_style == NULL || GTK_IS_CSS_STYLE (previous_style), NULL);
result = g_object_new (GTK_TYPE_CSS_ANIMATED_STYLE, NULL);
result->style = g_object_ref (base_style);
if (previous_style != NULL)
gtk_css_animated_style_create_css_transitions (result, timestamp, previous_style);
gtk_css_animated_style_create_css_animations (result, parent_style, timestamp, provider, scale, previous_style);
return GTK_CSS_STYLE (result);
} }
GtkBitmask * GtkBitmask *
......
...@@ -52,7 +52,12 @@ struct _GtkCssAnimatedStyleClass ...@@ -52,7 +52,12 @@ struct _GtkCssAnimatedStyleClass
GType gtk_css_animated_style_get_type (void) G_GNUC_CONST; GType gtk_css_animated_style_get_type (void) G_GNUC_CONST;
GtkCssStyle * gtk_css_animated_style_new (GtkCssStyle *style); GtkCssStyle * gtk_css_animated_style_new (GtkCssStyle *base_style,
GtkCssStyle *parent_style,
gint64 timestamp,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *previous_style);
void gtk_css_animated_style_set_animated_value(GtkCssAnimatedStyle *style, void gtk_css_animated_style_set_animated_value(GtkCssAnimatedStyle *style,
guint id, guint id,
...@@ -61,12 +66,6 @@ void gtk_css_animated_style_set_animated_value(GtkCssAnimated ...@@ -61,12 +66,6 @@ void gtk_css_animated_style_set_animated_value(GtkCssAnimated
GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style, GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
guint id); guint id);
void gtk_css_animated_style_create_animations(GtkCssAnimatedStyle *style,
GtkCssStyle *parent_style,
gint64 timestamp,
GtkStyleProviderPrivate*provider,
int scale,
GtkCssStyle *source);
GtkBitmask * gtk_css_animated_style_advance (GtkCssAnimatedStyle *style, GtkBitmask * gtk_css_animated_style_advance (GtkCssAnimatedStyle *style,
gint64 timestamp); gint64 timestamp);
void gtk_css_animated_style_cancel_animations(GtkCssAnimatedStyle *style); void gtk_css_animated_style_cancel_animations(GtkCssAnimatedStyle *style);
......
...@@ -2838,17 +2838,14 @@ _gtk_style_context_validate (GtkStyleContext *context, ...@@ -2838,17 +2838,14 @@ _gtk_style_context_validate (GtkStyleContext *context,
style_info_set_values (info, NULL); style_info_set_values (info, NULL);
values = style_values_lookup (context); values = style_values_lookup (context);
values = gtk_css_animated_style_new (values);
values = gtk_css_animated_style_new (values,
if (values != current) priv->parent ? style_values_lookup (priv->parent) : NULL,
gtk_css_animated_style_create_animations (GTK_CSS_ANIMATED_STYLE (values), timestamp,
priv->parent ? style_values_lookup (priv->parent) : NULL, GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
timestamp, priv->scale,
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade), gtk_style_context_should_create_transitions (context) ? current : NULL);
priv->scale,
gtk_style_context_should_create_transitions (context)
? current
: NULL);
if (gtk_css_animated_style_is_static (GTK_CSS_ANIMATED_STYLE (values))) if (gtk_css_animated_style_is_static (GTK_CSS_ANIMATED_STYLE (values)))
{ {
change &= ~GTK_CSS_CHANGE_ANIMATE; change &= ~GTK_CSS_CHANGE_ANIMATE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment