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.
This commit is contained in:
Benjamin Otte
2015-01-31 11:56:15 +01:00
parent 808bfe0a98
commit 1116914ea0
44 changed files with 177 additions and 215 deletions

View File

@ -313,7 +313,6 @@ gtk_css_animated_style_create_css_animations (GSList *animation
GtkCssStyle *parent_style, GtkCssStyle *parent_style,
gint64 timestamp, gint64 timestamp,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *source) GtkCssStyle *source)
{ {
GtkCssValue *durations, *delays, *timing_functions, *animation_names; GtkCssValue *durations, *delays, *timing_functions, *animation_names;
@ -358,7 +357,7 @@ gtk_css_animated_style_create_css_animations (GSList *animation
if (keyframes == NULL) if (keyframes == NULL)
continue; 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, animation = _gtk_css_animation_new (name,
keyframes, keyframes,
@ -401,7 +400,6 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
GtkCssStyle *parent_style, GtkCssStyle *parent_style,
gint64 timestamp, gint64 timestamp,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *previous_style) GtkCssStyle *previous_style)
{ {
GtkCssAnimatedStyle *result; GtkCssAnimatedStyle *result;
@ -416,7 +414,7 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
if (previous_style != NULL) 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_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) if (animations == NULL)
return g_object_ref (base_style); return g_object_ref (base_style);

View File

@ -56,7 +56,6 @@ GtkCssStyle * gtk_css_animated_style_new (GtkCssStyle
GtkCssStyle *parent_style, GtkCssStyle *parent_style,
gint64 timestamp, gint64 timestamp,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *previous_style); GtkCssStyle *previous_style);
GtkCssStyle * gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source, GtkCssStyle * gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
GtkCssStyle *base, GtkCssStyle *base,

View File

@ -46,9 +46,8 @@ static GtkCssValue *
gtk_css_value_array_compute (GtkCssValue *value, gtk_css_value_array_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssValue *result; GtkCssValue *result;
@ -59,7 +58,7 @@ gtk_css_value_array_compute (GtkCssValue *value,
result = NULL; result = NULL;
for (i = 0; i < value->n_values; i++) 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); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);

View File

@ -44,9 +44,8 @@ static GtkCssValue *
gtk_css_value_bg_size_compute (GtkCssValue *value, gtk_css_value_bg_size_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssValue *x, *y; GtkCssValue *x, *y;
@ -59,10 +58,10 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
x = y = NULL; x = y = NULL;
if (value->x) 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) 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); *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);

View File

@ -45,10 +45,9 @@ static GtkCssValue *
gtk_css_value_border_compute (GtkCssValue *value, gtk_css_value_border_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values, GtkCssDependencies *dependencies)
GtkCssDependencies *dependencies)
{ {
GtkCssValue *computed; GtkCssValue *computed;
GtkCssDependencies child_deps; GtkCssDependencies child_deps;
@ -62,7 +61,7 @@ gtk_css_value_border_compute (GtkCssValue *value,
{ {
if (value->values[i]) 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); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
changed |= (computed->values[i] != value->values[i]); changed |= (computed->values[i] != value->values[i]);
} }

View File

@ -100,9 +100,8 @@ gtk_css_value_color_free (GtkCssValue *color)
static GtkCssValue * static GtkCssValue *
gtk_css_value_color_get_fallback (guint property_id, gtk_css_value_color_get_fallback (guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style)
GtkCssStyle *parent_values)
{ {
static const GdkRGBA transparent = { 0, 0, 0, 0 }; 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)), return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id, property_id,
provider, provider,
scale, style,
values, parent_style,
parent_values,
NULL); NULL);
default: default:
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES) if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
@ -302,9 +300,8 @@ static GtkCssValue *
gtk_css_value_color_compute (GtkCssValue *value, gtk_css_value_color_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssValue *resolved, *current; GtkCssValue *resolved, *current;
@ -316,9 +313,9 @@ gtk_css_value_color_compute (GtkCssValue *value,
*/ */
if (property_id == GTK_CSS_PROPERTY_COLOR) 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; current_deps = GTK_CSS_EQUALS_PARENT;
} }
else else
@ -329,7 +326,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
} }
else 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; current_deps = GTK_CSS_DEPENDS_ON_COLOR;
} }
@ -341,7 +338,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
NULL); NULL);
if (resolved == 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; return resolved;
} }

View File

@ -40,16 +40,15 @@ static GtkCssValue *
gtk_css_value_corner_compute (GtkCssValue *corner, gtk_css_value_corner_compute (GtkCssValue *corner,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssValue *x, *y; GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps; GtkCssDependencies x_deps, y_deps;
x = _gtk_css_value_compute (corner->x, property_id, provider, scale, values, parent_values, &x_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, scale, values, parent_values, &y_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); *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
if (x == corner->x && y == corner->y) if (x == corner->x && y == corner->y)
{ {

View File

@ -53,9 +53,8 @@ static GtkCssValue *
gtk_css_value_ease_compute (GtkCssValue *value, gtk_css_value_ease_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
return _gtk_css_value_ref (value); return _gtk_css_value_ref (value);

View File

@ -39,9 +39,8 @@ static GtkCssValue *
gtk_css_value_engine_compute (GtkCssValue *value, gtk_css_value_engine_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
return _gtk_css_value_ref (value); return _gtk_css_value_ref (value);

View File

@ -41,9 +41,8 @@ static GtkCssValue *
gtk_css_value_enum_compute (GtkCssValue *value, gtk_css_value_enum_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
return _gtk_css_value_ref (value); return _gtk_css_value_ref (value);
@ -165,9 +164,8 @@ static GtkCssValue *
gtk_css_value_font_size_compute (GtkCssValue *value, gtk_css_value_font_size_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
double font_size; double font_size;
@ -200,8 +198,8 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
break; break;
case GTK_CSS_FONT_SIZE_SMALLER: case GTK_CSS_FONT_SIZE_SMALLER:
*dependencies = GTK_CSS_DEPENDS_ON_PARENT; *dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values) if (parent_style)
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100); font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else else
font_size = _gtk_css_font_size_get_default (provider); font_size = _gtk_css_font_size_get_default (provider);
/* XXX: This is what WebKit does... */ /* XXX: This is what WebKit does... */
@ -209,8 +207,8 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
break; break;
case GTK_CSS_FONT_SIZE_LARGER: case GTK_CSS_FONT_SIZE_LARGER:
*dependencies = GTK_CSS_DEPENDS_ON_PARENT; *dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values) if (parent_style)
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100); font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else else
font_size = _gtk_css_font_size_get_default (provider); font_size = _gtk_css_font_size_get_default (provider);
/* XXX: This is what WebKit does... */ /* XXX: This is what WebKit does... */

View File

@ -73,7 +73,6 @@ static GtkCssValue *
gtk_css_value_icon_theme_compute (GtkCssValue *icon_theme, gtk_css_value_icon_theme_compute (GtkCssValue *icon_theme,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *style, GtkCssStyle *style,
GtkCssStyle *parent_style, GtkCssStyle *parent_style,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)

View File

@ -64,9 +64,8 @@ static GtkCssImage *
gtk_css_image_real_compute (GtkCssImage *image, gtk_css_image_real_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
return g_object_ref (image); return g_object_ref (image);
@ -149,17 +148,16 @@ GtkCssImage *
_gtk_css_image_compute (GtkCssImage *image, _gtk_css_image_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssDependencies unused; GtkCssDependencies unused;
GtkCssImageClass *klass; GtkCssImageClass *klass;
g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL); 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 (GTK_IS_CSS_STYLE (style), NULL);
g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), NULL); g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
if (dependencies == NULL) if (dependencies == NULL)
dependencies = &unused; dependencies = &unused;
@ -167,7 +165,7 @@ _gtk_css_image_compute (GtkCssImage *image,
klass = GTK_CSS_IMAGE_GET_CLASS (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 * GtkCssImage *

View File

@ -805,7 +805,6 @@ static GtkCssImage *
gtk_css_image_builtin_compute (GtkCssImage *image, gtk_css_image_builtin_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *style, GtkCssStyle *style,
GtkCssStyle *parent_style, GtkCssStyle *parent_style,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)

View File

@ -34,9 +34,8 @@ static GtkCssImage *
gtk_css_image_gradient_compute (GtkCssImage *image, gtk_css_image_gradient_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssImageGradient *gradient = GTK_CSS_IMAGE_GRADIENT (image); 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 = g_object_new (GTK_TYPE_CSS_IMAGE_GRADIENT, NULL);
copy->gradient = gtk_gradient_ref (gradient->gradient); 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); return GTK_CSS_IMAGE (copy);
} }

View File

@ -128,9 +128,8 @@ static GtkCssImage *
gtk_css_image_icon_theme_compute (GtkCssImage *image, gtk_css_image_icon_theme_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image); 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 = g_object_new (GTK_TYPE_CSS_IMAGE_ICON_THEME, NULL);
copy->name = g_strdup (icon_theme->name); copy->name = g_strdup (icon_theme->name);
copy->icon_theme = gtk_icon_theme_get_for_screen (screen); copy->icon_theme = gtk_icon_theme_get_for_screen (screen);
copy->scale = scale; copy->scale = _gtk_style_provider_private_get_scale (provider);
copy->color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR)); copy->color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
*dependencies = GTK_CSS_DEPENDS_ON_COLOR; *dependencies = GTK_CSS_DEPENDS_ON_COLOR;

View File

@ -431,9 +431,8 @@ static GtkCssImage *
gtk_css_image_linear_compute (GtkCssImage *image, gtk_css_image_linear_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image); 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 = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
copy->repeating = linear->repeating; 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); g_array_set_size (copy->stops, linear->stops->len);
for (i = 0; i < linear->stops->len; i++) 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); stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
scopy = &g_array_index (copy->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); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
if (stop->offset) 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); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
} }
else else

View File

@ -58,9 +58,8 @@ struct _GtkCssImageClass
GtkCssImage *(* compute) (GtkCssImage *image, GtkCssImage *(* compute) (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies); GtkCssDependencies *dependencies);
/* compare two images for equality */ /* compare two images for equality */
gboolean (* equal) (GtkCssImage *image1, gboolean (* equal) (GtkCssImage *image1,
@ -96,9 +95,8 @@ double _gtk_css_image_get_aspect_ratio (GtkCssImage *
GtkCssImage * _gtk_css_image_compute (GtkCssImage *image, GtkCssImage * _gtk_css_image_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies); GtkCssDependencies *dependencies);
gboolean _gtk_css_image_equal (GtkCssImage *image1, gboolean _gtk_css_image_equal (GtkCssImage *image1,
GtkCssImage *image2); GtkCssImage *image2);

View File

@ -21,6 +21,8 @@
#include "gtkcssimagescaledprivate.h" #include "gtkcssimagescaledprivate.h"
#include "gtkstyleproviderprivate.h"
G_DEFINE_TYPE (GtkCssImageScaled, _gtk_css_image_scaled, GTK_TYPE_CSS_IMAGE) G_DEFINE_TYPE (GtkCssImageScaled, _gtk_css_image_scaled, GTK_TYPE_CSS_IMAGE)
static int static int
@ -94,15 +96,15 @@ static GtkCssImage *
gtk_css_image_scaled_compute (GtkCssImage *image, gtk_css_image_scaled_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image); GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
GtkCssImageScaled *copy; GtkCssImageScaled *copy;
int i; int i, scale;
scale = _gtk_style_provider_private_get_scale (provider);
scale = MAX(MIN (scale, scaled->n_images), 1); scale = MAX(MIN (scale, scaled->n_images), 1);
if (scaled->scale == scale) 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], copy->images[i] = _gtk_css_image_compute (scaled->images[i],
property_id, property_id,
provider, provider,
scale, style,
values, parent_style,
parent_values,
dependencies); dependencies);
else else
copy->images[i] = g_object_ref (scaled->images[i]); copy->images[i] = g_object_ref (scaled->images[i]);

View File

@ -123,9 +123,8 @@ static GtkCssImage *
gtk_css_image_url_compute (GtkCssImage *image, gtk_css_image_url_compute (GtkCssImage *image,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image); GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);

View File

@ -37,9 +37,8 @@ static GtkCssValue *
gtk_css_value_image_compute (GtkCssValue *value, gtk_css_value_image_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssImage *image, *computed; GtkCssImage *image, *computed;
@ -49,7 +48,7 @@ gtk_css_value_image_compute (GtkCssValue *value,
if (image == NULL) if (image == NULL)
return _gtk_css_value_ref (value); 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) if (computed == image)
{ {

View File

@ -37,24 +37,22 @@ static GtkCssValue *
gtk_css_value_inherit_compute (GtkCssValue *value, gtk_css_value_inherit_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
if (parent_values) if (parent_style)
{ {
*dependencies = GTK_CSS_EQUALS_PARENT; *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 else
{ {
return _gtk_css_value_compute (_gtk_css_initial_value_get (), return _gtk_css_value_compute (_gtk_css_initial_value_get (),
property_id, property_id,
provider, provider,
scale, style,
values, parent_style,
parent_values,
dependencies); dependencies);
} }
} }

View File

@ -41,9 +41,8 @@ static GtkCssValue *
gtk_css_value_initial_compute (GtkCssValue *value, gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkSettings *settings; 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)), return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id, property_id,
provider, provider,
scale, style,
values, parent_style,
parent_values,
dependencies); dependencies);
} }

View File

@ -437,7 +437,6 @@ _gtk_css_keyframes_print (GtkCssKeyframes *keyframes,
GtkCssKeyframes * GtkCssKeyframes *
_gtk_css_keyframes_compute (GtkCssKeyframes *keyframes, _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *style, GtkCssStyle *style,
GtkCssStyle *parent_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), KEYFRAMES_VALUE (resolved, k, p) = _gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
resolved->property_ids[p], resolved->property_ids[p],
provider, provider,
scale,
style, style,
parent_style, parent_style,
NULL); NULL);

View File

@ -38,7 +38,6 @@ void _gtk_css_keyframes_print (GtkCssKeyframes
GtkCssKeyframes * _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes, GtkCssKeyframes * _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *style, GtkCssStyle *style,
GtkCssStyle *parent_style); GtkCssStyle *parent_style);

View File

@ -105,7 +105,6 @@ _gtk_css_lookup_set (GtkCssLookup *lookup,
void void
_gtk_css_lookup_resolve (GtkCssLookup *lookup, _gtk_css_lookup_resolve (GtkCssLookup *lookup,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStaticStyle *style, GtkCssStaticStyle *style,
GtkCssStyle *parent_style) GtkCssStyle *parent_style)
{ {
@ -124,7 +123,6 @@ _gtk_css_lookup_resolve (GtkCssLookup *lookup,
_gtk_bitmask_get (lookup->missing, i)) _gtk_bitmask_get (lookup->missing, i))
gtk_css_static_style_compute_value (GTK_CSS_STATIC_STYLE (style), gtk_css_static_style_compute_value (GTK_CSS_STATIC_STYLE (style),
provider, provider,
scale,
parent_style, parent_style,
i, i,
lookup->values[i].value, lookup->values[i].value,

View File

@ -50,7 +50,6 @@ void _gtk_css_lookup_set (GtkCssLookup
GtkCssValue *value); GtkCssValue *value);
void _gtk_css_lookup_resolve (GtkCssLookup *lookup, void _gtk_css_lookup_resolve (GtkCssLookup *lookup,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStaticStyle *style, GtkCssStaticStyle *style,
GtkCssStyle *parent_style); GtkCssStyle *parent_style);

View File

@ -38,30 +38,29 @@ gtk_css_value_number_free (GtkCssValue *value)
static double static double
get_base_font_size (guint property_id, get_base_font_size (guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
GtkCssStyle *values, GtkCssStyle *style,
GtkCssStyle *parent_values, GtkCssStyle *parent_style,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE) if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
{ {
*dependencies = GTK_CSS_DEPENDS_ON_PARENT; *dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_values) if (parent_style)
return _gtk_css_number_value_get (gtk_css_style_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100); return _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else else
return _gtk_css_font_size_get_default (provider); return _gtk_css_font_size_get_default (provider);
} }
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE; *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 * static GtkCssValue *
gtk_css_value_number_compute (GtkCssValue *number, gtk_css_value_number_compute (GtkCssValue *number,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkBorderStyle border_style; GtkBorderStyle border_style;
@ -70,27 +69,27 @@ gtk_css_value_number_compute (GtkCssValue *number,
switch (property_id) switch (property_id)
{ {
case GTK_CSS_PROPERTY_BORDER_TOP_WIDTH: 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) if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER); return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break; break;
case GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH: 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) if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER); return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break; break;
case GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH: 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) if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER); return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break; break;
case GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH: 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) if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER); return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break; break;
case GTK_CSS_PROPERTY_OUTLINE_WIDTH: 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) if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
return _gtk_css_number_value_new (0, GTK_CSS_NUMBER); return _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break; break;
@ -107,7 +106,7 @@ gtk_css_value_number_compute (GtkCssValue *number,
/* percentages for font sizes are computed, other percentages aren't */ /* percentages for font sizes are computed, other percentages aren't */
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE) if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
return _gtk_css_number_value_new (number->value / 100.0 * 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); GTK_CSS_PX);
case GTK_CSS_NUMBER: case GTK_CSS_NUMBER:
case GTK_CSS_PX: case GTK_CSS_PX:
@ -135,13 +134,13 @@ gtk_css_value_number_compute (GtkCssValue *number,
break; break;
case GTK_CSS_EM: case GTK_CSS_EM:
return _gtk_css_number_value_new (number->value * 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); GTK_CSS_PX);
break; break;
case GTK_CSS_EX: case GTK_CSS_EX:
/* for now we pretend ex is half of em */ /* for now we pretend ex is half of em */
return _gtk_css_number_value_new (number->value * 0.5 * 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); GTK_CSS_PX);
case GTK_CSS_RAD: case GTK_CSS_RAD:
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI), return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),

View File

@ -40,16 +40,15 @@ static GtkCssValue *
gtk_css_value_position_compute (GtkCssValue *position, gtk_css_value_position_compute (GtkCssValue *position,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssValue *x, *y; GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps; GtkCssDependencies x_deps, y_deps;
x = _gtk_css_value_compute (position->x, property_id, provider, scale, values, parent_values, &x_deps); x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style, &x_deps);
y = _gtk_css_value_compute (position->y, property_id, provider, scale, values, parent_values, &y_deps); y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps); *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
if (x == position->x && y == position->y) if (x == position->x && y == position->y)
{ {

View File

@ -37,9 +37,8 @@ static GtkCssValue *
gtk_css_value_repeat_compute (GtkCssValue *value, gtk_css_value_repeat_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
return _gtk_css_value_ref (value); return _gtk_css_value_ref (value);

View File

@ -37,9 +37,8 @@ static GtkCssValue *
gtk_css_value_rgba_compute (GtkCssValue *value, gtk_css_value_rgba_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
return _gtk_css_value_ref (value); return _gtk_css_value_ref (value);

View File

@ -54,9 +54,8 @@ static GtkCssValue *
gtk_css_value_shadows_compute (GtkCssValue *value, gtk_css_value_shadows_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssValue *result; GtkCssValue *result;
@ -69,7 +68,7 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
result = gtk_css_shadows_value_new (value->values, value->len); result = gtk_css_shadows_value_new (value->values, value->len);
for (i = 0; i < value->len; i++) for (i = 0; i < value->len; i++)
{ {
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, scale, values, parent_values, &child_deps); result->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); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
} }

View File

@ -66,32 +66,31 @@ static GtkCssValue *
gtk_css_value_shadow_compute (GtkCssValue *shadow, gtk_css_value_shadow_compute (GtkCssValue *shadow,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssValue *hoffset, *voffset, *radius, *spread, *color; GtkCssValue *hoffset, *voffset, *radius, *spread, *color;
GtkCssDependencies child_deps; GtkCssDependencies child_deps;
child_deps = 0; child_deps = 0;
hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, scale, values, parent_values, &child_deps); hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0; child_deps = 0;
voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, scale, values, parent_values, &child_deps); voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0; child_deps = 0;
radius = _gtk_css_value_compute (shadow->radius, property_id, provider, scale, values, parent_values, &child_deps); radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0; child_deps = 0;
spread = _gtk_css_value_compute (shadow->spread, property_id, provider, scale, values, parent_values, &child_deps), spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style, &child_deps),
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0; child_deps = 0;
color = _gtk_css_value_compute (shadow->color, property_id, provider, scale, values, parent_values, &child_deps); color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps); *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color); return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);

View File

@ -198,7 +198,6 @@ gtk_css_static_style_get_default (void)
result = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (settings), result = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (settings),
NULL, NULL,
1,
NULL); NULL);
g_object_set_qdata_full (G_OBJECT (settings), style_quark, result, g_object_unref); g_object_set_qdata_full (G_OBJECT (settings), style_quark, result, g_object_unref);
@ -208,7 +207,6 @@ gtk_css_static_style_get_default (void)
GtkCssStyle * GtkCssStyle *
gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider, gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher, const GtkCssMatcher *matcher,
int scale,
GtkCssStyle *parent) GtkCssStyle *parent)
{ {
GtkCssStaticStyle *result; GtkCssStaticStyle *result;
@ -229,7 +227,6 @@ gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
_gtk_css_lookup_resolve (lookup, _gtk_css_lookup_resolve (lookup,
provider, provider,
scale,
result, result,
parent); parent);
@ -243,7 +240,6 @@ gtk_css_static_style_new_update (GtkCssStaticStyle *style,
const GtkBitmask *parent_changes, const GtkBitmask *parent_changes,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher, const GtkCssMatcher *matcher,
int scale,
GtkCssStyle *parent) GtkCssStyle *parent)
{ {
GtkCssStaticStyle *result; GtkCssStaticStyle *result;
@ -295,7 +291,6 @@ gtk_css_static_style_new_update (GtkCssStaticStyle *style,
_gtk_css_lookup_resolve (lookup, _gtk_css_lookup_resolve (lookup,
provider, provider,
scale,
result, result,
parent); parent);
@ -308,7 +303,6 @@ gtk_css_static_style_new_update (GtkCssStaticStyle *style,
void void
gtk_css_static_style_compute_value (GtkCssStaticStyle *style, gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale,
GtkCssStyle *parent_style, GtkCssStyle *parent_style,
guint id, guint id,
GtkCssValue *specified, GtkCssValue *specified,
@ -338,7 +332,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
else else
_gtk_css_value_ref (specified); _gtk_css_value_ref (specified);
value = _gtk_css_value_compute (specified, id, provider, scale, GTK_CSS_STYLE (style), parent_style, &dependencies); value = _gtk_css_value_compute (specified, id, provider, GTK_CSS_STYLE (style), parent_style, &dependencies);
gtk_css_static_style_set_value (style, id, value, section); gtk_css_static_style_set_value (style, id, value, section);

View File

@ -60,18 +60,15 @@ GType gtk_css_static_style_get_type (void) G_GNUC_CO
GtkCssStyle * gtk_css_static_style_get_default (void); GtkCssStyle * gtk_css_static_style_get_default (void);
GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider, GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher, const GtkCssMatcher *matcher,
int scale,
GtkCssStyle *parent); GtkCssStyle *parent);
GtkCssStyle * gtk_css_static_style_new_update (GtkCssStaticStyle *style, GtkCssStyle * gtk_css_static_style_new_update (GtkCssStaticStyle *style,
const GtkBitmask *parent_changes, const GtkBitmask *parent_changes,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher, const GtkCssMatcher *matcher,
int scale,
GtkCssStyle *parent); GtkCssStyle *parent);
void gtk_css_static_style_compute_value (GtkCssStaticStyle *style, void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProviderPrivate*provider, GtkStyleProviderPrivate*provider,
int scale,
GtkCssStyle *parent_style, GtkCssStyle *parent_style,
guint id, guint id,
GtkCssValue *specified, GtkCssValue *specified,

View File

@ -37,9 +37,8 @@ static GtkCssValue *
gtk_css_value_string_compute (GtkCssValue *value, gtk_css_value_string_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
return _gtk_css_value_ref (value); return _gtk_css_value_ref (value);

View File

@ -231,9 +231,8 @@ gtk_css_transform_compute (GtkCssTransform *dest,
GtkCssTransform *src, GtkCssTransform *src,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssDependencies x_deps, y_deps; GtkCssDependencies x_deps, y_deps;
@ -246,33 +245,33 @@ gtk_css_transform_compute (GtkCssTransform *dest,
return TRUE; return TRUE;
case GTK_CSS_TRANSFORM_TRANSLATE: case GTK_CSS_TRANSFORM_TRANSLATE:
x_deps = y_deps = 0; x_deps = y_deps = 0;
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, scale, values, parent_values, &x_deps); dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, parent_style, &x_deps);
dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, scale, values, parent_values, &y_deps); dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps); *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
return dest->translate.x == src->translate.x return dest->translate.x == src->translate.x
&& dest->translate.y == src->translate.y; && dest->translate.y == src->translate.y;
case GTK_CSS_TRANSFORM_ROTATE: case GTK_CSS_TRANSFORM_ROTATE:
dest->rotate.rotate = _gtk_css_value_compute (src->rotate.rotate, property_id, provider, scale, values, parent_values, dependencies); dest->rotate.rotate = _gtk_css_value_compute (src->rotate.rotate, property_id, provider, style, parent_style, dependencies);
return dest->rotate.rotate == src->rotate.rotate; return dest->rotate.rotate == src->rotate.rotate;
case GTK_CSS_TRANSFORM_SCALE: case GTK_CSS_TRANSFORM_SCALE:
x_deps = y_deps = 0; x_deps = y_deps = 0;
dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, scale, values, parent_values, &x_deps); dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, style, parent_style, &x_deps);
dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, scale, values, parent_values, &y_deps); dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps); *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
return dest->scale.x == src->scale.x return dest->scale.x == src->scale.x
&& dest->scale.y == src->scale.y; && dest->scale.y == src->scale.y;
case GTK_CSS_TRANSFORM_SKEW: case GTK_CSS_TRANSFORM_SKEW:
x_deps = y_deps = 0; x_deps = y_deps = 0;
dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, scale, values, parent_values, &x_deps); dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, style, parent_style, &x_deps);
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, scale, values, parent_values, &y_deps); dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps); *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
return dest->skew.x == src->skew.x return dest->skew.x == src->skew.x
&& dest->skew.y == src->skew.y; && dest->skew.y == src->skew.y;
case GTK_CSS_TRANSFORM_SKEW_X: case GTK_CSS_TRANSFORM_SKEW_X:
dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, scale, values, parent_values, dependencies); dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, style, parent_style, dependencies);
return dest->skew_x.skew == src->skew_x.skew; return dest->skew_x.skew == src->skew_x.skew;
case GTK_CSS_TRANSFORM_SKEW_Y: case GTK_CSS_TRANSFORM_SKEW_Y:
dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, scale, values, parent_values, dependencies); dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, style, parent_style, dependencies);
return dest->skew_y.skew == src->skew_y.skew; return dest->skew_y.skew == src->skew_y.skew;
case GTK_CSS_TRANSFORM_NONE: case GTK_CSS_TRANSFORM_NONE:
default: default:
@ -285,9 +284,8 @@ static GtkCssValue *
gtk_css_value_transform_compute (GtkCssValue *value, gtk_css_value_transform_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssDependencies transform_deps; GtkCssDependencies transform_deps;
@ -308,9 +306,8 @@ gtk_css_value_transform_compute (GtkCssValue *value,
&value->transforms[i], &value->transforms[i],
property_id, property_id,
provider, provider,
scale, style,
values, parent_style,
parent_values,
&transform_deps); &transform_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, transform_deps); *dependencies = _gtk_css_dependencies_union (*dependencies, transform_deps);
} }

View File

@ -38,14 +38,13 @@ static GtkCssValue *
gtk_css_value_typed_compute (GtkCssValue *value, gtk_css_value_typed_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (_gtk_css_style_property_lookup_by_id (property_id)); GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (_gtk_css_style_property_lookup_by_id (property_id));
return _gtk_css_style_funcs_compute_value (provider, values, parent_values, custom->pspec->value_type, value, dependencies); return _gtk_css_style_funcs_compute_value (provider, style, parent_style, custom->pspec->value_type, value, dependencies);
} }
static gboolean static gboolean

View File

@ -38,9 +38,8 @@ static GtkCssValue *
gtk_css_value_unset_compute (GtkCssValue *value, gtk_css_value_unset_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssStyleProperty *property; GtkCssStyleProperty *property;
@ -56,9 +55,8 @@ gtk_css_value_unset_compute (GtkCssValue *value,
return _gtk_css_value_compute (unset_value, return _gtk_css_value_compute (unset_value,
property_id, property_id,
provider, provider,
scale, style,
values, parent_style,
parent_values,
dependencies); dependencies);
} }

View File

@ -87,23 +87,22 @@ GtkCssValue *
_gtk_css_value_compute (GtkCssValue *value, _gtk_css_value_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies) GtkCssDependencies *dependencies)
{ {
GtkCssDependencies fallback; GtkCssDependencies fallback;
gtk_internal_return_val_if_fail (value != NULL, NULL); gtk_internal_return_val_if_fail (value != NULL, NULL);
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL); gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (values), NULL); gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
gtk_internal_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), NULL); gtk_internal_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
if (dependencies == NULL) if (dependencies == NULL)
dependencies = &fallback; dependencies = &fallback;
*dependencies = 0; *dependencies = 0;
return value->class->compute (value, property_id, provider, scale, values, parent_values, dependencies); return value->class->compute (value, property_id, provider, style, parent_style, dependencies);
} }
gboolean gboolean

View File

@ -43,9 +43,8 @@ struct _GtkCssValueClass {
GtkCssValue * (* compute) (GtkCssValue *value, GtkCssValue * (* compute) (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies); GtkCssDependencies *dependencies);
gboolean (* equal) (const GtkCssValue *value1, gboolean (* equal) (const GtkCssValue *value1,
const GtkCssValue *value2); const GtkCssValue *value2);
@ -69,9 +68,8 @@ void _gtk_css_value_unref (GtkCssValue
GtkCssValue *_gtk_css_value_compute (GtkCssValue *value, GtkCssValue *_gtk_css_value_compute (GtkCssValue *value,
guint property_id, guint property_id,
GtkStyleProviderPrivate *provider, GtkStyleProviderPrivate *provider,
int scale, GtkCssStyle *style,
GtkCssStyle *values, GtkCssStyle *parent_style,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies); GtkCssDependencies *dependencies);
gboolean _gtk_css_value_equal (const GtkCssValue *value1, gboolean _gtk_css_value_equal (const GtkCssValue *value1,
const GtkCssValue *value2); const GtkCssValue *value2);

View File

@ -174,6 +174,14 @@ gtk_style_cascade_get_color (GtkStyleProviderPrivate *provider,
return NULL; return NULL;
} }
static int
gtk_style_cascade_get_scale (GtkStyleProviderPrivate *provider)
{
GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
return cascade->scale;
}
static GtkCssKeyframes * static GtkCssKeyframes *
gtk_style_cascade_get_keyframes (GtkStyleProviderPrivate *provider, gtk_style_cascade_get_keyframes (GtkStyleProviderPrivate *provider,
const char *name) const char *name)
@ -235,6 +243,7 @@ gtk_style_cascade_provider_private_iface_init (GtkStyleProviderPrivateInterface
{ {
iface->get_color = gtk_style_cascade_get_color; iface->get_color = gtk_style_cascade_get_color;
iface->get_settings = gtk_style_cascade_get_settings; iface->get_settings = gtk_style_cascade_get_settings;
iface->get_scale = gtk_style_cascade_get_scale;
iface->get_keyframes = gtk_style_cascade_get_keyframes; iface->get_keyframes = gtk_style_cascade_get_keyframes;
iface->lookup = gtk_style_cascade_lookup; iface->lookup = gtk_style_cascade_lookup;
} }

View File

@ -825,7 +825,6 @@ update_properties (GtkStyleContext *context,
parent_changes, parent_changes,
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade), GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
&matcher, &matcher,
_gtk_style_cascade_get_scale (priv->cascade),
parent); parent);
gtk_widget_path_free (path); gtk_widget_path_free (path);
@ -857,12 +856,10 @@ build_properties (GtkStyleContext *context,
if (_gtk_css_matcher_init (&matcher, path)) if (_gtk_css_matcher_init (&matcher, path))
style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade), style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
&matcher, &matcher,
_gtk_style_cascade_get_scale (priv->cascade),
parent); parent);
else else
style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade), style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
NULL, NULL,
_gtk_style_cascade_get_scale (priv->cascade),
parent); parent);
gtk_widget_path_free (path); gtk_widget_path_free (path);
@ -3011,7 +3008,6 @@ _gtk_style_context_validate (GtkStyleContext *context,
priv->parent ? gtk_style_context_lookup_style (priv->parent) : NULL, priv->parent ? gtk_style_context_lookup_style (priv->parent) : NULL,
timestamp, timestamp,
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade), GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
_gtk_style_cascade_get_scale (priv->cascade),
gtk_style_context_should_create_transitions (context, current) ? current : NULL); gtk_style_context_should_create_transitions (context, current) ? current : NULL);
gtk_style_context_clear_cache (context); gtk_style_context_clear_cache (context);

View File

@ -127,3 +127,17 @@ _gtk_style_provider_private_get_settings (GtkStyleProviderPrivate *provider)
return iface->get_settings (provider); return iface->get_settings (provider);
} }
int
_gtk_style_provider_private_get_scale (GtkStyleProviderPrivate *provider)
{
GtkStyleProviderPrivateInterface *iface;
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), 1);
iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
if (!iface->get_scale)
return 1;
return iface->get_scale (provider);
}

View File

@ -44,6 +44,7 @@ struct _GtkStyleProviderPrivateInterface
GtkSettings * (* get_settings) (GtkStyleProviderPrivate *provider); GtkSettings * (* get_settings) (GtkStyleProviderPrivate *provider);
GtkCssKeyframes * (* get_keyframes) (GtkStyleProviderPrivate *provider, GtkCssKeyframes * (* get_keyframes) (GtkStyleProviderPrivate *provider,
const char *name); const char *name);
int (* get_scale) (GtkStyleProviderPrivate *provider);
void (* lookup) (GtkStyleProviderPrivate *provider, void (* lookup) (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher, const GtkCssMatcher *matcher,
GtkCssLookup *lookup, GtkCssLookup *lookup,
@ -60,6 +61,7 @@ GtkCssValue * _gtk_style_provider_private_get_color (GtkStyleProvid
const char *name); const char *name);
GtkCssKeyframes * _gtk_style_provider_private_get_keyframes(GtkStyleProviderPrivate *provider, GtkCssKeyframes * _gtk_style_provider_private_get_keyframes(GtkStyleProviderPrivate *provider,
const char *name); const char *name);
int _gtk_style_provider_private_get_scale (GtkStyleProviderPrivate *provider);
void _gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider, void _gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher, const GtkCssMatcher *matcher,
GtkCssLookup *lookup, GtkCssLookup *lookup,