[gtk/wip/otte/paintable: 46/62] css: Introduce the idea of dynamic values



commit 507dd3953f6a391906029706029b870d939f988e
Author: Benjamin Otte <otte redhat com>
Date:   Tue Feb 13 05:55:33 2018 +0100

    css: Introduce the idea of dynamic values
    
    Dynamic values are values that change their contents with the current
    (monotonic) time.
    
    This just introduces the GtkCssValue API for it.

 gtk/gtkcssarrayvalue.c          |  2 ++
 gtk/gtkcssbgsizevalue.c         |  2 ++
 gtk/gtkcssbordervalue.c         |  2 ++
 gtk/gtkcsscalcvalue.c           |  2 ++
 gtk/gtkcsscolorvalue.c          |  2 ++
 gtk/gtkcsscornervalue.c         |  2 ++
 gtk/gtkcssdimensionvalue.c      |  2 ++
 gtk/gtkcsseasevalue.c           |  2 ++
 gtk/gtkcssenumvalue.c           | 40 +++++++++++++++++++++++++++++++
 gtk/gtkcssfiltervalue.c         |  2 ++
 gtk/gtkcssfontfeaturesvalue.c   |  2 ++
 gtk/gtkcssfontvariationsvalue.c |  2 ++
 gtk/gtkcssiconthemevalue.c      |  2 ++
 gtk/gtkcssimagevalue.c          |  2 ++
 gtk/gtkcssinheritvalue.c        |  2 ++
 gtk/gtkcssinitialvalue.c        |  2 ++
 gtk/gtkcsspalettevalue.c        |  2 ++
 gtk/gtkcsspositionvalue.c       |  2 ++
 gtk/gtkcssrepeatvalue.c         |  4 ++++
 gtk/gtkcssrgbavalue.c           |  2 ++
 gtk/gtkcssshadowsvalue.c        |  2 ++
 gtk/gtkcssshadowvalue.c         |  2 ++
 gtk/gtkcssstringvalue.c         |  4 ++++
 gtk/gtkcsstransformvalue.c      |  2 ++
 gtk/gtkcssunsetvalue.c          |  2 ++
 gtk/gtkcssvalue.c               | 52 +++++++++++++++++++++++++++++++++++++++--
 gtk/gtkcssvalueprivate.h        | 12 ++++++++--
 gtk/gtkcsswin32sizevalue.c      |  2 ++
 28 files changed, 154 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c
index 27aab6f8c6..221632e059 100644
--- a/gtk/gtkcssarrayvalue.c
+++ b/gtk/gtkcssarrayvalue.c
@@ -323,6 +323,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_ARRAY = {
   gtk_css_value_array_compute,
   gtk_css_value_array_equal,
   gtk_css_value_array_transition,
+  NULL,
+  NULL,
   gtk_css_value_array_print
 };
 
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c
index ee7d94a0c9..5402f38fcb 100644
--- a/gtk/gtkcssbgsizevalue.c
+++ b/gtk/gtkcssbgsizevalue.c
@@ -157,6 +157,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
   gtk_css_value_bg_size_compute,
   gtk_css_value_bg_size_equal,
   gtk_css_value_bg_size_transition,
+  NULL,
+  NULL,
   gtk_css_value_bg_size_print
 };
 
diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c
index 0345ff1e9c..1efb5e9e16 100644
--- a/gtk/gtkcssbordervalue.c
+++ b/gtk/gtkcssbordervalue.c
@@ -144,6 +144,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_BORDER = {
   gtk_css_value_border_compute,
   gtk_css_value_border_equal,
   gtk_css_value_border_transition,
+  NULL,
+  NULL,
   gtk_css_value_border_print
 };
 
diff --git a/gtk/gtkcsscalcvalue.c b/gtk/gtkcsscalcvalue.c
index 0185aff6c7..d1a31d722e 100644
--- a/gtk/gtkcsscalcvalue.c
+++ b/gtk/gtkcsscalcvalue.c
@@ -249,6 +249,8 @@ static const GtkCssNumberValueClass GTK_CSS_VALUE_CALC = {
     gtk_css_value_calc_compute,
     gtk_css_value_calc_equal,
     gtk_css_number_value_transition,
+    NULL,
+    NULL,
     gtk_css_value_calc_print
   },
   gtk_css_value_calc_get,
diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c
index c1dce03810..a98f142d54 100644
--- a/gtk/gtkcsscolorvalue.c
+++ b/gtk/gtkcsscolorvalue.c
@@ -449,6 +449,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_COLOR = {
   gtk_css_value_color_compute,
   gtk_css_value_color_equal,
   gtk_css_value_color_transition,
+  NULL,
+  NULL,
   gtk_css_value_color_print
 };
 
diff --git a/gtk/gtkcsscornervalue.c b/gtk/gtkcsscornervalue.c
index 30864c8067..ec7a166f70 100644
--- a/gtk/gtkcsscornervalue.c
+++ b/gtk/gtkcsscornervalue.c
@@ -103,6 +103,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
   gtk_css_value_corner_compute,
   gtk_css_value_corner_equal,
   gtk_css_value_corner_transition,
+  NULL,
+  NULL,
   gtk_css_value_corner_print
 };
 
diff --git a/gtk/gtkcssdimensionvalue.c b/gtk/gtkcssdimensionvalue.c
index 648e61a4c6..c9c378e0cf 100644
--- a/gtk/gtkcssdimensionvalue.c
+++ b/gtk/gtkcssdimensionvalue.c
@@ -276,6 +276,8 @@ static const GtkCssNumberValueClass GTK_CSS_VALUE_DIMENSION = {
     gtk_css_value_dimension_compute,
     gtk_css_value_dimension_equal,
     gtk_css_number_value_transition,
+    NULL,
+    NULL,
     gtk_css_value_dimension_print
   },
   gtk_css_value_dimension_get,
diff --git a/gtk/gtkcsseasevalue.c b/gtk/gtkcsseasevalue.c
index 1c15d2423a..a9ab9dce40 100644
--- a/gtk/gtkcsseasevalue.c
+++ b/gtk/gtkcsseasevalue.c
@@ -139,6 +139,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_EASE = {
   gtk_css_value_ease_compute,
   gtk_css_value_ease_equal,
   gtk_css_value_ease_transition,
+  NULL,
+  NULL,
   gtk_css_value_ease_print
 };
 
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index d9f38dc257..4a6bbfc978 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -82,6 +82,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -137,6 +139,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_BLEND_MODE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -285,6 +289,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
   gtk_css_value_font_size_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -339,6 +345,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -451,6 +459,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
   gtk_css_value_font_weight_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_font_weight_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -524,6 +534,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_STRETCH = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -578,6 +590,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_LINE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -626,6 +640,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_TEXT_DECORATION_STYLE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -674,6 +690,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -728,6 +746,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -786,6 +806,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -839,6 +861,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -894,6 +918,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_ICON_STYLE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -948,6 +974,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_KERNING = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -1002,6 +1030,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_POSITION = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -1056,6 +1086,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_CAPS = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -1114,6 +1146,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_ALTERNATE = {
   gtk_css_value_enum_compute,
   gtk_css_value_enum_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_value_enum_print
 };
 
@@ -1225,6 +1259,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_LIGATURE = {
   gtk_css_value_enum_compute,
   gtk_css_value_flags_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_font_variant_ligature_value_print
 };
 
@@ -1329,6 +1365,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_NUMERIC = {
   gtk_css_value_enum_compute,
   gtk_css_value_flags_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_font_variant_numeric_value_print
 };
 
@@ -1430,6 +1468,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT_EAST_ASIAN = {
   gtk_css_value_enum_compute,
   gtk_css_value_flags_equal,
   gtk_css_value_enum_transition,
+  NULL,
+  NULL,
   gtk_css_font_variant_east_asian_value_print
 };
 
diff --git a/gtk/gtkcssfiltervalue.c b/gtk/gtkcssfiltervalue.c
index 92472e3fa3..4f73e239a7 100644
--- a/gtk/gtkcssfiltervalue.c
+++ b/gtk/gtkcssfiltervalue.c
@@ -697,6 +697,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FILTER = {
   gtk_css_value_filter_compute,
   gtk_css_value_filter_equal,
   gtk_css_value_filter_transition,
+  NULL,
+  NULL,
   gtk_css_value_filter_print
 };
 
diff --git a/gtk/gtkcssfontfeaturesvalue.c b/gtk/gtkcssfontfeaturesvalue.c
index 29a389ae70..8fb5728268 100644
--- a/gtk/gtkcssfontfeaturesvalue.c
+++ b/gtk/gtkcssfontfeaturesvalue.c
@@ -181,6 +181,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_FEATURES = {
   gtk_css_value_font_features_compute,
   gtk_css_value_font_features_equal,
   gtk_css_value_font_features_transition,
+  NULL,
+  NULL,
   gtk_css_value_font_features_print
 };
 
diff --git a/gtk/gtkcssfontvariationsvalue.c b/gtk/gtkcssfontvariationsvalue.c
index 7cc5ccd766..b073dd40d3 100644
--- a/gtk/gtkcssfontvariationsvalue.c
+++ b/gtk/gtkcssfontvariationsvalue.c
@@ -180,6 +180,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIATIONS = {
   gtk_css_value_font_variations_compute,
   gtk_css_value_font_variations_equal,
   gtk_css_value_font_variations_transition,
+  NULL,
+  NULL,
   gtk_css_value_font_variations_print
 };
 
diff --git a/gtk/gtkcssiconthemevalue.c b/gtk/gtkcssiconthemevalue.c
index aafd3f46b9..82e70775d0 100644
--- a/gtk/gtkcssiconthemevalue.c
+++ b/gtk/gtkcssiconthemevalue.c
@@ -115,6 +115,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_ICON_THEME = {
   gtk_css_value_icon_theme_compute,
   gtk_css_value_icon_theme_equal,
   gtk_css_value_icon_theme_transition,
+  NULL,
+  NULL,
   gtk_css_value_icon_theme_print
 };
 
diff --git a/gtk/gtkcssimagevalue.c b/gtk/gtkcssimagevalue.c
index 413117f5a8..1b674a332b 100644
--- a/gtk/gtkcssimagevalue.c
+++ b/gtk/gtkcssimagevalue.c
@@ -96,6 +96,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
   gtk_css_value_image_compute,
   gtk_css_value_image_equal,
   gtk_css_value_image_transition,
+  NULL,
+  NULL,
   gtk_css_value_image_print
 };
 
diff --git a/gtk/gtkcssinheritvalue.c b/gtk/gtkcssinheritvalue.c
index 0be2bb60bc..f99471f37f 100644
--- a/gtk/gtkcssinheritvalue.c
+++ b/gtk/gtkcssinheritvalue.c
@@ -82,6 +82,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
   gtk_css_value_inherit_compute,
   gtk_css_value_inherit_equal,
   gtk_css_value_inherit_transition,
+  NULL,
+  NULL,
   gtk_css_value_inherit_print
 };
 
diff --git a/gtk/gtkcssinitialvalue.c b/gtk/gtkcssinitialvalue.c
index af9430abcb..f65ae08963 100644
--- a/gtk/gtkcssinitialvalue.c
+++ b/gtk/gtkcssinitialvalue.c
@@ -106,6 +106,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
   gtk_css_value_initial_compute,
   gtk_css_value_initial_equal,
   gtk_css_value_initial_transition,
+  NULL,
+  NULL,
   gtk_css_value_initial_print
 };
 
diff --git a/gtk/gtkcsspalettevalue.c b/gtk/gtkcsspalettevalue.c
index 457b0566e3..ac9088482c 100644
--- a/gtk/gtkcsspalettevalue.c
+++ b/gtk/gtkcsspalettevalue.c
@@ -178,6 +178,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_PALETTE = {
   gtk_css_value_palette_compute,
   gtk_css_value_palette_equal,
   gtk_css_value_palette_transition,
+  NULL,
+  NULL,
   gtk_css_value_palette_print
 };
 
diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c
index f1655b1798..42735fe3ba 100644
--- a/gtk/gtkcsspositionvalue.c
+++ b/gtk/gtkcsspositionvalue.c
@@ -154,6 +154,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_POSITION = {
   gtk_css_value_position_compute,
   gtk_css_value_position_equal,
   gtk_css_value_position_transition,
+  NULL,
+  NULL,
   gtk_css_value_position_print
 };
 
diff --git a/gtk/gtkcssrepeatvalue.c b/gtk/gtkcssrepeatvalue.c
index bbd64cb055..5cc6dab7be 100644
--- a/gtk/gtkcssrepeatvalue.c
+++ b/gtk/gtkcssrepeatvalue.c
@@ -117,6 +117,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
   gtk_css_value_repeat_compute,
   gtk_css_value_repeat_equal,
   gtk_css_value_repeat_transition,
+  NULL,
+  NULL,
   gtk_css_value_background_repeat_print
 };
 
@@ -125,6 +127,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_BORDER_REPEAT = {
   gtk_css_value_repeat_compute,
   gtk_css_value_repeat_equal,
   gtk_css_value_repeat_transition,
+  NULL,
+  NULL,
   gtk_css_value_border_repeat_print
 };
 /* BACKGROUND REPEAT */
diff --git a/gtk/gtkcssrgbavalue.c b/gtk/gtkcssrgbavalue.c
index 92f3f416c7..a7134ef465 100644
--- a/gtk/gtkcssrgbavalue.c
+++ b/gtk/gtkcssrgbavalue.c
@@ -102,6 +102,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_RGBA = {
   gtk_css_value_rgba_compute,
   gtk_css_value_rgba_equal,
   gtk_css_value_rgba_transition,
+  NULL,
+  NULL,
   gtk_css_value_rgba_print
 };
 
diff --git a/gtk/gtkcssshadowsvalue.c b/gtk/gtkcssshadowsvalue.c
index 3fbbc527b9..d31bb66c7a 100644
--- a/gtk/gtkcssshadowsvalue.c
+++ b/gtk/gtkcssshadowsvalue.c
@@ -204,6 +204,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_SHADOWS = {
   gtk_css_value_shadows_compute,
   gtk_css_value_shadows_equal,
   gtk_css_value_shadows_transition,
+  NULL,
+  NULL,
   gtk_css_value_shadows_print
 };
 
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index c81d82b405..704d6d1df0 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -159,6 +159,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_SHADOW = {
   gtk_css_value_shadow_compute,
   gtk_css_value_shadow_equal,
   gtk_css_value_shadow_transition,
+  NULL,
+  NULL,
   gtk_css_value_shadow_print
 };
 
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index b7feae0073..49b7d19d4d 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -121,6 +121,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
   gtk_css_value_string_compute,
   gtk_css_value_string_equal,
   gtk_css_value_string_transition,
+  NULL,
+  NULL,
   gtk_css_value_string_print
 };
 
@@ -129,6 +131,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_IDENT = {
   gtk_css_value_string_compute,
   gtk_css_value_string_equal,
   gtk_css_value_string_transition,
+  NULL,
+  NULL,
   gtk_css_value_ident_print
 };
 
diff --git a/gtk/gtkcsstransformvalue.c b/gtk/gtkcsstransformvalue.c
index 773c2eebd4..7ce4102920 100644
--- a/gtk/gtkcsstransformvalue.c
+++ b/gtk/gtkcsstransformvalue.c
@@ -707,6 +707,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_TRANSFORM = {
   gtk_css_value_transform_compute,
   gtk_css_value_transform_equal,
   gtk_css_value_transform_transition,
+  NULL,
+  NULL,
   gtk_css_value_transform_print
 };
 
diff --git a/gtk/gtkcssunsetvalue.c b/gtk/gtkcssunsetvalue.c
index 32550cd47b..78d143bf20 100644
--- a/gtk/gtkcssunsetvalue.c
+++ b/gtk/gtkcssunsetvalue.c
@@ -86,6 +86,8 @@ static const GtkCssValueClass GTK_CSS_VALUE_UNSET = {
   gtk_css_value_unset_compute,
   gtk_css_value_unset_equal,
   gtk_css_value_unset_transition,
+  NULL,
+  NULL,
   gtk_css_value_unset_print
 };
 
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index f6afc22679..79b0f15804 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -44,7 +44,7 @@ _gtk_css_value_alloc (const GtkCssValueClass *klass,
 }
 
 GtkCssValue *
-_gtk_css_value_ref (GtkCssValue *value)
+gtk_css_value_ref (GtkCssValue *value)
 {
   gtk_internal_return_val_if_fail (value != NULL, NULL);
 
@@ -54,7 +54,7 @@ _gtk_css_value_ref (GtkCssValue *value)
 }
 
 void
-_gtk_css_value_unref (GtkCssValue *value)
+gtk_css_value_unref (GtkCssValue *value)
 {
   if (value == NULL)
     return;
@@ -175,3 +175,51 @@ _gtk_css_value_print (const GtkCssValue *value,
   value->class->print (value, string);
 }
 
+/**
+ * gtk_css_value_is_dynamic:
+ * @value: a #GtkCssValue
+ *
+ * A "dynamic" value has a different value at different times. This means that
+ * the value needs to be animated when time is progressing.
+ *
+ * Examples of dynamic values are animated images, such as videos or dynamic shaders.
+ *
+ * Use gtk_css_value_get_dynamic_value() to get the value for a given timestamp.
+ *
+ * Returns %TRUE if the value is dynamic
+ */
+gboolean
+gtk_css_value_is_dynamic (GtkCssValue *value)
+{
+  gtk_internal_return_val_if_fail (value != NULL, FALSE);
+
+  if (!value->class->is_dynamic)
+    return FALSE;
+
+  return value->class->is_dynamic (value);
+}
+
+/**
+ * gtk_css_value_get_dynamic_value:
+ * @value: a #GtkCssValue
+ * @monotonic_time: the timestamp for which to get the dynamic value
+ *
+ * Gets the dynamic value for a given timestamp. If @monotonic_time is 0,
+ * the default value is returned.
+ *
+ * See gtk_css_value_is_dynamic() for details about dynamic values.
+ *
+ * Returns: (transfer full): The dynamic value for @value at the given
+ *     timestamp
+ **/
+GtkCssValue *
+gtk_css_value_get_dynamic_value (GtkCssValue *value,
+                                 gint64       monotonic_time)
+{
+  gtk_internal_return_val_if_fail (value != NULL, NULL);
+
+  if (!value->class->get_dynamic_value)
+    return gtk_css_value_ref (value);
+
+  return value->class->get_dynamic_value (value, monotonic_time);
+}
diff --git a/gtk/gtkcssvalueprivate.h b/gtk/gtkcssvalueprivate.h
index 00dfadd9b7..53ba739bce 100644
--- a/gtk/gtkcssvalueprivate.h
+++ b/gtk/gtkcssvalueprivate.h
@@ -51,6 +51,9 @@ struct _GtkCssValueClass {
                                                        GtkCssValue                *end,
                                                        guint                       property_id,
                                                        double                      progress);
+  gboolean      (* is_dynamic)                        (GtkCssValue                *value);
+  GtkCssValue * (* get_dynamic_value)                 (GtkCssValue                *value,
+                                                       gint64                      monotonic_time);
   void          (* print)                             (const GtkCssValue          *value,
                                                        GString                    *string);
 };
@@ -61,8 +64,10 @@ GtkCssValue *_gtk_css_value_alloc                     (const GtkCssValueClass
                                                        gsize                       size);
 #define _gtk_css_value_new(_name, _klass) ((_name *) _gtk_css_value_alloc ((_klass), sizeof (_name)))
 
-GtkCssValue *_gtk_css_value_ref                       (GtkCssValue                *value);
-void         _gtk_css_value_unref                     (GtkCssValue                *value);
+#define _gtk_css_value_ref gtk_css_value_ref
+GtkCssValue *   gtk_css_value_ref                     (GtkCssValue                *value);
+#define _gtk_css_value_unref gtk_css_value_unref
+void            gtk_css_value_unref                   (GtkCssValue                *value);
 
 GtkCssValue *_gtk_css_value_compute                   (GtkCssValue                *value,
                                                        guint                       property_id,
@@ -77,6 +82,9 @@ GtkCssValue *_gtk_css_value_transition                (GtkCssValue
                                                        GtkCssValue                *end,
                                                        guint                       property_id,
                                                        double                      progress);
+gboolean        gtk_css_value_is_dynamic              (GtkCssValue                *value);
+GtkCssValue *   gtk_css_value_get_dynamic_value       (GtkCssValue                *value,
+                                                       gint64                      monotonic_time);
 
 char *       _gtk_css_value_to_string                 (const GtkCssValue          *value);
 void         _gtk_css_value_print                     (const GtkCssValue          *value,
diff --git a/gtk/gtkcsswin32sizevalue.c b/gtk/gtkcsswin32sizevalue.c
index 8307a8a88e..0136ee1200 100644
--- a/gtk/gtkcsswin32sizevalue.c
+++ b/gtk/gtkcsswin32sizevalue.c
@@ -253,6 +253,8 @@ static const GtkCssNumberValueClass GTK_CSS_VALUE_WIN32_SIZE = {
     gtk_css_value_win32_size_compute,
     gtk_css_value_win32_size_equal,
     gtk_css_number_value_transition,
+    NULL,
+    NULL,
     gtk_css_value_win32_size_print
   },
   gtk_css_value_win32_size_get,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]