mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 17:50:10 +00:00
css: Condense compute parameters into GtkCssComputeContext
That list is getting out of hand, let's make it a struct.
This commit is contained in:
parent
307942e1f7
commit
ed35f6f8b8
@ -44,7 +44,8 @@ G_DEFINE_TYPE (GtkCssAnimatedStyle, gtk_css_animated_style, GTK_TYPE_CSS_STYLE)
|
||||
|
||||
#define DEFINE_VALUES(ENUM, TYPE, NAME) \
|
||||
static inline void \
|
||||
gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
||||
gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated, \
|
||||
GtkCssComputeContext *context) \
|
||||
{ \
|
||||
GtkCssStyle *style = (GtkCssStyle *)animated; \
|
||||
GtkCssValue **values = (GtkCssValue **)((guint8*)(animated->style->NAME) + sizeof (GtkCssValues)); \
|
||||
@ -64,10 +65,7 @@ gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
||||
\
|
||||
computed = _gtk_css_value_compute (original, \
|
||||
id, \
|
||||
animated->provider, \
|
||||
style, \
|
||||
animated->parent_style, \
|
||||
NULL, NULL); \
|
||||
context); \
|
||||
if (computed == NULL) \
|
||||
continue; \
|
||||
\
|
||||
@ -611,6 +609,7 @@ gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
GtkCssVariableValue *value)
|
||||
{
|
||||
GtkCssStyle *style = (GtkCssStyle *)animated;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style));
|
||||
gtk_internal_return_if_fail (value != NULL);
|
||||
@ -630,17 +629,22 @@ gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
|
||||
gtk_css_variable_set_add (style->variables, id, value);
|
||||
|
||||
gtk_css_core_values_recompute (animated);
|
||||
gtk_css_background_values_recompute (animated);
|
||||
gtk_css_border_values_recompute (animated);
|
||||
gtk_css_icon_values_recompute (animated);
|
||||
gtk_css_outline_values_recompute (animated);
|
||||
gtk_css_font_values_recompute (animated);
|
||||
gtk_css_font_variant_values_recompute (animated);
|
||||
gtk_css_animation_values_recompute (animated);
|
||||
gtk_css_transition_values_recompute (animated);
|
||||
gtk_css_size_values_recompute (animated);
|
||||
gtk_css_other_values_recompute (animated);
|
||||
context.provider = animated->provider;
|
||||
context.style = animated->style;
|
||||
context.parent_style = animated->parent_style;
|
||||
context.provider = animated->provider;
|
||||
|
||||
gtk_css_core_values_recompute (animated, &context);
|
||||
gtk_css_background_values_recompute (animated, &context);
|
||||
gtk_css_border_values_recompute (animated, &context);
|
||||
gtk_css_icon_values_recompute (animated, &context);
|
||||
gtk_css_outline_values_recompute (animated, &context);
|
||||
gtk_css_font_values_recompute (animated, &context);
|
||||
gtk_css_font_variant_values_recompute (animated, &context);
|
||||
gtk_css_animation_values_recompute (animated, &context);
|
||||
gtk_css_transition_values_recompute (animated, &context);
|
||||
gtk_css_size_values_recompute (animated, &context);
|
||||
gtk_css_other_values_recompute (animated, &context);
|
||||
}
|
||||
|
||||
GtkCssVariableValue *
|
||||
|
@ -41,13 +41,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_array_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
GtkCssValue *i_value;
|
||||
@ -56,7 +52,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, shorthands);
|
||||
i_value = _gtk_css_value_compute (value->values[i], property_id, context);
|
||||
|
||||
if (result == NULL &&
|
||||
i_value != value->values[i])
|
||||
|
@ -41,13 +41,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_bg_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
@ -57,10 +53,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, shorthands);
|
||||
x = _gtk_css_value_compute (value->x, property_id, context);
|
||||
|
||||
if (value->y)
|
||||
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
y = _gtk_css_value_compute (value->y, property_id, context);
|
||||
|
||||
if (x == value->x && y == value->y)
|
||||
{
|
||||
|
@ -42,13 +42,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_border_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *values[4];
|
||||
GtkCssValue *computed;
|
||||
@ -59,7 +55,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, shorthands);
|
||||
values[i] = _gtk_css_value_compute (value->values[i], property_id, context);
|
||||
changed |= (values[i] != value->values[i]);
|
||||
}
|
||||
else
|
||||
|
@ -94,12 +94,8 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_color_get_fallback (guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
switch (property_id)
|
||||
{
|
||||
@ -120,13 +116,9 @@ gtk_css_value_color_get_fallback (guint property_id,
|
||||
case GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR:
|
||||
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
context);
|
||||
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
||||
return _gtk_css_value_ref (style->core->color);
|
||||
return _gtk_css_value_ref (context->style->core->color);
|
||||
default:
|
||||
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
|
||||
g_warning ("No fallback color defined for property '%s'",
|
||||
@ -136,13 +128,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_color_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *resolved;
|
||||
|
||||
@ -154,13 +142,13 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
{
|
||||
GtkCssValue *current;
|
||||
|
||||
if (parent_style)
|
||||
current = parent_style->core->color;
|
||||
if (context->parent_style)
|
||||
current = context->parent_style->core->color;
|
||||
else
|
||||
current = NULL;
|
||||
|
||||
resolved = _gtk_css_color_value_resolve (value,
|
||||
provider,
|
||||
context->provider,
|
||||
current,
|
||||
NULL);
|
||||
}
|
||||
@ -170,16 +158,16 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkCssValue *current = style->core->color;
|
||||
GtkCssValue *current = context->style->core->color;
|
||||
|
||||
resolved = _gtk_css_color_value_resolve (value,
|
||||
provider,
|
||||
context->provider,
|
||||
current,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (resolved == NULL)
|
||||
return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style, variables, shorthands);
|
||||
return gtk_css_value_color_get_fallback (property_id, context);
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
@ -37,18 +37,14 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_corner_compute (GtkCssValue *corner,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
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);
|
||||
x = _gtk_css_value_compute (corner->x, property_id, context);
|
||||
y = _gtk_css_value_compute (corner->y, property_id, context);
|
||||
if (x == corner->x && y == corner->y)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
|
@ -50,13 +50,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_ease_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
@ -41,13 +41,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_enum_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
@ -231,14 +227,14 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkStyleProvider *provider = context->provider;
|
||||
GtkCssStyle *style = context->style;
|
||||
GtkCssStyle *parent_style = context->parent_style;
|
||||
|
||||
double font_size;
|
||||
|
||||
switch (value->value)
|
||||
@ -400,13 +396,9 @@ _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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_font_weight_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
PangoWeight new_weight;
|
||||
int parent_value;
|
||||
@ -414,8 +406,8 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
|
||||
if (value->value >= 0)
|
||||
return _gtk_css_value_ref (value);
|
||||
|
||||
if (parent_style)
|
||||
parent_value = _gtk_css_number_value_get (parent_style->font->font_weight, 100);
|
||||
if (context->parent_style)
|
||||
parent_value = _gtk_css_number_value_get (context->parent_style->font->font_weight, 100);
|
||||
else
|
||||
parent_value = 400;
|
||||
|
||||
|
@ -307,57 +307,53 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_filter_compute (GtkCssFilter *dest,
|
||||
GtkCssFilter *src,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
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, shorthands);
|
||||
dest->brightness.value = _gtk_css_value_compute (src->brightness.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->contrast.value = _gtk_css_value_compute (src->contrast.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->grayscale.value = _gtk_css_value_compute (src->grayscale.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->hue_rotate.value = _gtk_css_value_compute (src->hue_rotate.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->invert.value = _gtk_css_value_compute (src->invert.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->opacity.value = _gtk_css_value_compute (src->opacity.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->saturate.value = _gtk_css_value_compute (src->saturate.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->sepia.value = _gtk_css_value_compute (src->sepia.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->blur.value = _gtk_css_value_compute (src->blur.value, property_id, context);
|
||||
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, shorthands);
|
||||
dest->drop_shadow.value = _gtk_css_value_compute (src->drop_shadow.value, property_id, context);
|
||||
return dest->drop_shadow.value == src->drop_shadow.value;
|
||||
|
||||
case GTK_CSS_FILTER_NONE:
|
||||
@ -368,13 +364,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_filter_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
gboolean changes;
|
||||
@ -392,11 +384,7 @@ gtk_css_value_filter_compute (GtkCssValue *value,
|
||||
changes |= !gtk_css_filter_compute (&result->filters[i],
|
||||
&value->filters[i],
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
context);
|
||||
}
|
||||
|
||||
if (!changes)
|
||||
|
@ -53,13 +53,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_font_features_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (specified);
|
||||
}
|
||||
|
@ -52,13 +52,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_font_variations_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (specified);
|
||||
}
|
||||
|
@ -65,13 +65,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_real_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return g_object_ref (image);
|
||||
}
|
||||
@ -175,23 +171,19 @@ _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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
_gtk_css_image_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageClass *klass;
|
||||
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
|
||||
gtk_internal_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (context->style), NULL);
|
||||
gtk_internal_return_val_if_fail (context->parent_style == NULL || GTK_IS_CSS_STYLE (context->parent_style), NULL);
|
||||
|
||||
klass = GTK_CSS_IMAGE_GET_CLASS (image);
|
||||
|
||||
return klass->compute (image, property_id, provider, style, parent_style, variables, shorthands);
|
||||
return klass->compute (image, property_id, context);
|
||||
}
|
||||
|
||||
GtkCssImage *
|
||||
|
@ -313,13 +313,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_conic_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageConic *self = GTK_CSS_IMAGE_CONIC (image);
|
||||
GtkCssImageConic *copy;
|
||||
@ -327,8 +323,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, shorthands);
|
||||
copy->rotation = _gtk_css_value_compute (self->rotation, property_id, provider, style, parent_style, variables, shorthands);
|
||||
copy->center = _gtk_css_value_compute (self->center, property_id, context);
|
||||
copy->rotation = _gtk_css_value_compute (self->rotation, property_id, context);
|
||||
|
||||
copy->n_stops = self->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageConicColorStop) * copy->n_stops);
|
||||
@ -337,11 +333,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, shorthands);
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, context);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables, shorthands);
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -399,13 +399,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_cross_fade_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageCrossFade *self = GTK_CSS_IMAGE_CROSS_FADE (image);
|
||||
GtkCssImageCrossFade *result;
|
||||
@ -420,7 +416,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, shorthands));
|
||||
_gtk_css_image_compute (entry->image, property_id, context));
|
||||
}
|
||||
|
||||
return GTK_CSS_IMAGE (result);
|
||||
|
@ -133,13 +133,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
|
||||
GtkCssImageFallback *copy;
|
||||
@ -152,11 +148,7 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
if (fallback->color)
|
||||
computed_color = _gtk_css_value_compute (fallback->color,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
context);
|
||||
|
||||
/* image($color) that didn't change */
|
||||
if (computed_color && !fallback->images &&
|
||||
@ -170,11 +162,7 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
{
|
||||
copy->images[i] = _gtk_css_image_compute (fallback->images[i],
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
context);
|
||||
|
||||
if (gtk_css_image_is_invalid (copy->images[i]))
|
||||
continue;
|
||||
|
@ -138,13 +138,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
||||
GtkCssImageIconTheme *copy;
|
||||
@ -153,12 +149,12 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
||||
|
||||
copy = g_object_new (GTK_TYPE_CSS_IMAGE_ICON_THEME, NULL);
|
||||
copy->name = g_strdup (icon_theme->name);
|
||||
settings = gtk_style_provider_get_settings (provider);
|
||||
settings = gtk_style_provider_get_settings (context->provider);
|
||||
display = _gtk_settings_get_display (settings);
|
||||
copy->icon_theme = gtk_icon_theme_get_for_display (display);
|
||||
copy->serial = gtk_icon_theme_get_serial (copy->icon_theme);
|
||||
copy->scale = gtk_style_provider_get_scale (provider);
|
||||
gtk_css_style_lookup_symbolic_colors (style, copy->colors);
|
||||
copy->scale = gtk_style_provider_get_scale (context->provider);
|
||||
gtk_css_style_lookup_symbolic_colors (context->style, copy->colors);
|
||||
|
||||
return GTK_CSS_IMAGE (copy);
|
||||
}
|
||||
|
@ -488,13 +488,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
|
||||
GtkCssImageLinear *copy;
|
||||
@ -505,7 +501,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, shorthands);
|
||||
copy->angle = _gtk_css_value_compute (linear->angle, property_id, context);
|
||||
|
||||
copy->n_stops = linear->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageLinearColorStop) * copy->n_stops);
|
||||
@ -514,11 +510,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, shorthands);
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, context);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables, shorthands);
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -97,13 +97,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_paintable_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return gtk_css_image_paintable_get_static_image (image);
|
||||
}
|
||||
|
@ -62,11 +62,7 @@ struct _GtkCssImageClass
|
||||
/* create "computed value" in CSS terms, returns a new reference */
|
||||
GtkCssImage *(* compute) (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[]);
|
||||
GtkCssComputeContext *context);
|
||||
/* compare two images for equality */
|
||||
gboolean (* equal) (GtkCssImage *image1,
|
||||
GtkCssImage *image2);
|
||||
@ -108,11 +104,7 @@ double _gtk_css_image_get_aspect_ratio (GtkCssImage *
|
||||
|
||||
GtkCssImage * _gtk_css_image_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[]);
|
||||
GtkCssComputeContext *context);
|
||||
gboolean _gtk_css_image_equal (GtkCssImage *image1,
|
||||
GtkCssImage *image2) G_GNUC_PURE;
|
||||
GtkCssImage * _gtk_css_image_transition (GtkCssImage *start,
|
||||
|
@ -489,13 +489,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_radial_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
|
||||
GtkCssImageRadial *copy;
|
||||
@ -506,13 +502,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, shorthands);
|
||||
copy->position = _gtk_css_value_compute (radial->position, property_id, context);
|
||||
|
||||
if (radial->sizes[0])
|
||||
copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style, variables, shorthands);
|
||||
copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, context);
|
||||
|
||||
if (radial->sizes[1])
|
||||
copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style, variables, shorthands);
|
||||
copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, context);
|
||||
|
||||
copy->n_stops = radial->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageRadialColorStop) * copy->n_stops);
|
||||
@ -521,11 +517,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, shorthands);
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, context);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables, shorthands);
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -201,13 +201,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_recolor_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
|
||||
GtkCssValue *palette;
|
||||
@ -215,19 +211,19 @@ gtk_css_image_recolor_compute (GtkCssImage *image,
|
||||
int scale;
|
||||
GError *error = NULL;
|
||||
|
||||
scale = gtk_style_provider_get_scale (provider);
|
||||
scale = gtk_style_provider_get_scale (context->provider);
|
||||
|
||||
if (recolor->palette)
|
||||
palette = _gtk_css_value_compute (recolor->palette, property_id, provider, style, parent_style, variables, shorthands);
|
||||
palette = _gtk_css_value_compute (recolor->palette, property_id, context);
|
||||
else
|
||||
palette = _gtk_css_value_ref (style->core->icon_palette);
|
||||
palette = _gtk_css_value_ref (context->style->core->icon_palette);
|
||||
|
||||
img = gtk_css_image_recolor_load (recolor, style, palette, scale, &error);
|
||||
img = gtk_css_image_recolor_load (recolor, context->style, palette, scale, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
GtkCssSection *section = gtk_css_style_get_section (style, property_id);
|
||||
gtk_style_provider_emit_error (provider, section, error);
|
||||
GtkCssSection *section = gtk_css_style_get_section (context->style, property_id);
|
||||
gtk_style_provider_emit_error (context->provider, section, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
@ -97,13 +97,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
|
||||
int scale;
|
||||
@ -111,7 +107,7 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
int i;
|
||||
int best;
|
||||
|
||||
scale = gtk_style_provider_get_scale (provider);
|
||||
scale = gtk_style_provider_get_scale (context->provider);
|
||||
scale = MAX(scale, 1);
|
||||
|
||||
best = 0;
|
||||
@ -137,11 +133,7 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
|
||||
res->images[0] = _gtk_css_image_compute (scaled->images[best],
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
context);
|
||||
res->scales[0] = scaled->scales[best];
|
||||
|
||||
return GTK_CSS_IMAGE (res);
|
||||
|
@ -112,13 +112,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_image_url_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
|
||||
GtkCssImage *copy;
|
||||
@ -127,8 +123,8 @@ gtk_css_image_url_compute (GtkCssImage *image,
|
||||
copy = gtk_css_image_url_load_image (url, &error);
|
||||
if (error)
|
||||
{
|
||||
GtkCssSection *section = gtk_css_style_get_section (style, property_id);
|
||||
gtk_style_provider_emit_error (provider, section, error);
|
||||
GtkCssSection *section = gtk_css_style_get_section (context->style, property_id);
|
||||
gtk_style_provider_emit_error (context->provider, section, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
@ -34,13 +34,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_image_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImage *image, *computed;
|
||||
|
||||
@ -49,7 +45,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, shorthands);
|
||||
computed = _gtk_css_image_compute (image, property_id, context);
|
||||
|
||||
if (computed == image)
|
||||
{
|
||||
|
@ -34,27 +34,19 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
if (parent_style)
|
||||
if (context->parent_style)
|
||||
{
|
||||
return _gtk_css_value_ref (gtk_css_style_get_value (parent_style, property_id));
|
||||
return _gtk_css_value_ref (gtk_css_style_get_value (context->parent_style, property_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
return _gtk_css_value_compute (_gtk_css_initial_value_get (),
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,20 +38,16 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case GTK_CSS_PROPERTY_DPI:
|
||||
settings = gtk_style_provider_get_settings (provider);
|
||||
settings = gtk_style_provider_get_settings (context->provider);
|
||||
if (settings)
|
||||
{
|
||||
int dpi_int;
|
||||
@ -64,7 +60,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
break;
|
||||
|
||||
case GTK_CSS_PROPERTY_FONT_FAMILY:
|
||||
settings = gtk_style_provider_get_settings (provider);
|
||||
settings = gtk_style_provider_get_settings (context->provider);
|
||||
if (settings && gtk_settings_get_font_family (settings) != NULL)
|
||||
return _gtk_css_array_value_new (_gtk_css_string_value_new (gtk_settings_get_font_family (settings)));
|
||||
break;
|
||||
@ -75,11 +71,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
|
||||
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -130,15 +122,10 @@ _gtk_css_initial_value_get (void)
|
||||
return &initial;
|
||||
}
|
||||
GtkCssValue *
|
||||
_gtk_css_initial_value_new_compute (guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style)
|
||||
_gtk_css_initial_value_new_compute (guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return gtk_css_value_initial_compute (NULL,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
NULL, NULL);
|
||||
context);
|
||||
}
|
||||
|
@ -25,10 +25,8 @@ G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * _gtk_css_initial_value_new (void);
|
||||
GtkCssValue * _gtk_css_initial_value_get (void);
|
||||
GtkCssValue * _gtk_css_initial_value_new_compute (guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style);
|
||||
GtkCssValue * _gtk_css_initial_value_new_compute (guint property_id,
|
||||
GtkCssComputeContext *context);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -615,6 +615,7 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
GtkCssKeyframes *resolved;
|
||||
guint k, p;
|
||||
|
||||
@ -630,6 +631,10 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
|
||||
resolved->property_ids = g_memdup2 (keyframes->property_ids, keyframes->n_properties * sizeof (guint));
|
||||
resolved->values = g_new0 (GtkCssValue *, resolved->n_keyframes * resolved->n_properties);
|
||||
|
||||
context.provider = provider;
|
||||
context.style = style;
|
||||
context.parent_style = parent_style;
|
||||
|
||||
for (p = 0; p < resolved->n_properties; p++)
|
||||
{
|
||||
for (k = 0; k < resolved->n_keyframes; k++)
|
||||
@ -637,13 +642,11 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
|
||||
if (KEYFRAMES_VALUE (keyframes, k, p) == NULL)
|
||||
continue;
|
||||
|
||||
context.variables = keyframes->variables ? keyframes->variables[k] : NULL;
|
||||
|
||||
KEYFRAMES_VALUE (resolved, k, p) = _gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
|
||||
resolved->property_ids[p],
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
keyframes->variables ? keyframes->variables[k] : NULL,
|
||||
NULL);
|
||||
&context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,17 +39,13 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_line_height_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *height;
|
||||
|
||||
height = _gtk_css_value_compute (value->height, property_id, provider, style, parent_style, variables, shorthands);
|
||||
height = _gtk_css_value_compute (value->height, property_id, context);
|
||||
|
||||
if (gtk_css_number_value_get_dimension (height) == GTK_CSS_DIMENSION_PERCENTAGE)
|
||||
{
|
||||
@ -57,7 +53,7 @@ gtk_css_value_line_height_compute (GtkCssValue *value,
|
||||
GtkCssValue *computed;
|
||||
|
||||
factor = _gtk_css_number_value_get (height, 1);
|
||||
computed = gtk_css_number_value_multiply (style->core->font_size, factor);
|
||||
computed = gtk_css_number_value_multiply (context->style->core->font_size, factor);
|
||||
|
||||
_gtk_css_value_unref (height);
|
||||
|
||||
|
@ -108,14 +108,13 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_number_compute (GtkCssValue *number,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkStyleProvider *provider = context->provider;
|
||||
GtkCssStyle *style = context->style;
|
||||
GtkCssStyle *parent_style = context->parent_style;
|
||||
double value;
|
||||
|
||||
if (G_UNLIKELY (number->type == TYPE_CALC))
|
||||
@ -131,10 +130,8 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
for (i = 0; i < n_terms; i++)
|
||||
{
|
||||
GtkCssValue *computed = _gtk_css_value_compute (number->calc.terms[i],
|
||||
property_id, provider, style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
property_id,
|
||||
context);
|
||||
changed |= computed != number->calc.terms[i];
|
||||
new_values[i] = computed;
|
||||
}
|
||||
|
@ -103,13 +103,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_palette_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *computed_color;
|
||||
GtkCssValue *result;
|
||||
@ -122,7 +118,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, shorthands);
|
||||
computed_color = _gtk_css_value_compute (value, property_id, context);
|
||||
result->color_names[i] = g_strdup (specified->color_names[i]);
|
||||
result->color_values[i] = computed_color;
|
||||
|
||||
|
@ -36,18 +36,14 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_position_compute (GtkCssValue *position,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
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);
|
||||
x = _gtk_css_value_compute (position->x, property_id, context);
|
||||
y = _gtk_css_value_compute (position->y, property_id, context);
|
||||
if (x == position->x && y == position->y)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
|
@ -221,13 +221,9 @@ parser_error (GtkCssParser *parser,
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *result = NULL, *computed;
|
||||
GtkCssRefs refs;
|
||||
@ -236,16 +232,16 @@ gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
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])
|
||||
if (context->shorthands && context->shorthands[shorthand_id])
|
||||
{
|
||||
result = gtk_css_value_ref (shorthands[shorthand_id]);
|
||||
result = gtk_css_value_ref (context->shorthands[shorthand_id]);
|
||||
goto pick_subproperty;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_refs_init (&refs);
|
||||
|
||||
resolve_references (value->value, property_id, style, variables, &refs);
|
||||
resolve_references (value->value, property_id, context->style, context->variables, &refs);
|
||||
|
||||
if (gtk_css_refs_get_size (&refs) > 0)
|
||||
{
|
||||
@ -254,7 +250,8 @@ gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
value->file,
|
||||
(GtkCssVariableValue **) refs.start,
|
||||
gtk_css_refs_get_size (&refs),
|
||||
parser_error, provider, NULL);
|
||||
parser_error, context->provider,
|
||||
NULL);
|
||||
|
||||
result = _gtk_style_property_parse_value (value->property, value_parser);
|
||||
gtk_css_parser_unref (value_parser);
|
||||
@ -269,10 +266,10 @@ gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
{
|
||||
GtkCssValue *sub;
|
||||
|
||||
if (shorthands)
|
||||
if (context->shorthands)
|
||||
{
|
||||
g_assert (shorthands[shorthand_id] == NULL);
|
||||
shorthands[shorthand_id] = gtk_css_value_ref (result);
|
||||
g_assert (context->shorthands[shorthand_id] == NULL);
|
||||
context->shorthands[shorthand_id] = gtk_css_value_ref (result);
|
||||
}
|
||||
|
||||
pick_subproperty:
|
||||
@ -281,13 +278,7 @@ pick_subproperty:
|
||||
result = sub;
|
||||
}
|
||||
|
||||
computed = _gtk_css_value_compute (result,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
computed = _gtk_css_value_compute (result, property_id, context);
|
||||
computed->is_computed = TRUE;
|
||||
|
||||
gtk_css_value_unref (result);
|
||||
|
@ -34,13 +34,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_repeat_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
@ -113,13 +113,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_shadow_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
guint i;
|
||||
ShadowValue *shadows;
|
||||
@ -130,11 +126,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, 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].hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, context);
|
||||
shadows[i].voffset = _gtk_css_value_compute (shadow->voffset, property_id, context);
|
||||
shadows[i].radius = _gtk_css_value_compute (shadow->radius, property_id, context);
|
||||
shadows[i].spread = _gtk_css_value_compute (shadow->spread, property_id, context),
|
||||
shadows[i].color = _gtk_css_value_compute (shadow->color, property_id, context);
|
||||
shadows[i].inset = shadow->inset;
|
||||
}
|
||||
|
||||
|
@ -39,13 +39,11 @@
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtkcssdimensionvalueprivate.h"
|
||||
|
||||
static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *parent_style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section,
|
||||
GtkCssValue *shorthands[]);
|
||||
static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section,
|
||||
GtkCssComputeContext *context);
|
||||
|
||||
#define GET_VALUES(v) (GtkCssValue **)((guint8*)(v) + sizeof (GtkCssValues))
|
||||
|
||||
@ -73,11 +71,9 @@ gtk_css_## NAME ## _values_compute_changes_and_affects (GtkCssStyle *style1, \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
|
||||
GtkStyleProvider *provider, \
|
||||
GtkCssStyle *parent_style, \
|
||||
GtkCssLookup *lookup, \
|
||||
GtkCssValue *shorthands[]) \
|
||||
gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
|
||||
GtkCssLookup *lookup, \
|
||||
GtkCssComputeContext *context) \
|
||||
{ \
|
||||
GtkCssStyle *style = (GtkCssStyle *)sstyle; \
|
||||
int i; \
|
||||
@ -88,12 +84,10 @@ gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
|
||||
{ \
|
||||
guint id = NAME ## _props[i]; \
|
||||
gtk_css_static_style_compute_value (sstyle, \
|
||||
provider, \
|
||||
parent_style, \
|
||||
id, \
|
||||
lookup->values[id].value, \
|
||||
lookup->values[id].section, \
|
||||
shorthands); \
|
||||
context); \
|
||||
} \
|
||||
} \
|
||||
static GtkBitmask * gtk_css_ ## NAME ## _values_mask; \
|
||||
@ -653,18 +647,19 @@ static GtkCssValues *
|
||||
gtk_css_background_create_initial_values (void)
|
||||
{
|
||||
GtkCssBackgroundValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssBackgroundValues *)gtk_css_values_new (GTK_CSS_BACKGROUND_INITIAL_VALUES);
|
||||
|
||||
values->background_color = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_COLOR, NULL, NULL, NULL);
|
||||
values->box_shadow = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BOX_SHADOW, NULL, NULL, NULL);
|
||||
values->background_clip = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_CLIP, NULL, NULL, NULL);
|
||||
values->background_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, NULL, NULL, NULL);
|
||||
values->background_size = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_SIZE, NULL, NULL, NULL);
|
||||
values->background_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_POSITION, NULL, NULL, NULL);
|
||||
values->background_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_REPEAT, NULL, NULL, NULL);
|
||||
values->background_image = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_IMAGE, NULL, NULL, NULL);
|
||||
values->background_blend_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE, NULL, NULL, NULL);
|
||||
values->background_color = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_COLOR, &context);
|
||||
values->box_shadow = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BOX_SHADOW, &context);
|
||||
values->background_clip = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_CLIP, &context);
|
||||
values->background_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, &context);
|
||||
values->background_size = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_SIZE, &context);
|
||||
values->background_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_POSITION, &context);
|
||||
values->background_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_REPEAT, &context);
|
||||
values->background_image = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_IMAGE, &context);
|
||||
values->background_blend_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@ -673,29 +668,30 @@ static GtkCssValues *
|
||||
gtk_css_border_create_initial_values (void)
|
||||
{
|
||||
GtkCssBorderValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssBorderValues *)gtk_css_values_new (GTK_CSS_BORDER_INITIAL_VALUES);
|
||||
|
||||
values->border_top_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_STYLE, NULL, NULL, NULL);
|
||||
values->border_top_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_WIDTH, NULL, NULL, NULL);
|
||||
values->border_left_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE, NULL, NULL, NULL);
|
||||
values->border_left_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH, NULL, NULL, NULL);
|
||||
values->border_bottom_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE, NULL, NULL, NULL);
|
||||
values->border_bottom_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH, NULL, NULL, NULL);
|
||||
values->border_right_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE, NULL, NULL, NULL);
|
||||
values->border_right_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH, NULL, NULL, NULL);
|
||||
values->border_top_left_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS, NULL, NULL, NULL);
|
||||
values->border_top_right_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS, NULL, NULL, NULL);
|
||||
values->border_bottom_left_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS, NULL, NULL, NULL);
|
||||
values->border_bottom_right_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS, NULL, NULL, NULL);
|
||||
values->border_top_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_STYLE, &context);
|
||||
values->border_top_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_WIDTH, &context);
|
||||
values->border_left_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE, &context);
|
||||
values->border_left_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH, &context);
|
||||
values->border_bottom_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE, &context);
|
||||
values->border_bottom_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH, &context);
|
||||
values->border_right_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE, &context);
|
||||
values->border_right_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH, &context);
|
||||
values->border_top_left_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS, &context);
|
||||
values->border_top_right_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS, &context);
|
||||
values->border_bottom_left_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS, &context);
|
||||
values->border_bottom_right_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS, &context);
|
||||
values->border_top_color = NULL;
|
||||
values->border_right_color = NULL;
|
||||
values->border_bottom_color = NULL;
|
||||
values->border_left_color = NULL;
|
||||
values->border_image_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE, NULL, NULL, NULL);
|
||||
values->border_image_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT, NULL, NULL, NULL);
|
||||
values->border_image_slice = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE, NULL, NULL, NULL);
|
||||
values->border_image_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH, NULL, NULL, NULL);
|
||||
values->border_image_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE, &context);
|
||||
values->border_image_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT, &context);
|
||||
values->border_image_slice = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE, &context);
|
||||
values->border_image_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@ -704,12 +700,13 @@ static GtkCssValues *
|
||||
gtk_css_outline_create_initial_values (void)
|
||||
{
|
||||
GtkCssOutlineValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssOutlineValues *)gtk_css_values_new (GTK_CSS_OUTLINE_INITIAL_VALUES);
|
||||
|
||||
values->outline_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_STYLE, NULL, NULL, NULL);
|
||||
values->outline_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_WIDTH, NULL, NULL, NULL);
|
||||
values->outline_offset = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_OFFSET, NULL, NULL, NULL);
|
||||
values->outline_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_STYLE, &context);
|
||||
values->outline_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_WIDTH, &context);
|
||||
values->outline_offset = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_OFFSET, &context);
|
||||
values->outline_color = NULL;
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
@ -731,20 +728,21 @@ static GtkCssValues *
|
||||
gtk_css_font_variant_create_initial_values (void)
|
||||
{
|
||||
GtkCssFontVariantValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssFontVariantValues *)gtk_css_values_new (GTK_CSS_FONT_VARIANT_INITIAL_VALUES);
|
||||
|
||||
values->text_decoration_line = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_LINE, NULL, NULL, NULL);
|
||||
values->text_decoration_line = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_LINE, &context);
|
||||
values->text_decoration_color = NULL;
|
||||
values->text_decoration_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE, NULL, NULL, NULL);
|
||||
values->text_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_TRANSFORM, NULL, NULL, NULL);
|
||||
values->font_kerning = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_KERNING, NULL, NULL, NULL);
|
||||
values->font_variant_ligatures = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES, NULL, NULL, NULL);
|
||||
values->font_variant_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_POSITION, NULL, NULL, NULL);
|
||||
values->font_variant_caps = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_CAPS, NULL, NULL, NULL);
|
||||
values->font_variant_numeric = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC, NULL, NULL, NULL);
|
||||
values->font_variant_alternates = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_ALTERNATES, NULL, NULL, NULL);
|
||||
values->font_variant_east_asian = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN, NULL, NULL, NULL);
|
||||
values->text_decoration_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE, &context);
|
||||
values->text_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_TRANSFORM, &context);
|
||||
values->font_kerning = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_KERNING, &context);
|
||||
values->font_variant_ligatures = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES, &context);
|
||||
values->font_variant_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_POSITION, &context);
|
||||
values->font_variant_caps = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_CAPS, &context);
|
||||
values->font_variant_numeric = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC, &context);
|
||||
values->font_variant_alternates = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_ALTERNATES, &context);
|
||||
values->font_variant_east_asian = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@ -753,17 +751,18 @@ static GtkCssValues *
|
||||
gtk_css_animation_create_initial_values (void)
|
||||
{
|
||||
GtkCssAnimationValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssAnimationValues *)gtk_css_values_new (GTK_CSS_ANIMATION_INITIAL_VALUES);
|
||||
|
||||
values->animation_name = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_NAME, NULL, NULL, NULL);
|
||||
values->animation_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DURATION, NULL, NULL, NULL);
|
||||
values->animation_timing_function = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION, NULL, NULL, NULL);
|
||||
values->animation_iteration_count = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT, NULL, NULL, NULL);
|
||||
values->animation_direction = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DIRECTION, NULL, NULL, NULL);
|
||||
values->animation_play_state = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE, NULL, NULL, NULL);
|
||||
values->animation_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DELAY, NULL, NULL, NULL);
|
||||
values->animation_fill_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, NULL, NULL, NULL);
|
||||
values->animation_name = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_NAME, &context);
|
||||
values->animation_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DURATION, &context);
|
||||
values->animation_timing_function = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION, &context);
|
||||
values->animation_iteration_count = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT, &context);
|
||||
values->animation_direction = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DIRECTION, &context);
|
||||
values->animation_play_state = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE, &context);
|
||||
values->animation_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DELAY, &context);
|
||||
values->animation_fill_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@ -772,13 +771,14 @@ static GtkCssValues *
|
||||
gtk_css_transition_create_initial_values (void)
|
||||
{
|
||||
GtkCssTransitionValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssTransitionValues *)gtk_css_values_new (GTK_CSS_TRANSITION_INITIAL_VALUES);
|
||||
|
||||
values->transition_property = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_PROPERTY, NULL, NULL, NULL);
|
||||
values->transition_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DURATION, NULL, NULL, NULL);
|
||||
values->transition_timing_function = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION, NULL, NULL, NULL);
|
||||
values->transition_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DELAY, NULL, NULL, NULL);
|
||||
values->transition_property = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_PROPERTY, &context);
|
||||
values->transition_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DURATION, &context);
|
||||
values->transition_timing_function = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION, &context);
|
||||
values->transition_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DELAY, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@ -787,20 +787,21 @@ static GtkCssValues *
|
||||
gtk_css_size_create_initial_values (void)
|
||||
{
|
||||
GtkCssSizeValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssSizeValues *)gtk_css_values_new (GTK_CSS_SIZE_INITIAL_VALUES);
|
||||
|
||||
values->margin_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_TOP, NULL, NULL, NULL);
|
||||
values->margin_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_LEFT, NULL, NULL, NULL);
|
||||
values->margin_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_BOTTOM, NULL, NULL, NULL);
|
||||
values->margin_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_RIGHT, NULL, NULL, NULL);
|
||||
values->padding_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_TOP, NULL, NULL, NULL);
|
||||
values->padding_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_LEFT, NULL, NULL, NULL);
|
||||
values->padding_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_BOTTOM, NULL, NULL, NULL);
|
||||
values->padding_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_RIGHT, NULL, NULL, NULL);
|
||||
values->border_spacing = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_SPACING, NULL, NULL, NULL);
|
||||
values->min_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_WIDTH, NULL, NULL, NULL);
|
||||
values->min_height = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_HEIGHT, NULL, NULL, NULL);
|
||||
values->margin_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_TOP, &context);
|
||||
values->margin_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_LEFT, &context);
|
||||
values->margin_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_BOTTOM, &context);
|
||||
values->margin_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_RIGHT, &context);
|
||||
values->padding_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_TOP, &context);
|
||||
values->padding_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_LEFT, &context);
|
||||
values->padding_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_BOTTOM, &context);
|
||||
values->padding_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_RIGHT, &context);
|
||||
values->border_spacing = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_SPACING, &context);
|
||||
values->min_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_WIDTH, &context);
|
||||
values->min_height = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_HEIGHT, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@ -809,16 +810,17 @@ static GtkCssValues *
|
||||
gtk_css_other_create_initial_values (void)
|
||||
{
|
||||
GtkCssOtherValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssOtherValues *)gtk_css_values_new (GTK_CSS_OTHER_INITIAL_VALUES);
|
||||
|
||||
values->icon_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_SOURCE, NULL, NULL, NULL);
|
||||
values->icon_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_TRANSFORM, NULL, NULL, NULL);
|
||||
values->icon_filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_FILTER, NULL, NULL, NULL);
|
||||
values->transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM, NULL, NULL, NULL);
|
||||
values->transform_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM_ORIGIN, NULL, NULL, NULL);
|
||||
values->opacity = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OPACITY, NULL, NULL, NULL);
|
||||
values->filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FILTER, NULL, NULL, NULL);
|
||||
values->icon_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_SOURCE, &context);
|
||||
values->icon_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_TRANSFORM, &context);
|
||||
values->icon_filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_FILTER, &context);
|
||||
values->transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM, &context);
|
||||
values->transform_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM_ORIGIN, &context);
|
||||
values->opacity = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OPACITY, &context);
|
||||
values->filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FILTER, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@ -831,6 +833,7 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
{
|
||||
GtkCssStyle *style = (GtkCssStyle *)sstyle;
|
||||
GtkCssValue *shorthands[GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES] = { NULL, };
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
gtk_internal_return_if_fail (lookup != NULL);
|
||||
gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
|
||||
@ -864,6 +867,11 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
style->variables = gtk_css_variable_set_ref (parent_style->variables);
|
||||
}
|
||||
|
||||
context.provider = provider;
|
||||
context.style = (GtkCssStyle *) sstyle;
|
||||
context.parent_style = parent_style;
|
||||
context.shorthands = shorthands;
|
||||
|
||||
if (_gtk_bitmask_is_empty (_gtk_css_lookup_get_set_values (lookup)))
|
||||
{
|
||||
style->background = (GtkCssBackgroundValues *)gtk_css_values_ref (gtk_css_background_initial_values);
|
||||
@ -883,9 +891,9 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
gtk_css_core_values_new_compute (sstyle, lookup, &context);
|
||||
gtk_css_icon_values_new_compute (sstyle, lookup, &context);
|
||||
gtk_css_font_values_new_compute (sstyle, lookup, &context);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -894,57 +902,57 @@ 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, shorthands);
|
||||
gtk_css_core_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_background_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_border_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_icon_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_outline_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_font_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_font_variant_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_animation_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_transition_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_size_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
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, shorthands);
|
||||
gtk_css_other_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
for (unsigned int i = 0; i < GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES; i++)
|
||||
{
|
||||
@ -998,13 +1006,11 @@ G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE == GTK_CSS_PROPERTY_BORDER_L
|
||||
G_STATIC_ASSERT (GTK_CSS_PROPERTY_OUTLINE_STYLE == GTK_CSS_PROPERTY_OUTLINE_WIDTH - 1);
|
||||
|
||||
static void
|
||||
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *parent_style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *value, *original_value;
|
||||
GtkBorderStyle border_style;
|
||||
@ -1044,21 +1050,21 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
*/
|
||||
if (specified)
|
||||
{
|
||||
value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style, NULL, shorthands);
|
||||
value = _gtk_css_value_compute (specified, id, context);
|
||||
|
||||
if (gtk_css_value_contains_variables (specified))
|
||||
original_value = specified;
|
||||
else
|
||||
original_value = NULL;
|
||||
}
|
||||
else if (parent_style && _gtk_css_style_property_is_inherit (_gtk_css_style_property_lookup_by_id (id)))
|
||||
else if (context->parent_style && _gtk_css_style_property_is_inherit (_gtk_css_style_property_lookup_by_id (id)))
|
||||
{
|
||||
GtkCssValue *parent_original_value;
|
||||
|
||||
/* Just take the style from the parent */
|
||||
value = _gtk_css_value_ref (gtk_css_style_get_value (parent_style, id));
|
||||
value = _gtk_css_value_ref (gtk_css_style_get_value (context->parent_style, id));
|
||||
|
||||
parent_original_value = gtk_css_style_get_original_value (parent_style, id);
|
||||
parent_original_value = gtk_css_style_get_original_value (context->parent_style, id);
|
||||
|
||||
if (parent_original_value)
|
||||
original_value = parent_original_value;
|
||||
@ -1067,7 +1073,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
}
|
||||
else
|
||||
{
|
||||
value = _gtk_css_initial_value_new_compute (id, provider, (GtkCssStyle *)style, parent_style);
|
||||
value = _gtk_css_initial_value_new_compute (id, context);
|
||||
original_value = NULL;
|
||||
}
|
||||
|
||||
|
@ -35,13 +35,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_string_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
@ -273,14 +273,10 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_transform_compute (GtkCssTransform *dest,
|
||||
GtkCssTransform *src,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
dest->type = src->type;
|
||||
|
||||
@ -290,41 +286,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, 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);
|
||||
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, context);
|
||||
dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, context);
|
||||
dest->translate.z = _gtk_css_value_compute (src->translate.z, property_id, context);
|
||||
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, 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);
|
||||
dest->rotate.x = _gtk_css_value_compute (src->rotate.x, property_id, context);
|
||||
dest->rotate.y = _gtk_css_value_compute (src->rotate.y, property_id, context);
|
||||
dest->rotate.z = _gtk_css_value_compute (src->rotate.z, property_id, context);
|
||||
dest->rotate.angle = _gtk_css_value_compute (src->rotate.angle, property_id, context);
|
||||
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, 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);
|
||||
dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, context);
|
||||
dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, context);
|
||||
dest->scale.z = _gtk_css_value_compute (src->scale.z, property_id, context);
|
||||
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, shorthands);
|
||||
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style, variables, shorthands);
|
||||
dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, context);
|
||||
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, context);
|
||||
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, shorthands);
|
||||
dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, context);
|
||||
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, shorthands);
|
||||
dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, context);
|
||||
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, shorthands);
|
||||
dest->perspective.depth = _gtk_css_value_compute (src->perspective.depth, property_id, context);
|
||||
return dest->perspective.depth == src->perspective.depth;
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
default:
|
||||
@ -334,13 +330,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
gboolean changes;
|
||||
@ -358,11 +350,7 @@ gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
changes |= !gtk_css_transform_compute (&result->transforms[i],
|
||||
&value->transforms[i],
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
context);
|
||||
}
|
||||
|
||||
if (!changes)
|
||||
|
@ -35,13 +35,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssStyleProperty *property;
|
||||
GtkCssValue *unset_value;
|
||||
@ -53,13 +49,7 @@ gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
else
|
||||
unset_value = _gtk_css_initial_value_get ();
|
||||
|
||||
return _gtk_css_value_compute (unset_value,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables,
|
||||
shorthands);
|
||||
return _gtk_css_value_compute (unset_value, property_id, context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -210,13 +210,9 @@ 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,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[])
|
||||
_gtk_css_value_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
if (gtk_css_value_is_computed (value))
|
||||
return _gtk_css_value_ref (value);
|
||||
@ -225,7 +221,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, shorthands);
|
||||
return value->class->compute (value, property_id, context);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -41,17 +41,21 @@ typedef struct _GtkCssValueClass GtkCssValueClass;
|
||||
guint is_computed: 1; \
|
||||
guint contains_variables: 1;
|
||||
|
||||
typedef struct {
|
||||
GtkStyleProvider *provider;
|
||||
GtkCssStyle *style;
|
||||
GtkCssStyle *parent_style;
|
||||
GtkCssVariableSet *variables;
|
||||
GtkCssValue **shorthands;
|
||||
} GtkCssComputeContext;
|
||||
|
||||
struct _GtkCssValueClass {
|
||||
const char *type_name;
|
||||
void (* free) (GtkCssValue *value);
|
||||
|
||||
GtkCssValue * (* compute) (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[]);
|
||||
GtkCssComputeContext *context);
|
||||
gboolean (* equal) (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2);
|
||||
GtkCssValue * (* transition) (GtkCssValue *start,
|
||||
@ -78,11 +82,7 @@ void gtk_css_value_unref (GtkCssValue
|
||||
|
||||
GtkCssValue *_gtk_css_value_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables,
|
||||
GtkCssValue *shorthands[]) G_GNUC_PURE;
|
||||
GtkCssComputeContext *context) 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,
|
||||
|
@ -215,24 +215,28 @@ test_transition (gconstpointer data)
|
||||
GtkCssValue *result;
|
||||
GtkStyleProvider *provider;
|
||||
GtkCssStyle *style;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_settings_get_default ());
|
||||
style = gtk_css_static_style_get_default ();
|
||||
|
||||
context.provider = provider;
|
||||
context.style = style;
|
||||
|
||||
prop = (GtkStyleProperty *)_gtk_css_style_property_lookup_by_id (test->prop);
|
||||
|
||||
value1 = value_from_string (prop, test->value1);
|
||||
g_assert_nonnull (value1);
|
||||
computed1 = _gtk_css_value_compute (value1, test->prop, provider, style, NULL, NULL, NULL);
|
||||
computed1 = _gtk_css_value_compute (value1, test->prop, &context);
|
||||
|
||||
value2 = value_from_string (prop, test->value2);
|
||||
g_assert_nonnull (value2);
|
||||
computed2 = _gtk_css_value_compute (value2, test->prop, provider, style, NULL, NULL, NULL);
|
||||
computed2 = _gtk_css_value_compute (value2, test->prop, &context);
|
||||
|
||||
if (test->value3)
|
||||
{
|
||||
value3 = value_from_string (prop, test->value3);
|
||||
computed3 = _gtk_css_value_compute (value3, test->prop, provider, style, NULL, NULL, NULL);
|
||||
computed3 = _gtk_css_value_compute (value3, test->prop, &context);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user