Commit 1116914e authored by Benjamin Otte's avatar Benjamin Otte

css: Move scale to GtkStyleProviderPrivate

This way, we can remove it as a separate argument from
gtk_css_value_compute() and allow computation to only depend on one
thing: the style provider.
parent 808bfe0a
......@@ -313,7 +313,6 @@ gtk_css_animated_style_create_css_animations (GSList *animation
GtkCssStyle *parent_style,
gint64 timestamp,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *source)
{
GtkCssValue *durations, *delays, *timing_functions, *animation_names;
......@@ -358,7 +357,7 @@ gtk_css_animated_style_create_css_animations (GSList *animation
if (keyframes == NULL)
continue;
keyframes = _gtk_css_keyframes_compute (keyframes, provider, scale, base_style, parent_style);
keyframes = _gtk_css_keyframes_compute (keyframes, provider, base_style, parent_style);
animation = _gtk_css_animation_new (name,
keyframes,
......@@ -401,7 +400,6 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
GtkCssStyle *parent_style,
gint64 timestamp,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *previous_style)
{
GtkCssAnimatedStyle *result;
......@@ -416,7 +414,7 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
if (previous_style != NULL)
animations = gtk_css_animated_style_create_css_transitions (animations, base_style, timestamp, previous_style);
animations = gtk_css_animated_style_create_css_animations (animations, base_style, parent_style, timestamp, provider, scale, previous_style);
animations = gtk_css_animated_style_create_css_animations (animations, base_style, parent_style, timestamp, provider, previous_style);
if (animations == NULL)
return g_object_ref (base_style);
......
......@@ -56,7 +56,6 @@ GtkCssStyle * gtk_css_animated_style_new (GtkCssStyle
GtkCssStyle *parent_style,
gint64 timestamp,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *previous_style);
GtkCssStyle * gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
GtkCssStyle *base,
......
......@@ -46,9 +46,8 @@ static GtkCssValue *
gtk_css_value_array_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssValue *result;
......@@ -59,7 +58,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, scale, values, parent_values, &child_deps);
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
......
......@@ -44,9 +44,8 @@ static GtkCssValue *
gtk_css_value_bg_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
......@@ -59,10 +58,10 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
x = y = NULL;
if (value->x)
x = _gtk_css_value_compute (value->x, property_id, provider, scale, values, parent_values, &x_deps);
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style, &x_deps);
if (value->y)
y = _gtk_css_value_compute (value->y, property_id, provider, scale, values, parent_values, &y_deps);
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
......
......@@ -45,10 +45,9 @@ static GtkCssValue *
gtk_css_value_border_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssValue *computed;
GtkCssDependencies child_deps;
......@@ -62,7 +61,7 @@ gtk_css_value_border_compute (GtkCssValue *value,
{
if (value->values[i])
{
computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, scale, values, parent_values, &child_deps);
computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
changed |= (computed->values[i] != value->values[i]);
}
......
......@@ -100,9 +100,8 @@ gtk_css_value_color_free (GtkCssValue *color)
static GtkCssValue *
gtk_css_value_color_get_fallback (guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values)
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
static const GdkRGBA transparent = { 0, 0, 0, 0 };
......@@ -124,9 +123,8 @@ gtk_css_value_color_get_fallback (guint property_id,
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id,
provider,
scale,
values,
parent_values,
style,
parent_style,
NULL);
default:
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
......@@ -302,9 +300,8 @@ static GtkCssValue *
gtk_css_value_color_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssValue *resolved, *current;
......@@ -316,9 +313,9 @@ gtk_css_value_color_compute (GtkCssValue *value,
*/
if (property_id == GTK_CSS_PROPERTY_COLOR)
{
if (parent_values)
if (parent_style)
{
current = gtk_css_style_get_value (parent_values, GTK_CSS_PROPERTY_COLOR);
current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
current_deps = GTK_CSS_EQUALS_PARENT;
}
else
......@@ -329,7 +326,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
}
else
{
current = gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR);
current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
current_deps = GTK_CSS_DEPENDS_ON_COLOR;
}
......@@ -341,7 +338,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
NULL);
if (resolved == NULL)
return gtk_css_value_color_get_fallback (property_id, provider, scale, values, parent_values);
return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style);
return resolved;
}
......
......@@ -40,16 +40,15 @@ static GtkCssValue *
gtk_css_value_corner_compute (GtkCssValue *corner,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
x = _gtk_css_value_compute (corner->x, property_id, provider, scale, values, parent_values, &x_deps);
y = _gtk_css_value_compute (corner->y, property_id, provider, scale, values, parent_values, &y_deps);
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style, &x_deps);
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
if (x == corner->x && y == corner->y)
{
......
......@@ -53,9 +53,8 @@ static GtkCssValue *
gtk_css_value_ease_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
......
......@@ -39,9 +39,8 @@ static GtkCssValue *
gtk_css_value_engine_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
......
......@@ -41,9 +41,8 @@ static GtkCssValue *
gtk_css_value_enum_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
......@@ -165,9 +164,8 @@ static GtkCssValue *
gtk_css_value_font_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
double font_size;
......@@ -200,8 +198,8 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
break;
case GTK_CSS_FONT_SIZE_SMALLER:
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values)
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
if (parent_style)
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
font_size = _gtk_css_font_size_get_default (provider);
/* XXX: This is what WebKit does... */
......@@ -209,8 +207,8 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
break;
case GTK_CSS_FONT_SIZE_LARGER:
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values)
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
if (parent_style)
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
font_size = _gtk_css_font_size_get_default (provider);
/* XXX: This is what WebKit does... */
......
......@@ -73,7 +73,6 @@ static GtkCssValue *
gtk_css_value_icon_theme_compute (GtkCssValue *icon_theme,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
......
......@@ -64,9 +64,8 @@ static GtkCssImage *
gtk_css_image_real_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
return g_object_ref (image);
......@@ -149,17 +148,16 @@ GtkCssImage *
_gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssDependencies unused;
GtkCssImageClass *klass;
g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
g_return_val_if_fail (GTK_IS_CSS_STYLE (values), NULL);
g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), NULL);
g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
if (dependencies == NULL)
dependencies = &unused;
......@@ -167,7 +165,7 @@ _gtk_css_image_compute (GtkCssImage *image,
klass = GTK_CSS_IMAGE_GET_CLASS (image);
return klass->compute (image, property_id, provider, scale, values, parent_values, dependencies);
return klass->compute (image, property_id, provider, style, parent_style, dependencies);
}
GtkCssImage *
......
......@@ -805,7 +805,6 @@ static GtkCssImage *
gtk_css_image_builtin_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
......
......@@ -34,9 +34,8 @@ static GtkCssImage *
gtk_css_image_gradient_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssImageGradient *gradient = GTK_CSS_IMAGE_GRADIENT (image);
......@@ -47,7 +46,7 @@ gtk_css_image_gradient_compute (GtkCssImage *image,
copy = g_object_new (GTK_TYPE_CSS_IMAGE_GRADIENT, NULL);
copy->gradient = gtk_gradient_ref (gradient->gradient);
copy->pattern = _gtk_gradient_resolve_full (copy->gradient, provider, values, parent_values, dependencies);
copy->pattern = _gtk_gradient_resolve_full (copy->gradient, provider, style, parent_style, dependencies);
return GTK_CSS_IMAGE (copy);
}
......
......@@ -128,9 +128,8 @@ static GtkCssImage *
gtk_css_image_icon_theme_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
......@@ -147,8 +146,8 @@ 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);
copy->icon_theme = gtk_icon_theme_get_for_screen (screen);
copy->scale = scale;
copy->color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR));
copy->scale = _gtk_style_provider_private_get_scale (provider);
copy->color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
*dependencies = GTK_CSS_DEPENDS_ON_COLOR;
......
......@@ -431,9 +431,8 @@ static GtkCssImage *
gtk_css_image_linear_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
......@@ -443,7 +442,7 @@ gtk_css_image_linear_compute (GtkCssImage *image,
copy = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
copy->repeating = linear->repeating;
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, scale, values, parent_values, dependencies);
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style, dependencies);
g_array_set_size (copy->stops, linear->stops->len);
for (i = 0; i < linear->stops->len; i++)
......@@ -454,12 +453,12 @@ gtk_css_image_linear_compute (GtkCssImage *image,
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
scopy = &g_array_index (copy->stops, GtkCssImageLinearColorStop, i);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, scale, values, parent_values, &child_deps);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
if (stop->offset)
{
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, scale, values, parent_values, &child_deps);
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
}
else
......
......@@ -58,9 +58,8 @@ struct _GtkCssImageClass
GtkCssImage *(* compute) (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies);
/* compare two images for equality */
gboolean (* equal) (GtkCssImage *image1,
......@@ -96,9 +95,8 @@ double _gtk_css_image_get_aspect_ratio (GtkCssImage *
GtkCssImage * _gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies);
gboolean _gtk_css_image_equal (GtkCssImage *image1,
GtkCssImage *image2);
......
......@@ -21,6 +21,8 @@
#include "gtkcssimagescaledprivate.h"
#include "gtkstyleproviderprivate.h"
G_DEFINE_TYPE (GtkCssImageScaled, _gtk_css_image_scaled, GTK_TYPE_CSS_IMAGE)
static int
......@@ -94,15 +96,15 @@ static GtkCssImage *
gtk_css_image_scaled_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
GtkCssImageScaled *copy;
int i;
int i, scale;
scale = _gtk_style_provider_private_get_scale (provider);
scale = MAX(MIN (scale, scaled->n_images), 1);
if (scaled->scale == scale)
......@@ -119,9 +121,8 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
copy->images[i] = _gtk_css_image_compute (scaled->images[i],
property_id,
provider,
scale,
values,
parent_values,
style,
parent_style,
dependencies);
else
copy->images[i] = g_object_ref (scaled->images[i]);
......
......@@ -123,9 +123,8 @@ static GtkCssImage *
gtk_css_image_url_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
......
......@@ -37,9 +37,8 @@ static GtkCssValue *
gtk_css_value_image_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkCssImage *image, *computed;
......@@ -49,7 +48,7 @@ gtk_css_value_image_compute (GtkCssValue *value,
if (image == NULL)
return _gtk_css_value_ref (value);
computed = _gtk_css_image_compute (image, property_id, provider, scale, values, parent_values, dependencies);
computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style, dependencies);
if (computed == image)
{
......
......@@ -37,24 +37,22 @@ static GtkCssValue *
gtk_css_value_inherit_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
if (parent_values)
if (parent_style)
{
*dependencies = GTK_CSS_EQUALS_PARENT;
return _gtk_css_value_ref (gtk_css_style_get_value (parent_values, property_id));
return _gtk_css_value_ref (gtk_css_style_get_value (parent_style, property_id));
}
else
{
return _gtk_css_value_compute (_gtk_css_initial_value_get (),
property_id,
provider,
scale,
values,
parent_values,
style,
parent_style,
dependencies);
}
}
......
......@@ -41,9 +41,8 @@ static GtkCssValue *
gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkSettings *settings;
......@@ -94,9 +93,8 @@ 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,
scale,
values,
parent_values,
style,
parent_style,
dependencies);
}
......
......@@ -437,7 +437,6 @@ _gtk_css_keyframes_print (GtkCssKeyframes *keyframes,
GtkCssKeyframes *
_gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
......@@ -466,7 +465,6 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
KEYFRAMES_VALUE (resolved, k, p) = _gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
resolved->property_ids[p],
provider,
scale,
style,
parent_style,
NULL);
......
......@@ -38,7 +38,6 @@ void _gtk_css_keyframes_print (GtkCssKeyframes
GtkCssKeyframes * _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *style,
GtkCssStyle *parent_style);
......
......@@ -105,7 +105,6 @@ _gtk_css_lookup_set (GtkCssLookup *lookup,
void
_gtk_css_lookup_resolve (GtkCssLookup *lookup,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStaticStyle *style,
GtkCssStyle *parent_style)
{
......@@ -124,7 +123,6 @@ _gtk_css_lookup_resolve (GtkCssLookup *lookup,
_gtk_bitmask_get (lookup->missing, i))
gtk_css_static_style_compute_value (GTK_CSS_STATIC_STYLE (style),
provider,
scale,
parent_style,
i,
lookup->values[i].value,
......
......@@ -50,7 +50,6 @@ void _gtk_css_lookup_set (GtkCssLookup
GtkCssValue *value);
void _gtk_css_lookup_resolve (GtkCssLookup *lookup,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStaticStyle *style,
GtkCssStyle *parent_style);
......
......@@ -38,30 +38,29 @@ gtk_css_value_number_free (GtkCssValue *value)
static double
get_base_font_size (guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
{
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values)
return _gtk_css_number_value_get (gtk_css_style_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
if (parent_style)
return _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
return _gtk_css_font_size_get_default (provider);
}
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
return _gtk_css_number_value_get (gtk_css_style_get_value (values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
}
static GtkCssValue *
gtk_css_value_number_compute (GtkCssValue *number,
guint property_id,
GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
{
GtkBorderStyle border_style;
......@@ -70,27 +69,27 @@ gtk_css_value_number_compute (GtkCssValue *number,
switch (property_id)
{
case GTK_CSS_PROPERTY_BORDER_TOP_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (values, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (values, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (values, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (values, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_PROPERTY_OUTLINE_WIDTH:
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (values, GTK_CSS_PROPERTY_OUTLINE_STYLE));
border_style = _gtk_css_border_style_value_get(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_STYLE));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break;
......@@ -107,7 +106,7 @@ gtk_css_value_number_compute (GtkCssValue *number,
/* percentages for font sizes are computed, other percentages aren't */
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
return _gtk_css_number_value_new (number->value / 100.0 *
get_base_font_size (property_id, provider, values, parent_values, dependencies),
get_base_font_size (property_id, provider, style, parent_style, dependencies),
GTK_CSS_PX);
case GTK_CSS_NUMBER:
case GTK_CSS_PX:
......@@ -135,13 +134,13 @@ gtk_css_value_number_compute (GtkCssValue *number,
break;
case GTK_CSS_EM:
return _gtk_css_number_value_new (number->value *
get_base_font_size (property_id, provider, values, parent_values, dependencies),
get_base_font_size (property_id, provider, style, parent_style, dependencies),
GTK_CSS_PX);
break;
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
return _gtk_css_number_value_new (number->value * 0.5 *
get_base_font_size (property_id, provider, values, parent_values, dependencies),
get_base_font_size (property_id, provider, style, parent_style, dependencies),
GTK_CSS_PX);
case GTK_CSS_RAD:
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),
......
......@@ -40,16 +40,15 @@ static GtkCssValue *
gtk_css_value_position_compute (GtkCssValue *position,
guint property_id,
GtkStyleProviderPrivate *provider,