[gtk+] css: Introduce dependencies for value computations
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: Introduce dependencies for value computations
- Date: Tue, 28 Aug 2012 13:47:01 +0000 (UTC)
commit 0e2f35ed882ab11d010866d32f2f65232145b8d0
Author: Benjamin Otte <otte redhat com>
Date: Mon Jul 16 14:48:43 2012 +0200
css: Introduce dependencies for value computations
When values are computed, they might depend on various other values and
we need to track this so we can update the values when those other
values change. This is the first step in making that happen.
This patch does not do any dependency tracking at all, instead it uses
GTK_CSS_DEPENDS_ON_EVERYTHING as a sort of FIXME.
gtk/gtkcssarrayvalue.c | 11 +++++++----
gtk/gtkcssbgsizevalue.c | 13 ++++++++-----
gtk/gtkcssbordervalue.c | 11 +++++++----
gtk/gtkcsscomputedvalues.c | 2 +-
gtk/gtkcsscornervalue.c | 13 ++++++++-----
gtk/gtkcsseasevalue.c | 7 ++++---
gtk/gtkcssenginevalue.c | 7 ++++---
gtk/gtkcssenumvalue.c | 7 ++++---
gtk/gtkcssimagelinear.c | 6 +++---
gtk/gtkcssimagevalue.c | 9 ++++++---
gtk/gtkcssinheritvalue.c | 12 ++++++++----
gtk/gtkcssinitialvalue.c | 10 ++++++----
gtk/gtkcssnumbervalue.c | 9 ++++++---
gtk/gtkcsspositionvalue.c | 13 ++++++++-----
gtk/gtkcssrepeatvalue.c | 7 ++++---
gtk/gtkcssrgbavalue.c | 7 ++++---
gtk/gtkcssshadowsvalue.c | 11 +++++++----
gtk/gtkcssshadowvalue.c | 19 +++++++++++--------
gtk/gtkcssstringvalue.c | 7 ++++---
gtk/gtkcsstypedvalue.c | 9 ++++++---
gtk/gtkcsstypesprivate.h | 10 ++++++++++
gtk/gtkcssvalue.c | 20 +++++++++++++++-----
gtk/gtkcssvalueprivate.h | 6 ++++--
gtk/gtksymboliccolor.c | 12 ++++++++----
24 files changed, 153 insertions(+), 85 deletions(-)
---
diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c
index a4fa0f4..418ac65 100644
--- a/gtk/gtkcssarrayvalue.c
+++ b/gtk/gtkcssarrayvalue.c
@@ -41,9 +41,10 @@ gtk_css_value_array_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_array_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_array_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *result;
gboolean changed = FALSE;
@@ -52,10 +53,12 @@ gtk_css_value_array_compute (GtkCssValue *value,
if (value->n_values == 0)
return _gtk_css_value_ref (value);
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
for (i = 0; i < value->n_values; i++)
{
- result->values[i] = _gtk_css_value_compute (value->values[i], property_id, context);
+ result->values[i] = _gtk_css_value_compute (value->values[i], property_id, context, NULL);
changed |= (result->values[i] != value->values[i]);
}
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c
index 38f6054..2bff385 100644
--- a/gtk/gtkcssbgsizevalue.c
+++ b/gtk/gtkcssbgsizevalue.c
@@ -41,15 +41,18 @@ gtk_css_value_bg_size_free (GtkCssValue *value)
}
GtkCssValue *
-gtk_css_value_bg_size_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_bg_size_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
if (value->x == NULL && value->y == NULL)
return _gtk_css_value_ref (value);
- return _gtk_css_bg_size_value_new (value->x ? _gtk_css_value_compute (value->x, property_id, context) : NULL,
- value->y ? _gtk_css_value_compute (value->y, property_id, context) : NULL);
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
+ return _gtk_css_bg_size_value_new (value->x ? _gtk_css_value_compute (value->x, property_id, context, NULL) : NULL,
+ value->y ? _gtk_css_value_compute (value->y, property_id, context, NULL) : NULL);
}
static gboolean
diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c
index 45f7fd1..085e3f2 100644
--- a/gtk/gtkcssbordervalue.c
+++ b/gtk/gtkcssbordervalue.c
@@ -42,14 +42,17 @@ gtk_css_value_border_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_border_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_border_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *computed;
gboolean changed = FALSE;
guint i;
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
computed = _gtk_css_border_value_new (NULL, NULL, NULL, NULL);
computed->fill = value->fill;
@@ -57,7 +60,7 @@ gtk_css_value_border_compute (GtkCssValue *value,
{
if (value->values[i])
{
- computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, context);
+ computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, context, NULL);
changed |= (computed->values[i] != value->values[i]);
}
}
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c
index 7aa121f..ad03530 100644
--- a/gtk/gtkcsscomputedvalues.c
+++ b/gtk/gtkcsscomputedvalues.c
@@ -113,7 +113,7 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
else
_gtk_css_value_ref (specified);
- g_ptr_array_index (values->values, id) = _gtk_css_value_compute (specified, id, context);
+ g_ptr_array_index (values->values, id) = _gtk_css_value_compute (specified, id, context, NULL);
if (section)
{
diff --git a/gtk/gtkcsscornervalue.c b/gtk/gtkcsscornervalue.c
index 7e41688..8710243 100644
--- a/gtk/gtkcsscornervalue.c
+++ b/gtk/gtkcsscornervalue.c
@@ -37,14 +37,17 @@ gtk_css_value_corner_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_corner_compute (GtkCssValue *corner,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_corner_compute (GtkCssValue *corner,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
- x = _gtk_css_value_compute (corner->x, property_id, context);
- y = _gtk_css_value_compute (corner->y, property_id, context);
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
+ x = _gtk_css_value_compute (corner->x, property_id, context, NULL);
+ y = _gtk_css_value_compute (corner->y, property_id, context, NULL);
if (x == corner->x && y == corner->y)
{
_gtk_css_value_unref (x);
diff --git a/gtk/gtkcsseasevalue.c b/gtk/gtkcsseasevalue.c
index 122d6c1..81c9bce 100644
--- a/gtk/gtkcsseasevalue.c
+++ b/gtk/gtkcsseasevalue.c
@@ -50,9 +50,10 @@ gtk_css_value_ease_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_ease_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_ease_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssenginevalue.c b/gtk/gtkcssenginevalue.c
index 8041090..a39ac6c 100644
--- a/gtk/gtkcssenginevalue.c
+++ b/gtk/gtkcssenginevalue.c
@@ -35,9 +35,10 @@ gtk_css_value_engine_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_engine_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_engine_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index fb9c836..9ea7ae8f 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -36,9 +36,10 @@ gtk_css_value_enum_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_enum_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_enum_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c
index 10977e8..998d366 100644
--- a/gtk/gtkcssimagelinear.c
+++ b/gtk/gtkcssimagelinear.c
@@ -420,7 +420,7 @@ gtk_css_image_linear_compute (GtkCssImage *image,
copy = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
copy->repeating = linear->repeating;
- copy->angle = _gtk_css_value_compute (linear->angle, property_id, context);
+ copy->angle = _gtk_css_value_compute (linear->angle, property_id, context, NULL);
g_array_set_size (copy->stops, linear->stops->len);
for (i = 0; i < linear->stops->len; i++)
@@ -430,10 +430,10 @@ gtk_css_image_linear_compute (GtkCssImage *image,
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
scopy = &g_array_index (copy->stops, GtkCssImageLinearColorStop, i);
- scopy->color = _gtk_css_value_compute (stop->color, property_id, context);
+ scopy->color = _gtk_css_value_compute (stop->color, property_id, context, NULL);
if (stop->offset)
- scopy->offset = _gtk_css_value_compute (stop->offset, property_id, context);
+ scopy->offset = _gtk_css_value_compute (stop->offset, property_id, context, NULL);
else
scopy->offset = NULL;
}
diff --git a/gtk/gtkcssimagevalue.c b/gtk/gtkcssimagevalue.c
index 5cd4929..e56db9d 100644
--- a/gtk/gtkcssimagevalue.c
+++ b/gtk/gtkcssimagevalue.c
@@ -34,9 +34,10 @@ gtk_css_value_image_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_image_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_image_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkCssImage *image, *computed;
@@ -53,6 +54,8 @@ gtk_css_value_image_compute (GtkCssValue *value,
return _gtk_css_value_ref (value);
}
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
return _gtk_css_image_value_new (computed);
}
diff --git a/gtk/gtkcssinheritvalue.c b/gtk/gtkcssinheritvalue.c
index 6faeef3..58964be 100644
--- a/gtk/gtkcssinheritvalue.c
+++ b/gtk/gtkcssinheritvalue.c
@@ -34,18 +34,22 @@ gtk_css_value_inherit_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_inherit_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_inherit_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkStyleContext *parent = gtk_style_context_get_parent (context);
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
if (parent)
return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, property_id));
else
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id,
- context);
+ context,
+ NULL);
}
static gboolean
diff --git a/gtk/gtkcssinitialvalue.c b/gtk/gtkcssinitialvalue.c
index 7bebbc8..45cadd7 100644
--- a/gtk/gtkcssinitialvalue.c
+++ b/gtk/gtkcssinitialvalue.c
@@ -33,13 +33,15 @@ gtk_css_value_initial_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_initial_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_initial_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id,
- context);
+ context,
+ dependencies);
}
static gboolean
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index 479662c..535c205 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -35,9 +35,10 @@ gtk_css_value_number_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_number_compute (GtkCssValue *number,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_number_compute (GtkCssValue *number,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkBorderStyle border_style;
@@ -73,6 +74,8 @@ gtk_css_value_number_compute (GtkCssValue *number,
break;
}
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
switch (number->unit)
{
default:
diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c
index 9f4b0d3..6a6cbe3 100644
--- a/gtk/gtkcsspositionvalue.c
+++ b/gtk/gtkcsspositionvalue.c
@@ -37,14 +37,15 @@ gtk_css_value_position_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_position_compute (GtkCssValue *position,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_position_compute (GtkCssValue *position,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
- x = _gtk_css_value_compute (position->x, property_id, context);
- y = _gtk_css_value_compute (position->y, property_id, context);
+ x = _gtk_css_value_compute (position->x, property_id, context, NULL);
+ y = _gtk_css_value_compute (position->y, property_id, context, NULL);
if (x == position->x && y == position->y)
{
_gtk_css_value_unref (x);
@@ -52,6 +53,8 @@ gtk_css_value_position_compute (GtkCssValue *position,
return _gtk_css_value_ref (position);
}
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
return _gtk_css_position_value_new (x, y);
}
diff --git a/gtk/gtkcssrepeatvalue.c b/gtk/gtkcssrepeatvalue.c
index 97fe41f..6f07072 100644
--- a/gtk/gtkcssrepeatvalue.c
+++ b/gtk/gtkcssrepeatvalue.c
@@ -34,9 +34,10 @@ gtk_css_value_repeat_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_repeat_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_repeat_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssrgbavalue.c b/gtk/gtkcssrgbavalue.c
index 7a641a3..3bb6897 100644
--- a/gtk/gtkcssrgbavalue.c
+++ b/gtk/gtkcssrgbavalue.c
@@ -35,9 +35,10 @@ gtk_css_value_rgba_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_rgba_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_rgba_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssshadowsvalue.c b/gtk/gtkcssshadowsvalue.c
index 387076e..ce37d86 100644
--- a/gtk/gtkcssshadowsvalue.c
+++ b/gtk/gtkcssshadowsvalue.c
@@ -48,9 +48,10 @@ gtk_css_value_shadows_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_shadows_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_shadows_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *result;
guint i;
@@ -58,10 +59,12 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
if (value->len == 0)
return _gtk_css_value_ref (value);
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
result = gtk_css_shadows_value_new (value->values, value->len);
for (i = 0; i < value->len; i++)
{
- result->values[i] = _gtk_css_value_compute (value->values[i], property_id, context);
+ result->values[i] = _gtk_css_value_compute (value->values[i], property_id, context, NULL);
}
return result;
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 3351d6f..9b2d897 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -60,16 +60,19 @@ gtk_css_value_shadow_free (GtkCssValue *shadow)
}
static GtkCssValue *
-gtk_css_value_shadow_compute (GtkCssValue *shadow,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_shadow_compute (GtkCssValue *shadow,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
- return gtk_css_shadow_value_new (_gtk_css_value_compute (shadow->hoffset, property_id, context),
- _gtk_css_value_compute (shadow->voffset, property_id, context),
- _gtk_css_value_compute (shadow->radius, property_id, context),
- _gtk_css_value_compute (shadow->spread, property_id, context),
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
+ return gtk_css_shadow_value_new (_gtk_css_value_compute (shadow->hoffset, property_id, context, NULL),
+ _gtk_css_value_compute (shadow->voffset, property_id, context, NULL),
+ _gtk_css_value_compute (shadow->radius, property_id, context, NULL),
+ _gtk_css_value_compute (shadow->spread, property_id, context, NULL),
shadow->inset,
- _gtk_css_value_compute (shadow->color, property_id, context));
+ _gtk_css_value_compute (shadow->color, property_id, context, NULL));
}
static gboolean
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index 2bc140d..328fd21 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -33,9 +33,10 @@ gtk_css_value_string_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_string_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_string_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcsstypedvalue.c b/gtk/gtkcsstypedvalue.c
index 60eeea8..fd8f0ad 100644
--- a/gtk/gtkcsstypedvalue.c
+++ b/gtk/gtkcsstypedvalue.c
@@ -35,12 +35,15 @@ gtk_css_value_typed_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_typed_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_typed_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (_gtk_css_style_property_lookup_by_id (property_id));
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
return _gtk_css_style_compute_value (context, custom->pspec->value_type, value);
}
diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h
index b0db18d..dfc9527 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -56,6 +56,16 @@ typedef enum { /*< skip >*/
GTK_CSS_CHANGE_PARENT_POSITION | GTK_CSS_CHANGE_PARENT_SIBLING_POSITION | \
GTK_CSS_CHANGE_PARENT_STATE | GTK_CSS_CHANGE_PARENT_SIBLING_STATE)
+typedef enum /*< skip >*/ {
+ GTK_CSS_DEPENDS_ON_PARENT = (1 << 0),
+ GTK_CSS_EQUALS_PARENT = (1 << 1),
+ GTK_CSS_DEPENDS_ON_COLOR = (1 << 2),
+ GTK_CSS_DEPENDS_ON_FONT_SIZE = (1 << 3)
+} GtkCssDependencies;
+
+#define GTK_CSS_DEPENDS_ON_EVERYTHING (GTK_CSS_DEPENDS_ON_PARENT | GTK_CSS_EQUALS_PARENT \
+ | GTK_CSS_DEPENDS_ON_COLOR | GTK_CSS_DEPENDS_ON_FONT_SIZE)
+
enum { /*< skip >*/
GTK_CSS_PROPERTY_COLOR,
GTK_CSS_PROPERTY_FONT_SIZE,
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index 5d5d392..e057f90 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -66,6 +66,9 @@ _gtk_css_value_unref (GtkCssValue *value)
* @value: the value to compute from
* @property_id: the ID of the property to compute
* @context: the context to use for resolving
+ * @dependencies: (out) (allow-none): Set to the dependencies of the
+ * computed values that indicate when this value needs to be
+ * recomputed and how.
*
* Converts the specified @value into the computed value for the CSS
* property given by @property_id using the information in @context.
@@ -73,17 +76,24 @@ _gtk_css_value_unref (GtkCssValue *value)
* <ulink url="http://www.w3.org/TR/css3-cascade/#computed>
* the CSS documentation</ulink>.
*
- * Returns: the comptued value
+ * Returns: the computed value
**/
GtkCssValue *
-_gtk_css_value_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+_gtk_css_value_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
+ GtkCssDependencies fallback;
+
g_return_val_if_fail (value != NULL, NULL);
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
- return value->class->compute (value, property_id, context);
+ if (dependencies == NULL)
+ dependencies = &fallback;
+ *dependencies = 0;
+
+ return value->class->compute (value, property_id, context, dependencies);
}
gboolean
diff --git a/gtk/gtkcssvalueprivate.h b/gtk/gtkcssvalueprivate.h
index 74550f7..629cc75 100644
--- a/gtk/gtkcssvalueprivate.h
+++ b/gtk/gtkcssvalueprivate.h
@@ -44,7 +44,8 @@ struct _GtkCssValueClass {
GtkCssValue * (* compute) (GtkCssValue *value,
guint property_id,
- GtkStyleContext *context);
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies);
gboolean (* equal) (const GtkCssValue *value1,
const GtkCssValue *value2);
GtkCssValue * (* transition) (GtkCssValue *start,
@@ -65,7 +66,8 @@ void _gtk_css_value_unref (GtkCssValue
GtkCssValue *_gtk_css_value_compute (GtkCssValue *value,
guint property_id,
- GtkStyleContext *context);
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies);
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
const GtkCssValue *value2);
gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,
diff --git a/gtk/gtksymboliccolor.c b/gtk/gtksymboliccolor.c
index 8429bbc..9fcfd49 100644
--- a/gtk/gtksymboliccolor.c
+++ b/gtk/gtksymboliccolor.c
@@ -142,7 +142,8 @@ gtk_css_value_symbolic_get_fallback (guint property_id,
case GTK_CSS_PROPERTY_OUTLINE_COLOR:
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id,
- context);
+ context,
+ NULL);
default:
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
g_warning ("No fallback color defined for property '%s'",
@@ -152,12 +153,15 @@ gtk_css_value_symbolic_get_fallback (guint property_id,
}
static GtkCssValue *
-gtk_css_value_symbolic_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context)
+gtk_css_value_symbolic_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleContext *context,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *resolved, *current;
+ *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+
/* The computed value of the âcurrentColorâ keyword is the computed
* value of the âcolorâ property. If the âcurrentColorâ keyword is
* set on the âcolorâ property itself, it is treated as âcolor: inheritâ.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]