cssvalue: Pass an extra GtkCssVariableSet to compute()

We'll need this to support variables in @keyframes, since styles will
need to combine their own variables and the ones from the keyframes.

See the next commit, this one is split out to avoid a huge diff.
This commit is contained in:
Alice Mikhaylenko 2024-03-20 22:50:52 +04:00
parent 08a48dd97e
commit e1ac97a185
40 changed files with 355 additions and 290 deletions

View File

@ -41,11 +41,12 @@ gtk_css_value_array_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_array_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_array_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *result;
GtkCssValue *i_value;
@ -54,7 +55,7 @@ gtk_css_value_array_compute (GtkCssValue *value,
result = NULL;
for (i = 0; i < value->n_values; i++)
{
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, variables);
if (result == NULL &&
i_value != value->values[i])

View File

@ -41,11 +41,12 @@ gtk_css_value_bg_size_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_bg_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_bg_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *x, *y;
@ -55,10 +56,10 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
x = y = NULL;
if (value->x)
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style);
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style, variables);
if (value->y)
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style);
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style, variables);
if (x == value->x && y == value->y)
{

View File

@ -42,11 +42,12 @@ gtk_css_value_border_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_border_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_border_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *values[4];
GtkCssValue *computed;
@ -57,7 +58,7 @@ gtk_css_value_border_compute (GtkCssValue *value,
{
if (value->values[i])
{
values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, variables);
changed |= (values[i] != value->values[i]);
}
else

View File

@ -94,10 +94,11 @@ gtk_css_value_color_free (GtkCssValue *color)
}
static GtkCssValue *
gtk_css_value_color_get_fallback (guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_color_get_fallback (guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
switch (property_id)
{
@ -120,7 +121,8 @@ gtk_css_value_color_get_fallback (guint property_id,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
case GTK_CSS_PROPERTY_ICON_PALETTE:
return _gtk_css_value_ref (style->core->color);
default:
@ -132,11 +134,12 @@ gtk_css_value_color_get_fallback (guint property_id,
}
static GtkCssValue *
gtk_css_value_color_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_color_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *resolved;
@ -173,7 +176,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
}
if (resolved == NULL)
return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style);
return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style, variables);
return resolved;
}

View File

@ -37,16 +37,17 @@ gtk_css_value_corner_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_corner_compute (GtkCssValue *corner,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_corner_compute (GtkCssValue *corner,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *x, *y;
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style);
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style);
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style, variables);
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style, variables);
if (x == corner->x && y == corner->y)
{
_gtk_css_value_unref (x);

View File

@ -50,11 +50,12 @@ gtk_css_value_ease_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_ease_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_ease_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
return _gtk_css_value_ref (value);
}

View File

@ -41,11 +41,12 @@ gtk_css_value_enum_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_enum_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_enum_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
return _gtk_css_value_ref (value);
}
@ -229,11 +230,12 @@ gtk_css_font_size_get_default_px (GtkStyleProvider *provider,
}
static GtkCssValue *
gtk_css_value_font_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_font_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
double font_size;
@ -396,11 +398,12 @@ _gtk_css_font_style_value_get (const GtkCssValue *value)
#define LIGHTER -2
static GtkCssValue *
gtk_css_value_font_weight_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_font_weight_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
PangoWeight new_weight;
int parent_value;

View File

@ -307,55 +307,56 @@ gtk_css_value_filter_free (GtkCssValue *value)
/* returns TRUE if dest == src */
static gboolean
gtk_css_filter_compute (GtkCssFilter *dest,
GtkCssFilter *src,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_filter_compute (GtkCssFilter *dest,
GtkCssFilter *src,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
dest->type = src->type;
switch (src->type)
{
case GTK_CSS_FILTER_BRIGHTNESS:
dest->brightness.value = _gtk_css_value_compute (src->brightness.value, property_id, provider, style, parent_style);
dest->brightness.value = _gtk_css_value_compute (src->brightness.value, property_id, provider, style, parent_style, variables);
return dest->brightness.value == src->brightness.value;
case GTK_CSS_FILTER_CONTRAST:
dest->contrast.value = _gtk_css_value_compute (src->contrast.value, property_id, provider, style, parent_style);
dest->contrast.value = _gtk_css_value_compute (src->contrast.value, property_id, provider, style, parent_style, variables);
return dest->contrast.value == src->contrast.value;
case GTK_CSS_FILTER_GRAYSCALE:
dest->grayscale.value = _gtk_css_value_compute (src->grayscale.value, property_id, provider, style, parent_style);
dest->grayscale.value = _gtk_css_value_compute (src->grayscale.value, property_id, provider, style, parent_style, variables);
return dest->grayscale.value == src->grayscale.value;
case GTK_CSS_FILTER_HUE_ROTATE:
dest->hue_rotate.value = _gtk_css_value_compute (src->hue_rotate.value, property_id, provider, style, parent_style);
dest->hue_rotate.value = _gtk_css_value_compute (src->hue_rotate.value, property_id, provider, style, parent_style, variables);
return dest->hue_rotate.value == src->hue_rotate.value;
case GTK_CSS_FILTER_INVERT:
dest->invert.value = _gtk_css_value_compute (src->invert.value, property_id, provider, style, parent_style);
dest->invert.value = _gtk_css_value_compute (src->invert.value, property_id, provider, style, parent_style, variables);
return dest->invert.value == src->invert.value;
case GTK_CSS_FILTER_OPACITY:
dest->opacity.value = _gtk_css_value_compute (src->opacity.value, property_id, provider, style, parent_style);
dest->opacity.value = _gtk_css_value_compute (src->opacity.value, property_id, provider, style, parent_style, variables);
return dest->opacity.value == src->opacity.value;
case GTK_CSS_FILTER_SATURATE:
dest->saturate.value = _gtk_css_value_compute (src->saturate.value, property_id, provider, style, parent_style);
dest->saturate.value = _gtk_css_value_compute (src->saturate.value, property_id, provider, style, parent_style, variables);
return dest->saturate.value == src->saturate.value;
case GTK_CSS_FILTER_SEPIA:
dest->sepia.value = _gtk_css_value_compute (src->sepia.value, property_id, provider, style, parent_style);
dest->sepia.value = _gtk_css_value_compute (src->sepia.value, property_id, provider, style, parent_style, variables);
return dest->sepia.value == src->sepia.value;
case GTK_CSS_FILTER_BLUR:
dest->blur.value = _gtk_css_value_compute (src->blur.value, property_id, provider, style, parent_style);
dest->blur.value = _gtk_css_value_compute (src->blur.value, property_id, provider, style, parent_style, variables);
return dest->blur.value == src->blur.value;
case GTK_CSS_FILTER_DROP_SHADOW:
dest->drop_shadow.value = _gtk_css_value_compute (src->drop_shadow.value, property_id, provider, style, parent_style);
dest->drop_shadow.value = _gtk_css_value_compute (src->drop_shadow.value, property_id, provider, style, parent_style, variables);
return dest->drop_shadow.value == src->drop_shadow.value;
case GTK_CSS_FILTER_NONE:
@ -366,11 +367,12 @@ gtk_css_filter_compute (GtkCssFilter *dest,
}
static GtkCssValue *
gtk_css_value_filter_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_filter_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *result;
gboolean changes;
@ -390,7 +392,8 @@ gtk_css_value_filter_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
}
if (!changes)

View File

@ -53,11 +53,12 @@ gtk_css_value_font_features_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_font_features_compute (GtkCssValue *specified,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_font_features_compute (GtkCssValue *specified,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
return _gtk_css_value_ref (specified);
}

View File

@ -52,11 +52,12 @@ gtk_css_value_font_variations_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_font_variations_compute (GtkCssValue *specified,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_font_variations_compute (GtkCssValue *specified,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
return _gtk_css_value_ref (specified);
}

View File

@ -65,11 +65,12 @@ gtk_css_image_real_get_aspect_ratio (GtkCssImage *image)
}
static GtkCssImage *
gtk_css_image_real_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_real_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
return g_object_ref (image);
}
@ -173,11 +174,12 @@ _gtk_css_image_get_aspect_ratio (GtkCssImage *image)
}
GtkCssImage *
_gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
_gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageClass *klass;
@ -187,7 +189,7 @@ _gtk_css_image_compute (GtkCssImage *image,
klass = GTK_CSS_IMAGE_GET_CLASS (image);
return klass->compute (image, property_id, provider, style, parent_style);
return klass->compute (image, property_id, provider, style, parent_style, variables);
}
GtkCssImage *

View File

@ -313,11 +313,12 @@ gtk_css_image_conic_print (GtkCssImage *image,
}
static GtkCssImage *
gtk_css_image_conic_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_conic_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageConic *self = GTK_CSS_IMAGE_CONIC (image);
GtkCssImageConic *copy;
@ -325,8 +326,8 @@ gtk_css_image_conic_compute (GtkCssImage *image,
copy = g_object_new (GTK_TYPE_CSS_IMAGE_CONIC, NULL);
copy->center = _gtk_css_value_compute (self->center, property_id, provider, style, parent_style);
copy->rotation = _gtk_css_value_compute (self->rotation, property_id, provider, style, parent_style);
copy->center = _gtk_css_value_compute (self->center, property_id, provider, style, parent_style, variables);
copy->rotation = _gtk_css_value_compute (self->rotation, property_id, provider, style, parent_style, variables);
copy->n_stops = self->n_stops;
copy->color_stops = g_malloc (sizeof (GtkCssImageConicColorStop) * copy->n_stops);
@ -335,11 +336,11 @@ gtk_css_image_conic_compute (GtkCssImage *image,
const GtkCssImageConicColorStop *stop = &self->color_stops[i];
GtkCssImageConicColorStop *scopy = &copy->color_stops[i];
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
if (stop->offset)
{
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
}
else
{

View File

@ -399,11 +399,12 @@ gtk_css_image_cross_fade_print (GtkCssImage *image,
}
static GtkCssImage *
gtk_css_image_cross_fade_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_cross_fade_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageCrossFade *self = GTK_CSS_IMAGE_CROSS_FADE (image);
GtkCssImageCrossFade *result;
@ -418,7 +419,7 @@ gtk_css_image_cross_fade_compute (GtkCssImage *image,
gtk_css_image_cross_fade_add (result,
entry->has_progress,
entry->progress,
_gtk_css_image_compute (entry->image, property_id, provider, style, parent_style));
_gtk_css_image_compute (entry->image, property_id, provider, style, parent_style, variables));
}
return GTK_CSS_IMAGE (result);

View File

@ -133,11 +133,12 @@ gtk_css_image_fallback_dispose (GObject *object)
static GtkCssImage *
gtk_css_image_fallback_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_fallback_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
GtkCssImageFallback *copy;
@ -152,7 +153,8 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
/* image($color) that didn't change */
if (computed_color && !fallback->images &&
@ -168,7 +170,8 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
if (gtk_css_image_is_invalid (copy->images[i]))
continue;

View File

@ -138,11 +138,12 @@ gtk_css_image_icon_theme_print (GtkCssImage *image,
}
static GtkCssImage *
gtk_css_image_icon_theme_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_icon_theme_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
GtkCssImageIconTheme *copy;

View File

@ -488,11 +488,12 @@ gtk_css_image_linear_print (GtkCssImage *image,
}
static GtkCssImage *
gtk_css_image_linear_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_linear_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
GtkCssImageLinear *copy;
@ -503,7 +504,7 @@ gtk_css_image_linear_compute (GtkCssImage *image,
copy->side = linear->side;
if (linear->angle)
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style);
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style, variables);
copy->n_stops = linear->n_stops;
copy->color_stops = g_malloc (sizeof (GtkCssImageLinearColorStop) * copy->n_stops);
@ -512,11 +513,11 @@ gtk_css_image_linear_compute (GtkCssImage *image,
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
GtkCssImageLinearColorStop *scopy = &copy->color_stops[i];
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
if (stop->offset)
{
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
}
else
{

View File

@ -96,11 +96,12 @@ gtk_css_image_paintable_get_static_image (GtkCssImage *image)
}
static GtkCssImage *
gtk_css_image_paintable_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_paintable_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
return gtk_css_image_paintable_get_static_image (image);
}

View File

@ -26,6 +26,7 @@
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtk/gtkcsstypesprivate.h"
#include "gtk/gtkcssvariablesetprivate.h"
#include "gtk/gtksnapshot.h"
#include "gtk/gtkstyleprovider.h"
@ -62,7 +63,8 @@ struct _GtkCssImageClass
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style);
GtkCssStyle *parent_style,
GtkCssVariableSet *variables);
/* compare two images for equality */
gboolean (* equal) (GtkCssImage *image1,
GtkCssImage *image2);
@ -106,7 +108,8 @@ GtkCssImage * _gtk_css_image_compute (GtkCssImage *
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style);
GtkCssStyle *parent_style,
GtkCssVariableSet *variables);
gboolean _gtk_css_image_equal (GtkCssImage *image1,
GtkCssImage *image2) G_GNUC_PURE;
GtkCssImage * _gtk_css_image_transition (GtkCssImage *start,

View File

@ -489,11 +489,12 @@ gtk_css_image_radial_print (GtkCssImage *image,
}
static GtkCssImage *
gtk_css_image_radial_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_radial_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
GtkCssImageRadial *copy;
@ -504,13 +505,13 @@ gtk_css_image_radial_compute (GtkCssImage *image,
copy->circle = radial->circle;
copy->size = radial->size;
copy->position = _gtk_css_value_compute (radial->position, property_id, provider, style, parent_style);
copy->position = _gtk_css_value_compute (radial->position, property_id, provider, style, parent_style, variables);
if (radial->sizes[0])
copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style);
copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style, variables);
if (radial->sizes[1])
copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style);
copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style, variables);
copy->n_stops = radial->n_stops;
copy->color_stops = g_malloc (sizeof (GtkCssImageRadialColorStop) * copy->n_stops);
@ -519,11 +520,11 @@ gtk_css_image_radial_compute (GtkCssImage *image,
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
GtkCssImageRadialColorStop *scopy = &copy->color_stops[i];
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
if (stop->offset)
{
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
}
else
{

View File

@ -201,11 +201,12 @@ gtk_css_image_recolor_snapshot (GtkCssImage *image,
}
static GtkCssImage *
gtk_css_image_recolor_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_recolor_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
GtkCssValue *palette;
@ -216,7 +217,7 @@ gtk_css_image_recolor_compute (GtkCssImage *image,
scale = gtk_style_provider_get_scale (provider);
if (recolor->palette)
palette = _gtk_css_value_compute (recolor->palette, property_id, provider, style, parent_style);
palette = _gtk_css_value_compute (recolor->palette, property_id, provider, style, parent_style, variables);
else
palette = _gtk_css_value_ref (style->core->icon_palette);

View File

@ -97,11 +97,12 @@ gtk_css_image_scaled_dispose (GObject *object)
static GtkCssImage *
gtk_css_image_scaled_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_scaled_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
int scale;
@ -137,7 +138,8 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
res->scales[0] = scaled->scales[best];
return GTK_CSS_IMAGE (res);

View File

@ -112,11 +112,12 @@ gtk_css_image_url_snapshot (GtkCssImage *image,
}
static GtkCssImage *
gtk_css_image_url_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_image_url_compute (GtkCssImage *image,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
GtkCssImage *copy;

View File

@ -34,11 +34,12 @@ gtk_css_value_image_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_image_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_image_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssImage *image, *computed;
@ -47,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, provider, style, parent_style);
computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style, variables);
if (computed == image)
{

View File

@ -34,11 +34,12 @@ gtk_css_value_inherit_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_inherit_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_inherit_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
if (parent_style)
{
@ -50,7 +51,8 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
}
}

View File

@ -38,11 +38,12 @@ gtk_css_value_initial_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkSettings *settings;
@ -75,7 +76,8 @@ gtk_css_value_initial_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
}
static gboolean
@ -135,5 +137,6 @@ _gtk_css_initial_value_new_compute (guint property_id,
property_id,
provider,
style,
parent_style);
parent_style,
NULL);
}

View File

@ -461,7 +461,8 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
resolved->property_ids[p],
provider,
style,
parent_style);
parent_style,
NULL);
}
}

View File

@ -39,15 +39,16 @@ gtk_css_value_line_height_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_line_height_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_line_height_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *height;
height = _gtk_css_value_compute (value->height, property_id, provider, style, parent_style);
height = _gtk_css_value_compute (value->height, property_id, provider, style, parent_style, variables);
if (gtk_css_number_value_get_dimension (height) == GTK_CSS_DIMENSION_PERCENTAGE)
{

View File

@ -108,11 +108,12 @@ get_base_font_size_px (guint property_id,
}
static GtkCssValue *
gtk_css_value_number_compute (GtkCssValue *number,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_number_compute (GtkCssValue *number,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
double value;
@ -130,7 +131,8 @@ gtk_css_value_number_compute (GtkCssValue *number,
{
GtkCssValue *computed = _gtk_css_value_compute (number->calc.terms[i],
property_id, provider, style,
parent_style);
parent_style,
variables);
changed |= computed != number->calc.terms[i];
new_values[i] = computed;
}

View File

@ -103,11 +103,12 @@ gtk_css_value_palette_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_palette_compute (GtkCssValue *specified,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_palette_compute (GtkCssValue *specified,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *computed_color;
GtkCssValue *result;
@ -120,7 +121,7 @@ gtk_css_value_palette_compute (GtkCssValue *specified,
{
GtkCssValue *value = specified->color_values[i];
computed_color = _gtk_css_value_compute (value, property_id, provider, style, parent_style);
computed_color = _gtk_css_value_compute (value, property_id, provider, style, parent_style, variables);
result->color_names[i] = g_strdup (specified->color_names[i]);
result->color_values[i] = computed_color;

View File

@ -36,16 +36,17 @@ gtk_css_value_position_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_position_compute (GtkCssValue *position,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_position_compute (GtkCssValue *position,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *x, *y;
x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style);
y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style);
x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style, variables);
y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style, variables);
if (x == position->x && y == position->y)
{
_gtk_css_value_unref (x);

View File

@ -58,6 +58,7 @@ gtk_css_value_reference_free (GtkCssValue *value)
static gboolean
resolve_references_do (GtkCssVariableValue *value,
GtkCssVariableSet *style_variables,
GtkCssVariableSet *keyframes_variables,
gboolean root,
GtkCssRefs *refs,
gsize *out_length,
@ -85,15 +86,18 @@ resolve_references_do (GtkCssVariableValue *value,
gsize var_length, var_refs;
GtkCssVariableSet *source = style_variables;
if (keyframes_variables)
var_value = gtk_css_variable_set_lookup (keyframes_variables, id, NULL);
if (!var_value && style_variables)
var_value = gtk_css_variable_set_lookup (style_variables, id, &source);
if (!var_value || !resolve_references_do (var_value, source,
if (!var_value || !resolve_references_do (var_value, source, keyframes_variables,
FALSE, refs, &var_length, &var_refs))
{
var_value = ref->fallback;
if (!var_value || !resolve_references_do (var_value, style_variables,
if (!var_value || !resolve_references_do (var_value, style_variables, keyframes_variables,
FALSE, refs, &var_length, &var_refs))
goto error;
}
@ -129,9 +133,9 @@ error:
static void
resolve_references (GtkCssVariableValue *input,
GtkCssStyle *style,
GtkCssVariableSet *keyframes_variables,
GtkCssRefs *refs)
{
if (!resolve_references_do (input, style->variables, TRUE, refs, NULL, NULL))
if (!resolve_references_do (input, style->variables, keyframes_variables, TRUE, refs, NULL, NULL))
gtk_css_refs_clear (refs);
}
@ -155,18 +159,19 @@ parser_error (GtkCssParser *parser,
}
static GtkCssValue *
gtk_css_value_reference_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_reference_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *result = NULL, *computed;
GtkCssRefs refs;
gtk_css_refs_init (&refs);
resolve_references (value->value, style, &refs);
resolve_references (value->value, style, variables, &refs);
if (gtk_css_refs_get_size (&refs) > 0)
{
@ -197,7 +202,8 @@ gtk_css_value_reference_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
computed->is_computed = TRUE;
gtk_css_value_unref (result);

View File

@ -34,11 +34,12 @@ gtk_css_value_repeat_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_repeat_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_repeat_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
return _gtk_css_value_ref (value);
}

View File

@ -113,11 +113,12 @@ gtk_css_value_shadow_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_shadow_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_shadow_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
guint i;
ShadowValue *shadows;
@ -128,11 +129,11 @@ gtk_css_value_shadow_compute (GtkCssValue *value,
{
const ShadowValue *shadow = &value->shadows[i];
shadows[i].hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style);
shadows[i].voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style);
shadows[i].radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style);
shadows[i].spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style),
shadows[i].color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style);
shadows[i].hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style, variables);
shadows[i].voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style, variables);
shadows[i].radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style, variables);
shadows[i].spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style, variables),
shadows[i].color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style, variables);
shadows[i].inset = shadow->inset;
}

View File

@ -1112,7 +1112,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
*/
if (specified)
{
value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style);
value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style, NULL);
}
else if (parent_style && _gtk_css_style_property_is_inherit (_gtk_css_style_property_lookup_by_id (id)))
{

View File

@ -35,11 +35,12 @@ gtk_css_value_string_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_string_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_string_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
return _gtk_css_value_ref (value);
}

View File

@ -273,12 +273,13 @@ gtk_css_value_transform_free (GtkCssValue *value)
/* returns TRUE if dest == src */
static gboolean
gtk_css_transform_compute (GtkCssTransform *dest,
GtkCssTransform *src,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_transform_compute (GtkCssTransform *dest,
GtkCssTransform *src,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
dest->type = src->type;
@ -288,41 +289,41 @@ gtk_css_transform_compute (GtkCssTransform *dest,
memcpy (dest, src, sizeof (GtkCssTransform));
return TRUE;
case GTK_CSS_TRANSFORM_TRANSLATE:
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, parent_style);
dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, style, parent_style);
dest->translate.z = _gtk_css_value_compute (src->translate.z, property_id, provider, style, parent_style);
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, parent_style, variables);
dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, style, parent_style, variables);
dest->translate.z = _gtk_css_value_compute (src->translate.z, property_id, provider, style, parent_style, variables);
return dest->translate.x == src->translate.x
&& dest->translate.y == src->translate.y
&& dest->translate.z == src->translate.z;
case GTK_CSS_TRANSFORM_ROTATE:
dest->rotate.x = _gtk_css_value_compute (src->rotate.x, property_id, provider, style, parent_style);
dest->rotate.y = _gtk_css_value_compute (src->rotate.y, property_id, provider, style, parent_style);
dest->rotate.z = _gtk_css_value_compute (src->rotate.z, property_id, provider, style, parent_style);
dest->rotate.angle = _gtk_css_value_compute (src->rotate.angle, property_id, provider, style, parent_style);
dest->rotate.x = _gtk_css_value_compute (src->rotate.x, property_id, provider, style, parent_style, variables);
dest->rotate.y = _gtk_css_value_compute (src->rotate.y, property_id, provider, style, parent_style, variables);
dest->rotate.z = _gtk_css_value_compute (src->rotate.z, property_id, provider, style, parent_style, variables);
dest->rotate.angle = _gtk_css_value_compute (src->rotate.angle, property_id, provider, style, parent_style, variables);
return dest->rotate.x == src->rotate.x
&& dest->rotate.y == src->rotate.y
&& dest->rotate.z == src->rotate.z
&& dest->rotate.angle == src->rotate.angle;
case GTK_CSS_TRANSFORM_SCALE:
dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, style, parent_style);
dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, style, parent_style);
dest->scale.z = _gtk_css_value_compute (src->scale.z, property_id, provider, style, parent_style);
dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, style, parent_style, variables);
dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, style, parent_style, variables);
dest->scale.z = _gtk_css_value_compute (src->scale.z, property_id, provider, style, parent_style, variables);
return dest->scale.x == src->scale.x
&& dest->scale.y == src->scale.y
&& dest->scale.z == src->scale.z;
case GTK_CSS_TRANSFORM_SKEW:
dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, style, parent_style);
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style);
dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, style, parent_style, variables);
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style, variables);
return dest->skew.x == src->skew.x
&& dest->skew.y == src->skew.y;
case GTK_CSS_TRANSFORM_SKEW_X:
dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, style, parent_style);
dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, style, parent_style, variables);
return dest->skew_x.skew == src->skew_x.skew;
case GTK_CSS_TRANSFORM_SKEW_Y:
dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, style, parent_style);
dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, style, parent_style, variables);
return dest->skew_y.skew == src->skew_y.skew;
case GTK_CSS_TRANSFORM_PERSPECTIVE:
dest->perspective.depth = _gtk_css_value_compute (src->perspective.depth, property_id, provider, style, parent_style);
dest->perspective.depth = _gtk_css_value_compute (src->perspective.depth, property_id, provider, style, parent_style, variables);
return dest->perspective.depth == src->perspective.depth;
case GTK_CSS_TRANSFORM_NONE:
default:
@ -332,11 +333,12 @@ gtk_css_transform_compute (GtkCssTransform *dest,
}
static GtkCssValue *
gtk_css_value_transform_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_transform_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssValue *result;
gboolean changes;
@ -356,7 +358,8 @@ gtk_css_value_transform_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
}
if (!changes)

View File

@ -35,11 +35,12 @@ gtk_css_value_unset_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_unset_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
gtk_css_value_unset_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
GtkCssStyleProperty *property;
GtkCssValue *unset_value;
@ -55,7 +56,8 @@ gtk_css_value_unset_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style);
parent_style,
variables);
}
static gboolean

View File

@ -199,6 +199,7 @@ gtk_css_value_unref (GtkCssValue *value)
* @provider: Style provider for looking up extra information
* @style: Style to compute for
* @parent_style: parent style to use for inherited values
* @variables: an additional set of variables to use along with @style
*
* Converts the specified @value into the computed value for the CSS
* property given by @property_id using the information in @context.
@ -208,11 +209,12 @@ gtk_css_value_unref (GtkCssValue *value)
* Returns: the computed value
**/
GtkCssValue *
_gtk_css_value_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
_gtk_css_value_compute (GtkCssValue *value,
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssVariableSet *variables)
{
if (gtk_css_value_is_computed (value))
return _gtk_css_value_ref (value);
@ -221,7 +223,7 @@ _gtk_css_value_compute (GtkCssValue *value,
get_accounting_data (value->class->type_name)->computed++;
#endif
return value->class->compute (value, property_id, provider, style, parent_style);
return value->class->compute (value, property_id, provider, style, parent_style, variables);
}
gboolean

View File

@ -22,6 +22,7 @@
#include <glib-object.h>
#include "gtkcsstypesprivate.h"
#include "gtkcssvariablesetprivate.h"
#include "gtkstyleprovider.h"
G_BEGIN_DECLS
@ -48,7 +49,8 @@ struct _GtkCssValueClass {
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style);
GtkCssStyle *parent_style,
GtkCssVariableSet *variables);
gboolean (* equal) (const GtkCssValue *value1,
const GtkCssValue *value2);
GtkCssValue * (* transition) (GtkCssValue *start,
@ -77,7 +79,8 @@ GtkCssValue *_gtk_css_value_compute (GtkCssValue
guint property_id,
GtkStyleProvider *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style) G_GNUC_PURE;
GtkCssStyle *parent_style,
GtkCssVariableSet *variables) G_GNUC_PURE;
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
const GtkCssValue *value2) G_GNUC_PURE;
gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,

View File

@ -223,16 +223,16 @@ test_transition (gconstpointer data)
value1 = value_from_string (prop, test->value1);
g_assert_nonnull (value1);
computed1 = _gtk_css_value_compute (value1, test->prop, provider, style, NULL);
computed1 = _gtk_css_value_compute (value1, test->prop, provider, style, NULL, NULL);
value2 = value_from_string (prop, test->value2);
g_assert_nonnull (value2);
computed2 = _gtk_css_value_compute (value2, test->prop, provider, style, NULL);
computed2 = _gtk_css_value_compute (value2, test->prop, provider, style, NULL, NULL);
if (test->value3)
{
value3 = value_from_string (prop, test->value3);
computed3 = _gtk_css_value_compute (value3, test->prop, provider, style, NULL);
computed3 = _gtk_css_value_compute (value3, test->prop, provider, style, NULL, NULL);
}
else
{