mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 22:10:08 +00:00
css: Only compute shorthand values once
When computing a style, only compute the shorthand value once.
This commit is contained in:
parent
92b7231168
commit
307942e1f7
@ -67,7 +67,7 @@ gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
||||
animated->provider, \
|
||||
style, \
|
||||
animated->parent_style, \
|
||||
NULL); \
|
||||
NULL, NULL); \
|
||||
if (computed == NULL) \
|
||||
continue; \
|
||||
\
|
||||
|
@ -46,7 +46,8 @@ gtk_css_value_array_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *result;
|
||||
GtkCssValue *i_value;
|
||||
@ -55,7 +56,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, variables);
|
||||
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (result == NULL &&
|
||||
i_value != value->values[i])
|
||||
|
@ -46,7 +46,8 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
@ -56,10 +57,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, variables);
|
||||
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (value->y)
|
||||
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style, variables);
|
||||
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (x == value->x && y == value->y)
|
||||
{
|
||||
|
@ -47,7 +47,8 @@ gtk_css_value_border_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *values[4];
|
||||
GtkCssValue *computed;
|
||||
@ -58,7 +59,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, variables);
|
||||
values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, variables, shorthands);
|
||||
changed |= (values[i] != value->values[i]);
|
||||
}
|
||||
else
|
||||
|
@ -98,7 +98,8 @@ gtk_css_value_color_get_fallback (guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
switch (property_id)
|
||||
{
|
||||
@ -122,7 +123,8 @@ gtk_css_value_color_get_fallback (guint property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
||||
return _gtk_css_value_ref (style->core->color);
|
||||
default:
|
||||
@ -139,7 +141,8 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *resolved;
|
||||
|
||||
@ -176,7 +179,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
}
|
||||
|
||||
if (resolved == NULL)
|
||||
return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style, variables);
|
||||
return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
@ -42,12 +42,13 @@ gtk_css_value_corner_compute (GtkCssValue *corner,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
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);
|
||||
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style, variables, shorthands);
|
||||
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
if (x == corner->x && y == corner->y)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
|
@ -55,7 +55,8 @@ gtk_css_value_ease_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
@ -46,7 +46,8 @@ gtk_css_value_enum_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
@ -235,7 +236,8 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
double font_size;
|
||||
|
||||
@ -403,7 +405,8 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
PangoWeight new_weight;
|
||||
int parent_value;
|
||||
|
@ -313,50 +313,51 @@ gtk_css_filter_compute (GtkCssFilter *dest,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
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, variables);
|
||||
dest->brightness.value = _gtk_css_value_compute (src->brightness.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->contrast.value = _gtk_css_value_compute (src->contrast.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->grayscale.value = _gtk_css_value_compute (src->grayscale.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->hue_rotate.value = _gtk_css_value_compute (src->hue_rotate.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->invert.value = _gtk_css_value_compute (src->invert.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->opacity.value = _gtk_css_value_compute (src->opacity.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->saturate.value = _gtk_css_value_compute (src->saturate.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->sepia.value = _gtk_css_value_compute (src->sepia.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->blur.value = _gtk_css_value_compute (src->blur.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->drop_shadow.value = _gtk_css_value_compute (src->drop_shadow.value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
return dest->drop_shadow.value == src->drop_shadow.value;
|
||||
|
||||
case GTK_CSS_FILTER_NONE:
|
||||
@ -372,7 +373,8 @@ gtk_css_value_filter_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *result;
|
||||
gboolean changes;
|
||||
@ -393,7 +395,8 @@ gtk_css_value_filter_compute (GtkCssValue *value,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
}
|
||||
|
||||
if (!changes)
|
||||
|
@ -58,7 +58,8 @@ gtk_css_value_font_features_compute (GtkCssValue *specified,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
return _gtk_css_value_ref (specified);
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ gtk_css_value_font_variations_compute (GtkCssValue *specified,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
return _gtk_css_value_ref (specified);
|
||||
}
|
||||
|
@ -70,7 +70,8 @@ gtk_css_image_real_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
return g_object_ref (image);
|
||||
}
|
||||
@ -179,7 +180,8 @@ _gtk_css_image_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageClass *klass;
|
||||
|
||||
@ -189,7 +191,7 @@ _gtk_css_image_compute (GtkCssImage *image,
|
||||
|
||||
klass = GTK_CSS_IMAGE_GET_CLASS (image);
|
||||
|
||||
return klass->compute (image, property_id, provider, style, parent_style, variables);
|
||||
return klass->compute (image, property_id, provider, style, parent_style, variables, shorthands);
|
||||
}
|
||||
|
||||
GtkCssImage *
|
||||
|
@ -318,7 +318,8 @@ gtk_css_image_conic_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageConic *self = GTK_CSS_IMAGE_CONIC (image);
|
||||
GtkCssImageConic *copy;
|
||||
@ -326,8 +327,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, variables);
|
||||
copy->rotation = _gtk_css_value_compute (self->rotation, property_id, provider, style, parent_style, variables);
|
||||
copy->center = _gtk_css_value_compute (self->center, property_id, provider, style, parent_style, variables, shorthands);
|
||||
copy->rotation = _gtk_css_value_compute (self->rotation, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
copy->n_stops = self->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageConicColorStop) * copy->n_stops);
|
||||
@ -336,11 +337,11 @@ gtk_css_image_conic_compute (GtkCssImage *image,
|
||||
const GtkCssImageConicColorStop *stop = &self->color_stops[i];
|
||||
GtkCssImageConicColorStop *scopy = ©->color_stops[i];
|
||||
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables, shorthands);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -404,7 +404,8 @@ gtk_css_image_cross_fade_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageCrossFade *self = GTK_CSS_IMAGE_CROSS_FADE (image);
|
||||
GtkCssImageCrossFade *result;
|
||||
@ -419,7 +420,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, variables));
|
||||
_gtk_css_image_compute (entry->image, property_id, provider, style, parent_style, variables, shorthands));
|
||||
}
|
||||
|
||||
return GTK_CSS_IMAGE (result);
|
||||
|
@ -138,7 +138,8 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
|
||||
GtkCssImageFallback *copy;
|
||||
@ -154,7 +155,8 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
|
||||
/* image($color) that didn't change */
|
||||
if (computed_color && !fallback->images &&
|
||||
@ -171,7 +173,8 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
|
||||
if (gtk_css_image_is_invalid (copy->images[i]))
|
||||
continue;
|
||||
|
@ -143,7 +143,8 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
||||
GtkCssImageIconTheme *copy;
|
||||
|
@ -493,7 +493,8 @@ gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
|
||||
GtkCssImageLinear *copy;
|
||||
@ -504,7 +505,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, variables);
|
||||
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
copy->n_stops = linear->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageLinearColorStop) * copy->n_stops);
|
||||
@ -513,11 +514,11 @@ gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
|
||||
GtkCssImageLinearColorStop *scopy = ©->color_stops[i];
|
||||
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables, shorthands);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkcssimagepaintableprivate.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
|
||||
@ -101,7 +102,8 @@ gtk_css_image_paintable_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
return gtk_css_image_paintable_get_static_image (image);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gtk/css/gtkcssparserprivate.h"
|
||||
#include "gtk/gtkcsstypesprivate.h"
|
||||
#include "gtk/gtkcssvariablesetprivate.h"
|
||||
#include "gtk/gtkcssvalueprivate.h"
|
||||
#include "gtk/gtksnapshot.h"
|
||||
#include "gtk/gtkstyleprovider.h"
|
||||
|
||||
@ -64,7 +65,8 @@ struct _GtkCssImageClass
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables);
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[]);
|
||||
/* compare two images for equality */
|
||||
gboolean (* equal) (GtkCssImage *image1,
|
||||
GtkCssImage *image2);
|
||||
@ -109,7 +111,8 @@ GtkCssImage * _gtk_css_image_compute (GtkCssImage *
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables);
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[]);
|
||||
gboolean _gtk_css_image_equal (GtkCssImage *image1,
|
||||
GtkCssImage *image2) G_GNUC_PURE;
|
||||
GtkCssImage * _gtk_css_image_transition (GtkCssImage *start,
|
||||
|
@ -494,7 +494,8 @@ gtk_css_image_radial_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
|
||||
GtkCssImageRadial *copy;
|
||||
@ -505,13 +506,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, variables);
|
||||
copy->position = _gtk_css_value_compute (radial->position, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (radial->sizes[0])
|
||||
copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style, variables);
|
||||
copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (radial->sizes[1])
|
||||
copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style, variables);
|
||||
copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
copy->n_stops = radial->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageRadialColorStop) * copy->n_stops);
|
||||
@ -520,11 +521,11 @@ gtk_css_image_radial_compute (GtkCssImage *image,
|
||||
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
|
||||
GtkCssImageRadialColorStop *scopy = ©->color_stops[i];
|
||||
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables, shorthands);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -206,7 +206,8 @@ gtk_css_image_recolor_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
|
||||
GtkCssValue *palette;
|
||||
@ -217,7 +218,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, variables);
|
||||
palette = _gtk_css_value_compute (recolor->palette, property_id, provider, style, parent_style, variables, shorthands);
|
||||
else
|
||||
palette = _gtk_css_value_ref (style->core->icon_palette);
|
||||
|
||||
|
@ -102,7 +102,8 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
|
||||
int scale;
|
||||
@ -139,7 +140,8 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
res->scales[0] = scaled->scales[best];
|
||||
|
||||
return GTK_CSS_IMAGE (res);
|
||||
|
@ -117,7 +117,8 @@ gtk_css_image_url_compute (GtkCssImage *image,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
|
||||
GtkCssImage *copy;
|
||||
|
@ -39,7 +39,8 @@ gtk_css_value_image_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssImage *image, *computed;
|
||||
|
||||
@ -48,7 +49,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, variables);
|
||||
computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (computed == image)
|
||||
{
|
||||
|
@ -39,7 +39,8 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
if (parent_style)
|
||||
{
|
||||
@ -52,7 +53,8 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,8 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
@ -77,7 +78,8 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -138,5 +140,5 @@ _gtk_css_initial_value_new_compute (guint property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
NULL);
|
||||
NULL, NULL);
|
||||
}
|
||||
|
@ -642,7 +642,8 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
keyframes->variables ? keyframes->variables[k] : NULL);
|
||||
keyframes->variables ? keyframes->variables[k] : NULL,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,11 +44,12 @@ gtk_css_value_line_height_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *height;
|
||||
|
||||
height = _gtk_css_value_compute (value->height, property_id, provider, style, parent_style, variables);
|
||||
height = _gtk_css_value_compute (value->height, property_id, provider, style, parent_style, variables, shorthands);
|
||||
|
||||
if (gtk_css_number_value_get_dimension (height) == GTK_CSS_DIMENSION_PERCENTAGE)
|
||||
{
|
||||
|
@ -113,7 +113,8 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
double value;
|
||||
|
||||
@ -132,7 +133,8 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
GtkCssValue *computed = _gtk_css_value_compute (number->calc.terms[i],
|
||||
property_id, provider, style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
changed |= computed != number->calc.terms[i];
|
||||
new_values[i] = computed;
|
||||
}
|
||||
|
@ -108,7 +108,8 @@ gtk_css_value_palette_compute (GtkCssValue *specified,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *computed_color;
|
||||
GtkCssValue *result;
|
||||
@ -121,7 +122,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, variables);
|
||||
computed_color = _gtk_css_value_compute (value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
result->color_names[i] = g_strdup (specified->color_names[i]);
|
||||
result->color_values[i] = computed_color;
|
||||
|
||||
|
@ -41,12 +41,13 @@ gtk_css_value_position_compute (GtkCssValue *position,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
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);
|
||||
x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style, variables, shorthands);
|
||||
y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
if (x == position->x && y == position->y)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
|
@ -226,10 +226,22 @@ gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *result = NULL, *computed;
|
||||
GtkCssRefs refs;
|
||||
guint shorthand_id = G_MAXUINT;
|
||||
|
||||
if (GTK_IS_CSS_SHORTHAND_PROPERTY (value->property))
|
||||
{
|
||||
shorthand_id = _gtk_css_shorthand_property_get_id (GTK_CSS_SHORTHAND_PROPERTY (value->property));
|
||||
if (shorthands && shorthands[shorthand_id])
|
||||
{
|
||||
result = gtk_css_value_ref (shorthands[shorthand_id]);
|
||||
goto pick_subproperty;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_refs_init (&refs);
|
||||
|
||||
@ -253,9 +265,18 @@ gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
if (result == NULL)
|
||||
result = _gtk_css_unset_value_new ();
|
||||
|
||||
if (GTK_IS_CSS_SHORTHAND_PROPERTY (value->property))
|
||||
if (shorthand_id != G_MAXUINT)
|
||||
{
|
||||
GtkCssValue *sub = gtk_css_value_ref (_gtk_css_array_value_get_nth (result, value->subproperty));
|
||||
GtkCssValue *sub;
|
||||
|
||||
if (shorthands)
|
||||
{
|
||||
g_assert (shorthands[shorthand_id] == NULL);
|
||||
shorthands[shorthand_id] = gtk_css_value_ref (result);
|
||||
}
|
||||
|
||||
pick_subproperty:
|
||||
sub = gtk_css_value_ref (_gtk_css_array_value_get_nth (result, value->subproperty));
|
||||
gtk_css_value_unref (result);
|
||||
result = sub;
|
||||
}
|
||||
@ -265,7 +286,8 @@ gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
computed->is_computed = TRUE;
|
||||
|
||||
gtk_css_value_unref (result);
|
||||
|
@ -39,7 +39,8 @@ gtk_css_value_repeat_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
@ -118,7 +118,8 @@ gtk_css_value_shadow_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
guint i;
|
||||
ShadowValue *shadows;
|
||||
@ -129,11 +130,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, 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].hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style, variables, shorthands);
|
||||
shadows[i].voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style, variables, shorthands);
|
||||
shadows[i].radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style, variables, shorthands);
|
||||
shadows[i].spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style, variables, shorthands),
|
||||
shadows[i].color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style, variables, shorthands);
|
||||
shadows[i].inset = shadow->inset;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,8 @@ static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section);
|
||||
GtkCssSection *section,
|
||||
GtkCssValue *shorthands[]);
|
||||
|
||||
#define GET_VALUES(v) (GtkCssValue **)((guint8*)(v) + sizeof (GtkCssValues))
|
||||
|
||||
@ -75,7 +76,8 @@ static inline void \
|
||||
gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
|
||||
GtkStyleProvider *provider, \
|
||||
GtkCssStyle *parent_style, \
|
||||
GtkCssLookup *lookup) \
|
||||
GtkCssLookup *lookup, \
|
||||
GtkCssValue *shorthands[]) \
|
||||
{ \
|
||||
GtkCssStyle *style = (GtkCssStyle *)sstyle; \
|
||||
int i; \
|
||||
@ -90,7 +92,8 @@ gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
|
||||
parent_style, \
|
||||
id, \
|
||||
lookup->values[id].value, \
|
||||
lookup->values[id].section); \
|
||||
lookup->values[id].section, \
|
||||
shorthands); \
|
||||
} \
|
||||
} \
|
||||
static GtkBitmask * gtk_css_ ## NAME ## _values_mask; \
|
||||
@ -827,6 +830,7 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssStyle *style = (GtkCssStyle *)sstyle;
|
||||
GtkCssValue *shorthands[GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES] = { NULL, };
|
||||
|
||||
gtk_internal_return_if_fail (lookup != NULL);
|
||||
gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
|
||||
@ -879,9 +883,9 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_css_core_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_icon_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_font_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_core_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
gtk_css_icon_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
gtk_css_font_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -890,57 +894,63 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
if (parent_style && gtk_css_core_values_unset (lookup))
|
||||
style->core = (GtkCssCoreValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->core);
|
||||
else
|
||||
gtk_css_core_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_core_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (gtk_css_background_values_unset (lookup))
|
||||
style->background = (GtkCssBackgroundValues *)gtk_css_values_ref (gtk_css_background_initial_values);
|
||||
else
|
||||
gtk_css_background_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_background_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (gtk_css_border_values_unset (lookup))
|
||||
style->border = (GtkCssBorderValues *)gtk_css_values_ref (gtk_css_border_initial_values);
|
||||
else
|
||||
gtk_css_border_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_border_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (parent_style && gtk_css_icon_values_unset (lookup))
|
||||
style->icon = (GtkCssIconValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->icon);
|
||||
else
|
||||
gtk_css_icon_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_icon_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (gtk_css_outline_values_unset (lookup))
|
||||
style->outline = (GtkCssOutlineValues *)gtk_css_values_ref (gtk_css_outline_initial_values);
|
||||
else
|
||||
gtk_css_outline_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_outline_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (parent_style && gtk_css_font_values_unset (lookup))
|
||||
style->font = (GtkCssFontValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->font);
|
||||
else
|
||||
gtk_css_font_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_font_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (gtk_css_font_variant_values_unset (lookup))
|
||||
style->font_variant = (GtkCssFontVariantValues *)gtk_css_values_ref (gtk_css_font_variant_initial_values);
|
||||
else
|
||||
gtk_css_font_variant_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_font_variant_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (gtk_css_animation_values_unset (lookup))
|
||||
style->animation = (GtkCssAnimationValues *)gtk_css_values_ref (gtk_css_animation_initial_values);
|
||||
else
|
||||
gtk_css_animation_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_animation_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (gtk_css_transition_values_unset (lookup))
|
||||
style->transition = (GtkCssTransitionValues *)gtk_css_values_ref (gtk_css_transition_initial_values);
|
||||
else
|
||||
gtk_css_transition_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_transition_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (gtk_css_size_values_unset (lookup))
|
||||
style->size = (GtkCssSizeValues *)gtk_css_values_ref (gtk_css_size_initial_values);
|
||||
else
|
||||
gtk_css_size_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_size_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
if (gtk_css_other_values_unset (lookup))
|
||||
style->other = (GtkCssOtherValues *)gtk_css_values_ref (gtk_css_other_initial_values);
|
||||
else
|
||||
gtk_css_other_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_other_values_new_compute (sstyle, provider, parent_style, lookup, shorthands);
|
||||
|
||||
for (unsigned int i = 0; i < GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES; i++)
|
||||
{
|
||||
if (shorthands[i])
|
||||
gtk_css_value_unref (shorthands[i]);
|
||||
}
|
||||
}
|
||||
|
||||
GtkCssStyle *
|
||||
@ -993,7 +1003,8 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section)
|
||||
GtkCssSection *section,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *value, *original_value;
|
||||
GtkBorderStyle border_style;
|
||||
@ -1033,7 +1044,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
*/
|
||||
if (specified)
|
||||
{
|
||||
value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style, NULL);
|
||||
value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style, NULL, shorthands);
|
||||
|
||||
if (gtk_css_value_contains_variables (specified))
|
||||
original_value = specified;
|
||||
|
@ -40,7 +40,8 @@ gtk_css_value_string_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
@ -279,7 +279,8 @@ gtk_css_transform_compute (GtkCssTransform *dest,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
dest->type = src->type;
|
||||
|
||||
@ -289,41 +290,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, 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);
|
||||
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->translate.z = _gtk_css_value_compute (src->translate.z, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, 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);
|
||||
dest->rotate.x = _gtk_css_value_compute (src->rotate.x, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->rotate.y = _gtk_css_value_compute (src->rotate.y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->rotate.z = _gtk_css_value_compute (src->rotate.z, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->rotate.angle = _gtk_css_value_compute (src->rotate.angle, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, 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);
|
||||
dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->scale.z = _gtk_css_value_compute (src->scale.z, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style, variables);
|
||||
dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, style, parent_style, variables, shorthands);
|
||||
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, variables);
|
||||
dest->perspective.depth = _gtk_css_value_compute (src->perspective.depth, property_id, provider, style, parent_style, variables, shorthands);
|
||||
return dest->perspective.depth == src->perspective.depth;
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
default:
|
||||
@ -338,7 +339,8 @@ gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssValue *result;
|
||||
gboolean changes;
|
||||
@ -359,7 +361,8 @@ gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
}
|
||||
|
||||
if (!changes)
|
||||
|
@ -40,7 +40,8 @@ gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
GtkCssStyleProperty *property;
|
||||
GtkCssValue *unset_value;
|
||||
@ -57,7 +58,8 @@ gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
variables,
|
||||
shorthands);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -200,6 +200,7 @@ gtk_css_value_unref (GtkCssValue *value)
|
||||
* @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
|
||||
* @shorthands: (nullable): Already computed values for shorthands
|
||||
*
|
||||
* Converts the specified @value into the computed value for the CSS
|
||||
* property given by @property_id using the information in @context.
|
||||
@ -214,7 +215,8 @@ _gtk_css_value_compute (GtkCssValue *value,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
{
|
||||
if (gtk_css_value_is_computed (value))
|
||||
return _gtk_css_value_ref (value);
|
||||
@ -223,7 +225,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, variables);
|
||||
return value->class->compute (value, property_id, provider, style, parent_style, variables, shorthands);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -50,7 +50,8 @@ struct _GtkCssValueClass {
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables);
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[]);
|
||||
gboolean (* equal) (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2);
|
||||
GtkCssValue * (* transition) (GtkCssValue *start,
|
||||
@ -80,7 +81,8 @@ GtkCssValue *_gtk_css_value_compute (GtkCssValue
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables) G_GNUC_PURE;
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[]) 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,
|
||||
|
@ -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, NULL);
|
||||
computed1 = _gtk_css_value_compute (value1, test->prop, provider, style, NULL, NULL, NULL);
|
||||
|
||||
value2 = value_from_string (prop, test->value2);
|
||||
g_assert_nonnull (value2);
|
||||
computed2 = _gtk_css_value_compute (value2, test->prop, provider, style, NULL, NULL);
|
||||
computed2 = _gtk_css_value_compute (value2, test->prop, provider, style, NULL, NULL, NULL);
|
||||
|
||||
if (test->value3)
|
||||
{
|
||||
value3 = value_from_string (prop, test->value3);
|
||||
computed3 = _gtk_css_value_compute (value3, test->prop, provider, style, NULL, NULL);
|
||||
computed3 = _gtk_css_value_compute (value3, test->prop, provider, style, NULL, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user