summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-09-13 14:25:52 +0200
committerBenjamin Otte <otte@redhat.com>2012-09-17 20:39:12 +0200
commit94a3bd21e5c21f32420f9deb2eb794fde8b66564 (patch)
tree12bdb0b56867baea5e727fc0091d9132d1c6ceef
parent89d6d34bee77d12252a333836ef3800c0a098844 (diff)
downloadgtk+-94a3bd21e5c21f32420f9deb2eb794fde8b66564.tar.gz
csscomputedvalues: Allow storing animated values here
It's not used yet, but that will come in the next patch(es). This is a separate patch to make sure we didn't mess up anything.
-rw-r--r--gtk/gtkcsscomputedvalues.c40
-rw-r--r--gtk/gtkcsscomputedvaluesprivate.h6
2 files changed, 45 insertions, 1 deletions
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c
index 7f651a9558..ea44341ad9 100644
--- a/gtk/gtkcsscomputedvalues.c
+++ b/gtk/gtkcsscomputedvalues.c
@@ -42,6 +42,11 @@ gtk_css_computed_values_dispose (GObject *object)
g_ptr_array_unref (values->sections);
values->sections = NULL;
}
+ if (values->animated_values)
+ {
+ g_ptr_array_unref (values->animated_values);
+ values->animated_values = NULL;
+ }
G_OBJECT_CLASS (_gtk_css_computed_values_parent_class)->dispose (object);
}
@@ -127,7 +132,26 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
_gtk_css_value_unref (value);
_gtk_css_value_unref (specified);
}
-
+
+void
+_gtk_css_computed_values_set_animated_value (GtkCssComputedValues *values,
+ guint id,
+ GtkCssValue *value)
+{
+ g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
+ g_return_if_fail (value != NULL);
+
+ if (values->animated_values == NULL)
+ values->animated_values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref);
+ if (id >= values->animated_values->len)
+ g_ptr_array_set_size (values->animated_values, id + 1);
+
+ if (g_ptr_array_index (values->animated_values, id))
+ _gtk_css_value_unref (g_ptr_array_index (values->animated_values, id));
+ g_ptr_array_index (values->animated_values, id) = _gtk_css_value_ref (value);
+
+}
+
void
_gtk_css_computed_values_set_value (GtkCssComputedValues *values,
guint id,
@@ -172,6 +196,20 @@ _gtk_css_computed_values_get_value (GtkCssComputedValues *values,
{
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+ if (values->animated_values &&
+ id < values->animated_values->len &&
+ g_ptr_array_index (values->animated_values, id))
+ return g_ptr_array_index (values->animated_values, id);
+
+ return _gtk_css_computed_values_get_intrinsic_value (values, id);
+}
+
+GtkCssValue *
+_gtk_css_computed_values_get_intrinsic_value (GtkCssComputedValues *values,
+ guint id)
+{
+ g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+
if (values->values == NULL ||
id >= values->values->len)
return NULL;
diff --git a/gtk/gtkcsscomputedvaluesprivate.h b/gtk/gtkcsscomputedvaluesprivate.h
index 799121b5ed..1ddc4a776e 100644
--- a/gtk/gtkcsscomputedvaluesprivate.h
+++ b/gtk/gtkcsscomputedvaluesprivate.h
@@ -45,6 +45,7 @@ struct _GtkCssComputedValues
GPtrArray *values;
GPtrArray *sections;
+ GPtrArray *animated_values;
GtkBitmask *depends_on_parent;
GtkBitmask *equals_parent;
GtkBitmask *depends_on_color;
@@ -70,11 +71,16 @@ void _gtk_css_computed_values_set_value (GtkCssCom
GtkCssValue *value,
GtkCssDependencies dependencies,
GtkCssSection *section);
+void _gtk_css_computed_values_set_animated_value (GtkCssComputedValues *values,
+ guint id,
+ GtkCssValue *value);
GtkCssValue * _gtk_css_computed_values_get_value (GtkCssComputedValues *values,
guint id);
GtkCssSection * _gtk_css_computed_values_get_section (GtkCssComputedValues *values,
guint id);
+GtkCssValue * _gtk_css_computed_values_get_intrinsic_value (GtkCssComputedValues *values,
+ guint id);
GtkBitmask * _gtk_css_computed_values_get_difference (GtkCssComputedValues *values,
GtkCssComputedValues *other);