[gtk+] css: Huge refactoring to avoid computing wrong values
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: Huge refactoring to avoid computing wrong values
- Date: Fri, 28 Sep 2012 16:29:51 +0000 (UTC)
commit 1454ba15baa2e3378c48566746de3f41da6cde95
Author: Benjamin Otte <otte redhat com>
Date: Fri Sep 28 18:02:46 2012 +0200
css: Huge refactoring to avoid computing wrong values
Here's the shortest description of the bug I can come up with:
When computing values, we have 3 kinds of dependencies:
(1) other properties ("currentColor" or em values)
(2) inherited properties ("inherit")
(3) generic things from the theme (@keyframes or @define-color)
Previously, we passed the GtkStyleContext as an argument, because it
provided these 3 things using:
(1) _gtk_style_context_peek_property()
(2) _gtk_style_context_peek_property(gtk_style_context_get_parent())
(3) context->priv->cascade
However, this makes it impossible to lookup values other than the ones
accessible via _gtk_style_context_peek_property(). And this is exactly
what we are doing in gtk_style_context_update_cache(). So when the cache
updates encountered case (1), they were looking up the values from the
wrong style data.
So this large patch essentially does nothing but replace the
context argument in all compute functions with new arguments for the 3
cases above:
(1) values
(2) parent_values
(3) provider
We apparently have a lot of computing code.
gtk/gtkcssarrayvalue.c | 12 +++--
gtk/gtkcssbgsizevalue.c | 14 +++--
gtk/gtkcssbordervalue.c | 12 +++--
gtk/gtkcsscomputedvalues.c | 40 ++++++++-------
gtk/gtkcsscomputedvaluesprivate.h | 9 ++--
gtk/gtkcsscornervalue.c | 14 +++--
gtk/gtkcsseasevalue.c | 10 ++--
gtk/gtkcssenginevalue.c | 10 ++--
gtk/gtkcssenumvalue.c | 10 ++--
gtk/gtkcssimage.c | 27 ++++++----
gtk/gtkcssimagegradient.c | 12 +++--
gtk/gtkcssimagelinear.c | 16 +++---
gtk/gtkcssimageprivate.h | 96 +++++++++++++++++++-----------------
gtk/gtkcssimagevalue.c | 12 +++--
gtk/gtkcssinheritvalue.c | 20 ++++---
gtk/gtkcssinitialvalue.c | 14 +++--
gtk/gtkcsskeyframes.c | 14 ++++--
gtk/gtkcsskeyframesprivate.h | 6 ++-
gtk/gtkcsslookup.c | 13 +++--
gtk/gtkcsslookupprivate.h | 36 +++++++-------
gtk/gtkcssnumbervalue.c | 24 +++++----
gtk/gtkcsspositionvalue.c | 14 +++--
gtk/gtkcssrepeatvalue.c | 10 ++--
gtk/gtkcssrgbavalue.c | 10 ++--
gtk/gtkcssshadowsvalue.c | 12 +++--
gtk/gtkcssshadowvalue.c | 20 ++++---
gtk/gtkcssstringvalue.c | 10 ++--
gtk/gtkcssstylefuncs.c | 98 ++++++++++++++++++++++++-------------
gtk/gtkcssstylefuncsprivate.h | 18 ++++---
gtk/gtkcsstypedvalue.c | 12 +++--
gtk/gtkcssvalue.c | 23 ++++++---
gtk/gtkcssvalueprivate.h | 9 ++-
gtk/gtkgradient.c | 45 +++++++++--------
gtk/gtkstylecontext.c | 36 +++++++++----
gtk/gtkstylecontextprivate.h | 3 -
gtk/gtkstylepropertiesprivate.h | 8 ++-
gtk/gtksymboliccolor.c | 36 ++++++++-----
37 files changed, 461 insertions(+), 324 deletions(-)
---
diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c
index dadedba..e822619 100644
--- a/gtk/gtkcssarrayvalue.c
+++ b/gtk/gtkcssarrayvalue.c
@@ -43,10 +43,12 @@ gtk_css_value_array_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_array_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_array_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *result;
gboolean changed = FALSE;
@@ -59,7 +61,7 @@ gtk_css_value_array_compute (GtkCssValue *value,
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, &child_deps);
+ result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c
index e545f61..01db83d 100644
--- a/gtk/gtkcssbgsizevalue.c
+++ b/gtk/gtkcssbgsizevalue.c
@@ -41,10 +41,12 @@ gtk_css_value_bg_size_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_bg_size_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_bg_size_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
@@ -56,10 +58,10 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
x = y = NULL;
if (value->x)
- x = _gtk_css_value_compute (value->x, property_id, context, &x_deps);
+ x = _gtk_css_value_compute (value->x, property_id, provider, values, parent_values, &x_deps);
if (value->y)
- y = _gtk_css_value_compute (value->y, property_id, context, &y_deps);
+ y = _gtk_css_value_compute (value->y, property_id, provider, values, parent_values, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c
index 953ab53..62487f8 100644
--- a/gtk/gtkcssbordervalue.c
+++ b/gtk/gtkcssbordervalue.c
@@ -42,10 +42,12 @@ gtk_css_value_border_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_border_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_border_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *computed;
GtkCssDependencies child_deps;
@@ -59,7 +61,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, &child_deps);
+ computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
changed |= (computed->values[i] != value->values[i]);
}
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c
index 250b0b0..b60324e 100644
--- a/gtk/gtkcsscomputedvalues.c
+++ b/gtk/gtkcsscomputedvalues.c
@@ -110,17 +110,19 @@ maybe_unref_section (gpointer section)
}
void
-_gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
- GtkStyleContext *context,
- guint id,
- GtkCssValue *specified,
- GtkCssSection *section)
+_gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *parent_values,
+ guint id,
+ GtkCssValue *specified,
+ GtkCssSection *section)
{
GtkCssDependencies dependencies;
GtkCssValue *value;
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
- g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+ g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
+ g_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
@@ -139,7 +141,7 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
else
_gtk_css_value_ref (specified);
- value = _gtk_css_value_compute (specified, id, context, &dependencies);
+ value = _gtk_css_value_compute (specified, id, provider, values, parent_values, &dependencies);
_gtk_css_computed_values_set_value (values, id, value, dependencies, section);
@@ -432,17 +434,16 @@ gtk_css_computed_values_find_animation (GtkCssComputedValues *values,
}
static void
-gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values,
- gint64 timestamp,
- GtkCssComputedValues *source,
- GtkStyleContext *context)
+gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ gint64 timestamp,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *source)
{
- GtkStyleProviderPrivate *provider;
GtkCssValue *durations, *delays, *timing_functions, *animations;
GtkCssValue *iteration_counts, *directions, *play_states, *fill_modes;
guint i;
- provider = _gtk_style_context_get_style_provider (context);
animations = _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_ANIMATION_NAME);
durations = _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_ANIMATION_DURATION);
delays = _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_ANIMATION_DELAY);
@@ -481,7 +482,7 @@ gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values,
if (keyframes == NULL)
continue;
- keyframes = _gtk_css_keyframes_compute (keyframes, context);
+ keyframes = _gtk_css_keyframes_compute (keyframes, provider, values, parent_values);
animation = _gtk_css_animation_new (name,
keyframes,
@@ -501,14 +502,15 @@ gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values,
/* PUBLIC API */
void
-_gtk_css_computed_values_create_animations (GtkCssComputedValues *values,
- gint64 timestamp,
- GtkCssComputedValues *source,
- GtkStyleContext *context)
+_gtk_css_computed_values_create_animations (GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ gint64 timestamp,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *source)
{
if (source != NULL)
gtk_css_computed_values_create_css_transitions (values, timestamp, source);
- gtk_css_computed_values_create_css_animations (values, timestamp, source, context);
+ gtk_css_computed_values_create_css_animations (values, parent_values, timestamp, provider, source);
}
GtkBitmask *
diff --git a/gtk/gtkcsscomputedvaluesprivate.h b/gtk/gtkcsscomputedvaluesprivate.h
index ef8130a..28afec3 100644
--- a/gtk/gtkcsscomputedvaluesprivate.h
+++ b/gtk/gtkcsscomputedvaluesprivate.h
@@ -24,7 +24,6 @@
#include "gtk/gtkbitmaskprivate.h"
#include "gtk/gtkcsssection.h"
-#include "gtk/gtkstylecontext.h"
#include "gtk/gtkcssvalueprivate.h"
G_BEGIN_DECLS
@@ -66,7 +65,8 @@ GType _gtk_css_computed_values_get_type (void) G_G
GtkCssComputedValues * _gtk_css_computed_values_new (void);
void _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
- GtkStyleContext *context,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *parent_values,
guint id,
GtkCssValue *specified,
GtkCssSection *section);
@@ -89,9 +89,10 @@ GtkBitmask * _gtk_css_computed_values_get_difference (GtkCssCom
GtkCssComputedValues *other);
void _gtk_css_computed_values_create_animations (GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
gint64 timestamp,
- GtkCssComputedValues *source,
- GtkStyleContext *context);
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *source);
GtkBitmask * _gtk_css_computed_values_advance (GtkCssComputedValues *values,
gint64 timestamp);
void _gtk_css_computed_values_cancel_animations (GtkCssComputedValues *values);
diff --git a/gtk/gtkcsscornervalue.c b/gtk/gtkcsscornervalue.c
index 48586df..394675c 100644
--- a/gtk/gtkcsscornervalue.c
+++ b/gtk/gtkcsscornervalue.c
@@ -37,16 +37,18 @@ gtk_css_value_corner_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_corner_compute (GtkCssValue *corner,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_corner_compute (GtkCssValue *corner,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
- x = _gtk_css_value_compute (corner->x, property_id, context, &x_deps);
- y = _gtk_css_value_compute (corner->y, property_id, context, &y_deps);
+ x = _gtk_css_value_compute (corner->x, property_id, provider, values, parent_values, &x_deps);
+ y = _gtk_css_value_compute (corner->y, property_id, provider, values, parent_values, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
if (x == corner->x && y == corner->y)
{
diff --git a/gtk/gtkcsseasevalue.c b/gtk/gtkcsseasevalue.c
index cea938f..81cdea8 100644
--- a/gtk/gtkcsseasevalue.c
+++ b/gtk/gtkcsseasevalue.c
@@ -50,10 +50,12 @@ gtk_css_value_ease_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_ease_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_ease_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssenginevalue.c b/gtk/gtkcssenginevalue.c
index 851c631..f382df9 100644
--- a/gtk/gtkcssenginevalue.c
+++ b/gtk/gtkcssenginevalue.c
@@ -35,10 +35,12 @@ gtk_css_value_engine_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_engine_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_engine_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index a101eaf..b739567 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -36,10 +36,12 @@ gtk_css_value_enum_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_enum_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_enum_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index d990fc7..89dc6f2 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -21,6 +21,8 @@
#include "gtkcssimageprivate.h"
+#include "gtkcsscomputedvaluesprivate.h"
+
/* for the types only */
#include "gtk/gtkcssimagecrossfadeprivate.h"
#include "gtk/gtkcssimagegradientprivate.h"
@@ -57,10 +59,12 @@ gtk_css_image_real_get_aspect_ratio (GtkCssImage *image)
}
static GtkCssImage *
-gtk_css_image_real_compute (GtkCssImage *image,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_image_real_compute (GtkCssImage *image,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
return g_object_ref (image);
}
@@ -116,16 +120,19 @@ _gtk_css_image_get_aspect_ratio (GtkCssImage *image)
}
GtkCssImage *
-_gtk_css_image_compute (GtkCssImage *image,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+_gtk_css_image_compute (GtkCssImage *image,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssDependencies unused;
GtkCssImageClass *klass;
g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+ g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+ g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
if (dependencies == NULL)
dependencies = &unused;
@@ -133,7 +140,7 @@ _gtk_css_image_compute (GtkCssImage *image,
klass = GTK_CSS_IMAGE_GET_CLASS (image);
- return klass->compute (image, property_id, context, dependencies);
+ return klass->compute (image, property_id, provider, values, parent_values, dependencies);
}
void
diff --git a/gtk/gtkcssimagegradient.c b/gtk/gtkcssimagegradient.c
index d8db2e2..2e71067 100644
--- a/gtk/gtkcssimagegradient.c
+++ b/gtk/gtkcssimagegradient.c
@@ -28,10 +28,12 @@
G_DEFINE_TYPE (GtkCssImageGradient, _gtk_css_image_gradient, GTK_TYPE_CSS_IMAGE)
static GtkCssImage *
-gtk_css_image_gradient_compute (GtkCssImage *image,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_image_gradient_compute (GtkCssImage *image,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssImageGradient *gradient = GTK_CSS_IMAGE_GRADIENT (image);
GtkCssImageGradient *copy;
@@ -41,7 +43,7 @@ gtk_css_image_gradient_compute (GtkCssImage *image,
copy = g_object_new (GTK_TYPE_CSS_IMAGE_GRADIENT, NULL);
copy->gradient = gtk_gradient_ref (gradient->gradient);
- copy->pattern = _gtk_gradient_resolve_full (copy->gradient, context, dependencies);
+ copy->pattern = _gtk_gradient_resolve_full (copy->gradient, provider, values, parent_values, dependencies);
return GTK_CSS_IMAGE (copy);
}
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c
index 8dee697..39b6b3e 100644
--- a/gtk/gtkcssimagelinear.c
+++ b/gtk/gtkcssimagelinear.c
@@ -409,10 +409,12 @@ gtk_css_image_linear_print (GtkCssImage *image,
}
static GtkCssImage *
-gtk_css_image_linear_compute (GtkCssImage *image,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_image_linear_compute (GtkCssImage *image,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
GtkCssImageLinear *copy;
@@ -421,7 +423,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, dependencies);
+ copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, values, parent_values, dependencies);
g_array_set_size (copy->stops, linear->stops->len);
for (i = 0; i < linear->stops->len; i++)
@@ -432,12 +434,12 @@ 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, &child_deps);
+ scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
if (stop->offset)
{
- scopy->offset = _gtk_css_value_compute (stop->offset, property_id, context, &child_deps);
+ scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
}
else
diff --git a/gtk/gtkcssimageprivate.h b/gtk/gtkcssimageprivate.h
index 2899ef2..4b8362b 100644
--- a/gtk/gtkcssimageprivate.h
+++ b/gtk/gtkcssimageprivate.h
@@ -23,8 +23,8 @@
#include <cairo.h>
#include <glib-object.h>
-#include "gtk/gtkstylecontext.h"
#include "gtk/gtkcssparserprivate.h"
+#include "gtk/gtkcsstypesprivate.h"
G_BEGIN_DECLS
@@ -48,64 +48,68 @@ struct _GtkCssImageClass
GObjectClass parent_class;
/* width of image or 0 if it has no width (optional) */
- int (* get_width) (GtkCssImage *image);
+ int (* get_width) (GtkCssImage *image);
/* height of image or 0 if it has no height (optional) */
- int (* get_height) (GtkCssImage *image);
+ int (* get_height) (GtkCssImage *image);
/* aspect ratio (width / height) of image or 0 if it has no aspect ratio (optional) */
- double (* get_aspect_ratio) (GtkCssImage *image);
+ double (* get_aspect_ratio) (GtkCssImage *image);
/* create "computed value" in CSS terms, returns a new reference */
- GtkCssImage *(* compute) (GtkCssImage *image,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies);
+ GtkCssImage *(* compute) (GtkCssImage *image,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies);
/* draw to 0,0 with the given width and height */
- void (* draw) (GtkCssImage *image,
- cairo_t *cr,
- double width,
- double height);
+ void (* draw) (GtkCssImage *image,
+ cairo_t *cr,
+ double width,
+ double height);
/* parse CSS, return TRUE on success */
- gboolean (* parse) (GtkCssImage *image,
- GtkCssParser *parser);
+ gboolean (* parse) (GtkCssImage *image,
+ GtkCssParser *parser);
/* print to CSS */
- void (* print) (GtkCssImage *image,
- GString *string);
+ void (* print) (GtkCssImage *image,
+ GString *string);
};
GType _gtk_css_image_get_type (void) G_GNUC_CONST;
-gboolean _gtk_css_image_can_parse (GtkCssParser *parser);
-GtkCssImage * _gtk_css_image_new_parse (GtkCssParser *parser);
-
-int _gtk_css_image_get_width (GtkCssImage *image);
-int _gtk_css_image_get_height (GtkCssImage *image);
-double _gtk_css_image_get_aspect_ratio (GtkCssImage *image);
-
-GtkCssImage * _gtk_css_image_compute (GtkCssImage *image,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies);
-
-void _gtk_css_image_draw (GtkCssImage *image,
- cairo_t *cr,
- double width,
- double height);
-void _gtk_css_image_print (GtkCssImage *image,
- GString *string);
-
-void _gtk_css_image_get_concrete_size (GtkCssImage *image,
- double specified_width,
- double specified_height,
- double default_width,
- double default_height,
- double *concrete_width,
- double *concrete_height);
+gboolean _gtk_css_image_can_parse (GtkCssParser *parser);
+GtkCssImage * _gtk_css_image_new_parse (GtkCssParser *parser);
+
+int _gtk_css_image_get_width (GtkCssImage *image);
+int _gtk_css_image_get_height (GtkCssImage *image);
+double _gtk_css_image_get_aspect_ratio (GtkCssImage *image);
+
+GtkCssImage * _gtk_css_image_compute (GtkCssImage *image,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies);
+
+void _gtk_css_image_draw (GtkCssImage *image,
+ cairo_t *cr,
+ double width,
+ double height);
+void _gtk_css_image_print (GtkCssImage *image,
+ GString *string);
+
+void _gtk_css_image_get_concrete_size (GtkCssImage *image,
+ double specified_width,
+ double specified_height,
+ double default_width,
+ double default_height,
+ double *concrete_width,
+ double *concrete_height);
cairo_surface_t *
- _gtk_css_image_get_surface (GtkCssImage *image,
- cairo_surface_t *target,
- int surface_width,
- int surface_height);
+ _gtk_css_image_get_surface (GtkCssImage *image,
+ cairo_surface_t *target,
+ int surface_width,
+ int surface_height);
G_END_DECLS
diff --git a/gtk/gtkcssimagevalue.c b/gtk/gtkcssimagevalue.c
index b8baa50..d44e72b 100644
--- a/gtk/gtkcssimagevalue.c
+++ b/gtk/gtkcssimagevalue.c
@@ -34,10 +34,12 @@ gtk_css_value_image_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_image_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_image_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssImage *image, *computed;
@@ -46,7 +48,7 @@ gtk_css_value_image_compute (GtkCssValue *value,
if (image == NULL)
return _gtk_css_value_ref (value);
- computed = _gtk_css_image_compute (image, property_id, context, dependencies);
+ computed = _gtk_css_image_compute (image, property_id, provider, values, parent_values, dependencies);
if (computed == image)
{
diff --git a/gtk/gtkcssinheritvalue.c b/gtk/gtkcssinheritvalue.c
index 585a976..296b1e3 100644
--- a/gtk/gtkcssinheritvalue.c
+++ b/gtk/gtkcssinheritvalue.c
@@ -34,23 +34,25 @@ gtk_css_value_inherit_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_inherit_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_inherit_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
- GtkStyleContext *parent = gtk_style_context_get_parent (context);
-
- if (parent)
+ if (parent_values)
{
*dependencies = GTK_CSS_EQUALS_PARENT;
- return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, property_id));
+ return _gtk_css_value_ref (_gtk_css_computed_values_get_value (parent_values, 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,
+ provider,
+ values,
+ parent_values,
dependencies);
}
}
diff --git a/gtk/gtkcssinitialvalue.c b/gtk/gtkcssinitialvalue.c
index d9d960f..36ca6a0 100644
--- a/gtk/gtkcssinitialvalue.c
+++ b/gtk/gtkcssinitialvalue.c
@@ -33,14 +33,18 @@ gtk_css_value_initial_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_initial_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_initial_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ 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,
+ provider,
+ values,
+ parent_values,
dependencies);
}
diff --git a/gtk/gtkcsskeyframes.c b/gtk/gtkcsskeyframes.c
index f25ccef..f909871 100644
--- a/gtk/gtkcsskeyframes.c
+++ b/gtk/gtkcsskeyframes.c
@@ -414,14 +414,18 @@ _gtk_css_keyframes_print (GtkCssKeyframes *keyframes,
}
GtkCssKeyframes *
-_gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
- GtkStyleContext *context)
+_gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values)
{
GtkCssKeyframes *resolved;
guint k, p;
g_return_val_if_fail (keyframes != NULL, NULL);
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+ g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
+ g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+ g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
resolved = gtk_css_keyframes_new ();
resolved->n_keyframes = keyframes->n_keyframes;
@@ -439,7 +443,9 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
KEYFRAMES_VALUE (resolved, k, p) = _gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
resolved->property_ids[p],
- context,
+ provider,
+ values,
+ parent_values,
NULL);
}
}
diff --git a/gtk/gtkcsskeyframesprivate.h b/gtk/gtkcsskeyframesprivate.h
index b08ce09..9ec76fe 100644
--- a/gtk/gtkcsskeyframesprivate.h
+++ b/gtk/gtkcsskeyframesprivate.h
@@ -36,8 +36,10 @@ void _gtk_css_keyframes_unref (GtkCssKeyframes
void _gtk_css_keyframes_print (GtkCssKeyframes *keyframes,
GString *string);
-GtkCssKeyframes * _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
- GtkStyleContext *context);
+GtkCssKeyframes * _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values);
guint _gtk_css_keyframes_get_n_properties (GtkCssKeyframes *keyframes);
guint _gtk_css_keyframes_get_property_id (GtkCssKeyframes *keyframes,
diff --git a/gtk/gtkcsslookup.c b/gtk/gtkcsslookup.c
index 67d7b1c..3b124ac 100644
--- a/gtk/gtkcsslookup.c
+++ b/gtk/gtkcsslookup.c
@@ -157,15 +157,17 @@ _gtk_css_lookup_set_computed (GtkCssLookup *lookup,
* an issue, go fix it.
**/
void
-_gtk_css_lookup_resolve (GtkCssLookup *lookup,
- GtkStyleContext *context,
- GtkCssComputedValues *values)
+_gtk_css_lookup_resolve (GtkCssLookup *lookup,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values)
{
guint i, n;
g_return_if_fail (lookup != NULL);
- g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+ g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
+ g_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values));
n = _gtk_css_style_property_get_n_properties ();
@@ -180,7 +182,8 @@ _gtk_css_lookup_resolve (GtkCssLookup *lookup,
else if (lookup->values[i].value ||
_gtk_bitmask_get (lookup->missing, i))
_gtk_css_computed_values_compute_value (values,
- context,
+ provider,
+ parent_values,
i,
lookup->values[i].value,
lookup->values[i].section);
diff --git a/gtk/gtkcsslookupprivate.h b/gtk/gtkcsslookupprivate.h
index 72b0b18..aed2d51 100644
--- a/gtk/gtkcsslookupprivate.h
+++ b/gtk/gtkcsslookupprivate.h
@@ -22,30 +22,30 @@
#include "gtk/gtkbitmaskprivate.h"
#include "gtk/gtkcsscomputedvaluesprivate.h"
#include "gtk/gtkcsssection.h"
-#include "gtk/gtkstylecontext.h"
G_BEGIN_DECLS
typedef struct _GtkCssLookup GtkCssLookup;
-GtkCssLookup * _gtk_css_lookup_new (const GtkBitmask *relevant);
-void _gtk_css_lookup_free (GtkCssLookup *lookup);
-
-const GtkBitmask * _gtk_css_lookup_get_missing (const GtkCssLookup *lookup);
-gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
- guint id);
-void _gtk_css_lookup_set (GtkCssLookup *lookup,
- guint id,
- GtkCssSection *section,
- GtkCssValue *value);
-void _gtk_css_lookup_set_computed (GtkCssLookup *lookup,
- guint id,
- GtkCssSection *section,
- GtkCssValue *value);
-void _gtk_css_lookup_resolve (GtkCssLookup *lookup,
- GtkStyleContext *context,
- GtkCssComputedValues *values);
+GtkCssLookup * _gtk_css_lookup_new (const GtkBitmask *relevant);
+void _gtk_css_lookup_free (GtkCssLookup *lookup);
+
+const GtkBitmask * _gtk_css_lookup_get_missing (const GtkCssLookup *lookup);
+gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
+ guint id);
+void _gtk_css_lookup_set (GtkCssLookup *lookup,
+ guint id,
+ GtkCssSection *section,
+ GtkCssValue *value);
+void _gtk_css_lookup_set_computed (GtkCssLookup *lookup,
+ guint id,
+ GtkCssSection *section,
+ GtkCssValue *value);
+void _gtk_css_lookup_resolve (GtkCssLookup *lookup,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values);
G_END_DECLS
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index c84bce6..58f4652 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -35,10 +35,12 @@ gtk_css_value_number_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_number_compute (GtkCssValue *number,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_number_compute (GtkCssValue *number,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkBorderStyle border_style;
@@ -46,27 +48,27 @@ gtk_css_value_number_compute (GtkCssValue *number,
switch (property_id)
{
case GTK_CSS_PROPERTY_BORDER_TOP_WIDTH:
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
+ border_style = _gtk_css_border_style_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_PX);
break;
case GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH:
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
+ border_style = _gtk_css_border_style_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_PX);
break;
case GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH:
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
+ border_style = _gtk_css_border_style_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_PX);
break;
case GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH:
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
+ border_style = _gtk_css_border_style_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_PX);
break;
case GTK_CSS_PROPERTY_OUTLINE_WIDTH:
- border_style = _gtk_css_border_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_OUTLINE_STYLE));
+ border_style = _gtk_css_border_style_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_OUTLINE_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_PX);
break;
@@ -107,14 +109,14 @@ gtk_css_value_number_compute (GtkCssValue *number,
case GTK_CSS_EM:
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
return _gtk_css_number_value_new (number->value *
- _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100),
+ _gtk_css_number_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_FONT_SIZE), 100),
GTK_CSS_PX);
break;
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
return _gtk_css_number_value_new (number->value * 0.5 *
- _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100),
+ _gtk_css_number_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_FONT_SIZE), 100),
GTK_CSS_PX);
case GTK_CSS_RAD:
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),
diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c
index 077ab84..6f33de7 100644
--- a/gtk/gtkcsspositionvalue.c
+++ b/gtk/gtkcsspositionvalue.c
@@ -37,16 +37,18 @@ gtk_css_value_position_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_position_compute (GtkCssValue *position,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_position_compute (GtkCssValue *position,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
- x = _gtk_css_value_compute (position->x, property_id, context, &x_deps);
- y = _gtk_css_value_compute (position->y, property_id, context, &y_deps);
+ x = _gtk_css_value_compute (position->x, property_id, provider, values, parent_values, &x_deps);
+ y = _gtk_css_value_compute (position->y, property_id, provider, values, parent_values, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
if (x == position->x && y == position->y)
{
diff --git a/gtk/gtkcssrepeatvalue.c b/gtk/gtkcssrepeatvalue.c
index b9387eb..eda6fef 100644
--- a/gtk/gtkcssrepeatvalue.c
+++ b/gtk/gtkcssrepeatvalue.c
@@ -34,10 +34,12 @@ gtk_css_value_repeat_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_repeat_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_repeat_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssrgbavalue.c b/gtk/gtkcssrgbavalue.c
index 99bcfa2..ccccac2 100644
--- a/gtk/gtkcssrgbavalue.c
+++ b/gtk/gtkcssrgbavalue.c
@@ -35,10 +35,12 @@ gtk_css_value_rgba_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_rgba_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_rgba_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssshadowsvalue.c b/gtk/gtkcssshadowsvalue.c
index d565d89..267c41c 100644
--- a/gtk/gtkcssshadowsvalue.c
+++ b/gtk/gtkcssshadowsvalue.c
@@ -48,10 +48,12 @@ gtk_css_value_shadows_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_shadows_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_shadows_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *result;
GtkCssDependencies child_deps;
@@ -63,7 +65,7 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
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, &child_deps);
+ result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
}
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 56ebe3a..be21597 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -61,32 +61,34 @@ gtk_css_value_shadow_free (GtkCssValue *shadow)
}
static GtkCssValue *
-gtk_css_value_shadow_compute (GtkCssValue *shadow,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_shadow_compute (GtkCssValue *shadow,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *hoffset, *voffset, *radius, *spread, *color;
GtkCssDependencies child_deps;
child_deps = 0;
- hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, context, &child_deps);
+ hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0;
- voffset = _gtk_css_value_compute (shadow->voffset, property_id, context, &child_deps);
+ voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0;
- radius = _gtk_css_value_compute (shadow->radius, property_id, context, &child_deps);
+ radius = _gtk_css_value_compute (shadow->radius, property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0;
- spread = _gtk_css_value_compute (shadow->spread, property_id, context, &child_deps),
+ spread = _gtk_css_value_compute (shadow->spread, property_id, provider, values, parent_values, &child_deps),
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0;
- color = _gtk_css_value_compute (shadow->color, property_id, context, &child_deps);
+ color = _gtk_css_value_compute (shadow->color, property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index 02405f4..82e7c37 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -34,10 +34,12 @@ gtk_css_value_string_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_string_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_string_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c
index e893a2c..182837a 100644
--- a/gtk/gtkcssstylefuncs.c
+++ b/gtk/gtkcssstylefuncs.c
@@ -29,6 +29,7 @@
#include "gtkcssimagegradientprivate.h"
#include "gtkcssprovider.h"
+#include "gtkcssrgbavalueprivate.h"
#include "gtkcsstypedvalueprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkgradient.h"
@@ -49,13 +50,15 @@ static GHashTable *parse_funcs = NULL;
static GHashTable *print_funcs = NULL;
static GHashTable *compute_funcs = NULL;
-typedef gboolean (* GtkStyleParseFunc) (GtkCssParser *parser,
- GValue *value);
-typedef void (* GtkStylePrintFunc) (const GValue *value,
- GString *string);
-typedef GtkCssValue * (* GtkStyleComputeFunc) (GtkStyleContext *context,
- GtkCssValue *specified,
- GtkCssDependencies *dependencies);
+typedef gboolean (* GtkStyleParseFunc) (GtkCssParser *parser,
+ GValue *value);
+typedef void (* GtkStylePrintFunc) (const GValue *value,
+ GString *string);
+typedef GtkCssValue * (* GtkStyleComputeFunc) (GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssValue *specified,
+ GtkCssDependencies *dependencies);
static void
register_conversion_function (GType type,
@@ -204,9 +207,11 @@ rgba_value_print (const GValue *value,
}
static GtkCssValue *
-rgba_value_compute (GtkStyleContext *context,
- GtkCssValue *specified,
- GtkCssDependencies *dependencies)
+rgba_value_compute (GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssValue *specified,
+ GtkCssDependencies *dependencies)
{
GdkRGBA white = { 1, 1, 1, 1 };
const GValue *value;
@@ -216,10 +221,21 @@ rgba_value_compute (GtkStyleContext *context,
if (G_VALUE_HOLDS (value, GTK_TYPE_SYMBOLIC_COLOR))
{
GtkSymbolicColor *symbolic = g_value_get_boxed (value);
+ GtkCssValue *val;
GValue new_value = G_VALUE_INIT;
GdkRGBA rgba;
- if (!_gtk_style_context_resolve_color (context, symbolic, &rgba, dependencies))
+ val = _gtk_symbolic_color_resolve_full (symbolic,
+ provider,
+ _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
+ GTK_CSS_DEPENDS_ON_COLOR,
+ dependencies);
+ if (val != NULL)
+ {
+ rgba = *_gtk_css_rgba_value_get_rgba (val);
+ _gtk_css_value_unref (val);
+ }
+ else
rgba = white;
g_value_init (&new_value, GDK_TYPE_RGBA);
@@ -278,11 +294,12 @@ color_value_print (const GValue *value,
}
static GtkCssValue *
-color_value_compute (GtkStyleContext *context,
- GtkCssValue *specified,
- GtkCssDependencies *dependencies)
+color_value_compute (GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssValue *specified,
+ GtkCssDependencies *dependencies)
{
- GdkRGBA rgba;
GdkColor color = { 0, 65535, 65535, 65535 };
const GValue *value;
@@ -291,15 +308,20 @@ color_value_compute (GtkStyleContext *context,
if (G_VALUE_HOLDS (value, GTK_TYPE_SYMBOLIC_COLOR))
{
GValue new_value = G_VALUE_INIT;
-
- if (_gtk_style_context_resolve_color (context,
- g_value_get_boxed (value),
- &rgba,
- dependencies))
+ GtkCssValue *val;
+
+ val = _gtk_symbolic_color_resolve_full ((GtkSymbolicColor *) g_value_get_boxed (value),
+ provider,
+ _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
+ GTK_CSS_DEPENDS_ON_COLOR,
+ dependencies);
+ if (val != NULL)
{
- color.red = rgba.red * 65535. + 0.5;
- color.green = rgba.green * 65535. + 0.5;
- color.blue = rgba.blue * 65535. + 0.5;
+ const GdkRGBA *rgba = _gtk_css_rgba_value_get_rgba (val);
+ color.red = rgba->red * 65535. + 0.5;
+ color.green = rgba->green * 65535. + 0.5;
+ color.blue = rgba->blue * 65535. + 0.5;
+ _gtk_css_value_unref (val);
}
g_value_init (&new_value, GDK_TYPE_COLOR);
@@ -822,9 +844,11 @@ pattern_value_print (const GValue *value,
}
static GtkCssValue *
-pattern_value_compute (GtkStyleContext *context,
- GtkCssValue *specified,
- GtkCssDependencies *dependencies)
+pattern_value_compute (GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssValue *specified,
+ GtkCssDependencies *dependencies)
{
const GValue *value = _gtk_css_typed_value_get (specified);
@@ -833,7 +857,7 @@ pattern_value_compute (GtkStyleContext *context,
GValue new_value = G_VALUE_INIT;
cairo_pattern_t *gradient;
- gradient = _gtk_gradient_resolve_full (g_value_get_boxed (value), context, dependencies);
+ gradient = _gtk_gradient_resolve_full (g_value_get_boxed (value), provider, values, parent_values, dependencies);
g_value_init (&new_value, CAIRO_GOBJECT_TYPE_PATTERN);
g_value_take_boxed (&new_value, gradient);
@@ -1088,7 +1112,9 @@ _gtk_css_style_print_value (const GValue *value,
/**
* _gtk_css_style_compute_value:
- * @context: the context to use for computing the value
+ * @provider: Style provider to look up information from
+ * @values: The values to compute for
+ * @parent_values: Values to look up inherited values from
* @target_type: Type the resulting value should have
* @specified: the value to use for the computation
* @dependencies: (out): Value initialized with 0 to take the dependencies
@@ -1102,14 +1128,18 @@ _gtk_css_style_print_value (const GValue *value,
* Returns: the resulting value
**/
GtkCssValue *
-_gtk_css_style_compute_value (GtkStyleContext *context,
- GType target_type,
- GtkCssValue *specified,
- GtkCssDependencies *dependencies)
+_gtk_css_style_compute_value (GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GType target_type,
+ GtkCssValue *specified,
+ GtkCssDependencies *dependencies)
{
GtkStyleComputeFunc func;
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+ g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
+ g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+ g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
g_return_val_if_fail (*dependencies == 0, NULL);
gtk_css_style_funcs_init ();
@@ -1121,7 +1151,7 @@ _gtk_css_style_compute_value (GtkStyleContext *context,
GSIZE_TO_POINTER (g_type_fundamental (target_type)));
if (func)
- return func (context, specified, dependencies);
+ return func (provider, values, parent_values, specified, dependencies);
else
return _gtk_css_value_ref (specified);
}
diff --git a/gtk/gtkcssstylefuncsprivate.h b/gtk/gtkcssstylefuncsprivate.h
index e4f1ec4..df13b80 100644
--- a/gtk/gtkcssstylefuncsprivate.h
+++ b/gtk/gtkcssstylefuncsprivate.h
@@ -24,14 +24,16 @@
G_BEGIN_DECLS
-gboolean _gtk_css_style_parse_value (GValue *value,
- GtkCssParser *parser);
-void _gtk_css_style_print_value (const GValue *value,
- GString *string);
-GtkCssValue * _gtk_css_style_compute_value (GtkStyleContext *context,
- GType target_type,
- GtkCssValue *specified,
- GtkCssDependencies *dependencies);
+gboolean _gtk_css_style_parse_value (GValue *value,
+ GtkCssParser *parser);
+void _gtk_css_style_print_value (const GValue *value,
+ GString *string);
+GtkCssValue * _gtk_css_style_compute_value (GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GType target_type,
+ GtkCssValue *specified,
+ GtkCssDependencies *dependencies);
G_END_DECLS
diff --git a/gtk/gtkcsstypedvalue.c b/gtk/gtkcsstypedvalue.c
index 5ce5eff..aecee31 100644
--- a/gtk/gtkcsstypedvalue.c
+++ b/gtk/gtkcsstypedvalue.c
@@ -35,14 +35,16 @@ gtk_css_value_typed_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_typed_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_typed_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (_gtk_css_style_property_lookup_by_id (property_id));
- return _gtk_css_style_compute_value (context, custom->pspec->value_type, value, dependencies);
+ return _gtk_css_style_compute_value (provider, values, parent_values, custom->pspec->value_type, value, dependencies);
}
static gboolean
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index 0dcbe0c..c5e5bdc 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -19,6 +19,9 @@
#include "gtkcssvalueprivate.h"
+#include "gtkcsscomputedvaluesprivate.h"
+#include "gtkstyleproviderprivate.h"
+
struct _GtkCssValue {
GTK_CSS_VALUE_BASE
};
@@ -65,7 +68,9 @@ _gtk_css_value_unref (GtkCssValue *value)
* _gtk_css_value_compute:
* @value: the value to compute from
* @property_id: the ID of the property to compute
- * @context: the context to use for resolving
+ * @provider: Style provider for looking up extra information
+ * @values: values to compute for
+ * @parent_values: parent values to use for inherited values
* @dependencies: (out) (allow-none): Set to the dependencies of the
* computed values that indicate when this value needs to be
* recomputed and how.
@@ -79,21 +84,25 @@ _gtk_css_value_unref (GtkCssValue *value)
* Returns: the computed value
**/
GtkCssValue *
-_gtk_css_value_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+_gtk_css_value_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssDependencies fallback;
g_return_val_if_fail (value != NULL, NULL);
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+ g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
+ g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+ g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
if (dependencies == NULL)
dependencies = &fallback;
*dependencies = 0;
- return value->class->compute (value, property_id, context, dependencies);
+ return value->class->compute (value, property_id, provider, values, parent_values, dependencies);
}
gboolean
diff --git a/gtk/gtkcssvalueprivate.h b/gtk/gtkcssvalueprivate.h
index 35a0f7f..1d2424e 100644
--- a/gtk/gtkcssvalueprivate.h
+++ b/gtk/gtkcssvalueprivate.h
@@ -22,7 +22,6 @@
#include <glib-object.h>
#include "gtkcsstypesprivate.h"
-#include "gtktypes.h"
G_BEGIN_DECLS
@@ -43,7 +42,9 @@ struct _GtkCssValueClass {
GtkCssValue * (* compute) (GtkCssValue *value,
guint property_id,
- GtkStyleContext *context,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies);
gboolean (* equal) (const GtkCssValue *value1,
const GtkCssValue *value2);
@@ -66,7 +67,9 @@ void _gtk_css_value_unref (GtkCssValue
GtkCssValue *_gtk_css_value_compute (GtkCssValue *value,
guint property_id,
- GtkStyleContext *context,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies);
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
const GtkCssValue *value2);
diff --git a/gtk/gtkgradient.c b/gtk/gtkgradient.c
index ba4e303..1586757 100644
--- a/gtk/gtkgradient.c
+++ b/gtk/gtkgradient.c
@@ -17,9 +17,10 @@
#include "config.h"
#include "gtkgradient.h"
+#include "gtkcssrgbavalueprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkstyleproperties.h"
-#include "gtkintl.h"
+#include "gtkstylepropertiesprivate.h"
/**
* SECTION:gtkgradient
@@ -281,15 +282,19 @@ gtk_gradient_resolve (GtkGradient *gradient,
}
cairo_pattern_t *
-_gtk_gradient_resolve_full (GtkGradient *gradient,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+_gtk_gradient_resolve_full (GtkGradient *gradient,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
cairo_pattern_t *pattern;
guint i;
g_return_val_if_fail (gradient != NULL, NULL);
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+ g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
+ g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+ g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
g_return_val_if_fail (*dependencies == 0, NULL);
if (gradient->radius0 == 0 && gradient->radius1 == 0)
@@ -304,16 +309,28 @@ _gtk_gradient_resolve_full (GtkGradient *gradient,
for (i = 0; i < gradient->stops->len; i++)
{
ColorStop *stop;
+ GtkCssValue *val;
GdkRGBA rgba;
GtkCssDependencies stop_deps;
stop = &g_array_index (gradient->stops, ColorStop, i);
/* if color resolving fails, assume transparency */
- if (!_gtk_style_context_resolve_color (context, stop->color, &rgba, &stop_deps))
- rgba.red = rgba.green = rgba.blue = rgba.alpha = 0.0;
+ val = _gtk_symbolic_color_resolve_full (stop->color,
+ provider,
+ _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
+ GTK_CSS_DEPENDS_ON_COLOR,
+ &stop_deps);
+ if (val)
+ {
+ rgba = *_gtk_css_rgba_value_get_rgba (val);
+ *dependencies = _gtk_css_dependencies_union (*dependencies, stop_deps);
+ }
+ else
+ {
+ rgba.red = rgba.green = rgba.blue = rgba.alpha = 0.0;
+ }
- *dependencies = _gtk_css_dependencies_union (*dependencies, stop_deps);
cairo_pattern_add_color_stop_rgba (pattern, stop->offset,
rgba.red, rgba.green,
rgba.blue, rgba.alpha);
@@ -322,18 +339,6 @@ _gtk_gradient_resolve_full (GtkGradient *gradient,
return pattern;
}
-cairo_pattern_t *
-gtk_gradient_resolve_for_context (GtkGradient *gradient,
- GtkStyleContext *context)
-{
- GtkCssDependencies ignored = 0;
-
- g_return_val_if_fail (gradient != NULL, NULL);
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-
- return _gtk_gradient_resolve_full (gradient, context, &ignored);
-}
-
static void
append_number (GString *str,
double d,
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 99b2091..ebaeb1b 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -697,14 +697,6 @@ gtk_style_context_set_cascade (GtkStyleContext *context,
gtk_style_context_cascade_changed (cascade, context);
}
-GtkStyleProviderPrivate *
-_gtk_style_context_get_style_provider (GtkStyleContext *context)
-{
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-
- return GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade);
-}
-
static void
gtk_style_context_init (GtkStyleContext *style_context)
{
@@ -987,7 +979,10 @@ build_properties (GtkStyleContext *context,
&matcher,
lookup);
- _gtk_css_lookup_resolve (lookup, context, values);
+ _gtk_css_lookup_resolve (lookup,
+ GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+ values,
+ priv->parent ? style_data_lookup (priv->parent)->store : NULL);
_gtk_css_lookup_free (lookup);
gtk_widget_path_free (path);
@@ -3146,9 +3141,10 @@ _gtk_style_context_validate (GtkStyleContext *context,
data = style_data_lookup (context);
_gtk_css_computed_values_create_animations (data->store,
+ priv->parent ? style_data_lookup (priv->parent)->store : NULL,
timestamp,
- current && gtk_style_context_should_create_transitions (context) ? current->store : NULL,
- context);
+ GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+ current && gtk_style_context_should_create_transitions (context) ? current->store : NULL);
if (_gtk_css_computed_values_is_static (data->store))
change &= ~GTK_CSS_CHANGE_ANIMATE;
else
@@ -4584,3 +4580,21 @@ _gtk_style_context_get_attributes (AtkAttributeSet *attributes,
return attributes;
}
+
+cairo_pattern_t *
+gtk_gradient_resolve_for_context (GtkGradient *gradient,
+ GtkStyleContext *context)
+{
+ GtkStyleContextPrivate *priv = context->priv;
+ GtkCssDependencies ignored = 0;
+
+ g_return_val_if_fail (gradient != NULL, NULL);
+ g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+
+ return _gtk_gradient_resolve_full (gradient,
+ GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+ style_data_lookup (context)->store,
+ priv->parent ? style_data_lookup (priv->parent)->store : NULL,
+ &ignored);
+}
+
diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h
index bd73dfc..7987b71 100644
--- a/gtk/gtkstylecontextprivate.h
+++ b/gtk/gtkstylecontextprivate.h
@@ -58,9 +58,6 @@ void _gtk_style_context_get_cursor_color (GtkStyleContext
GdkRGBA *primary_color,
GdkRGBA *secondary_color);
-GtkStyleProviderPrivate *
- _gtk_style_context_get_style_provider (GtkStyleContext *context);
-
void _gtk_style_context_update_animating (GtkStyleContext *context);
G_END_DECLS
diff --git a/gtk/gtkstylepropertiesprivate.h b/gtk/gtkstylepropertiesprivate.h
index d459307..2e1bd97 100644
--- a/gtk/gtkstylepropertiesprivate.h
+++ b/gtk/gtkstylepropertiesprivate.h
@@ -34,9 +34,11 @@ void _gtk_style_properties_set_property_by_property (GtkStylePropertie
GtkCssValue *value);
cairo_pattern_t *
- _gtk_gradient_resolve_full (GtkGradient *gradient,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies);
+ _gtk_gradient_resolve_full (GtkGradient *gradient,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies);
G_END_DECLS
diff --git a/gtk/gtksymboliccolor.c b/gtk/gtksymboliccolor.c
index 6a7b4c1..e68eb91 100644
--- a/gtk/gtksymboliccolor.c
+++ b/gtk/gtksymboliccolor.c
@@ -120,8 +120,10 @@ gtk_css_value_symbolic_free (GtkCssValue *value)
}
static GtkCssValue *
-gtk_css_value_symbolic_get_fallback (guint property_id,
- GtkStyleContext *context)
+gtk_css_value_symbolic_get_fallback (guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values)
{
static const GdkRGBA transparent = { 0, 0, 0, 0 };
@@ -142,7 +144,9 @@ 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,
+ provider,
+ values,
+ parent_values,
NULL);
default:
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
@@ -153,10 +157,12 @@ gtk_css_value_symbolic_get_fallback (guint property_id,
}
static GtkCssValue *
-gtk_css_value_symbolic_compute (GtkCssValue *value,
- guint property_id,
- GtkStyleContext *context,
- GtkCssDependencies *dependencies)
+gtk_css_value_symbolic_compute (GtkCssValue *value,
+ guint property_id,
+ GtkStyleProviderPrivate *provider,
+ GtkCssComputedValues *values,
+ GtkCssComputedValues *parent_values,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *resolved, *current;
GtkCssDependencies current_deps;
@@ -167,11 +173,9 @@ gtk_css_value_symbolic_compute (GtkCssValue *value,
*/
if (property_id == GTK_CSS_PROPERTY_COLOR)
{
- GtkStyleContext *parent = gtk_style_context_get_parent (context);
-
- if (parent)
+ if (parent_values)
{
- current = _gtk_style_context_peek_property (parent, GTK_CSS_PROPERTY_COLOR);
+ current = _gtk_css_computed_values_get_value (parent_values, GTK_CSS_PROPERTY_COLOR);
current_deps = GTK_CSS_EQUALS_PARENT;
}
else
@@ -182,14 +186,18 @@ gtk_css_value_symbolic_compute (GtkCssValue *value,
}
else
{
- current = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR);
+ current = _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR);
current_deps = GTK_CSS_DEPENDS_ON_COLOR;
}
- resolved = _gtk_style_context_resolve_color_value (context, current, current_deps, value, dependencies);
+ resolved = _gtk_symbolic_color_resolve_full ((GtkSymbolicColor *) value,
+ provider,
+ current,
+ current_deps,
+ dependencies);
if (resolved == NULL)
- return gtk_css_value_symbolic_get_fallback (property_id, context);
+ return gtk_css_value_symbolic_get_fallback (property_id, provider, values, parent_values);
return resolved;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]