mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-16 13:40:31 +00:00
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:
parent
808bfe0a98
commit
1116914ea0
@ -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,
|
||||
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 (position->x, property_id, provider, scale, values, parent_values, &x_deps);
|
||||
y = _gtk_css_value_compute (position->y, property_id, provider, scale, values, parent_values, &y_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, style, parent_style, &y_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
|
||||
if (x == position->x && y == position->y)
|
||||
{
|
||||
|
@ -37,9 +37,8 @@ static GtkCssValue *
|
||||
gtk_css_value_repeat_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);
|
||||
|
@ -37,9 +37,8 @@ static GtkCssValue *
|
||||
gtk_css_value_rgba_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);
|
||||
|
@ -54,9 +54,8 @@ static GtkCssValue *
|
||||
gtk_css_value_shadows_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
@ -69,7 +68,7 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
|
||||
result = gtk_css_shadows_value_new (value->values, value->len);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -66,32 +66,31 @@ static GtkCssValue *
|
||||
gtk_css_value_shadow_compute (GtkCssValue *shadow,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssValue *hoffset, *voffset, *radius, *spread, *color;
|
||||
GtkCssDependencies child_deps;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
|
||||
|
@ -198,7 +198,6 @@ gtk_css_static_style_get_default (void)
|
||||
|
||||
result = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (settings),
|
||||
NULL,
|
||||
1,
|
||||
NULL);
|
||||
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 *
|
||||
gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
int scale,
|
||||
GtkCssStyle *parent)
|
||||
{
|
||||
GtkCssStaticStyle *result;
|
||||
@ -229,7 +227,6 @@ gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
|
||||
|
||||
_gtk_css_lookup_resolve (lookup,
|
||||
provider,
|
||||
scale,
|
||||
result,
|
||||
parent);
|
||||
|
||||
@ -243,7 +240,6 @@ gtk_css_static_style_new_update (GtkCssStaticStyle *style,
|
||||
const GtkBitmask *parent_changes,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
int scale,
|
||||
GtkCssStyle *parent)
|
||||
{
|
||||
GtkCssStaticStyle *result;
|
||||
@ -295,7 +291,6 @@ gtk_css_static_style_new_update (GtkCssStaticStyle *style,
|
||||
|
||||
_gtk_css_lookup_resolve (lookup,
|
||||
provider,
|
||||
scale,
|
||||
result,
|
||||
parent);
|
||||
|
||||
@ -308,7 +303,6 @@ gtk_css_static_style_new_update (GtkCssStaticStyle *style,
|
||||
void
|
||||
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *parent_style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
@ -338,7 +332,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
else
|
||||
_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);
|
||||
|
||||
|
@ -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_new_compute (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
int scale,
|
||||
GtkCssStyle *parent);
|
||||
GtkCssStyle * gtk_css_static_style_new_update (GtkCssStaticStyle *style,
|
||||
const GtkBitmask *parent_changes,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
int scale,
|
||||
GtkCssStyle *parent);
|
||||
|
||||
void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkStyleProviderPrivate*provider,
|
||||
int scale,
|
||||
GtkCssStyle *parent_style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
|
@ -37,9 +37,8 @@ static GtkCssValue *
|
||||
gtk_css_value_string_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);
|
||||
|
@ -231,9 +231,8 @@ gtk_css_transform_compute (GtkCssTransform *dest,
|
||||
GtkCssTransform *src,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssDependencies x_deps, y_deps;
|
||||
@ -246,33 +245,33 @@ gtk_css_transform_compute (GtkCssTransform *dest,
|
||||
return TRUE;
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
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.y = _gtk_css_value_compute (src->translate.y, property_id, provider, scale, values, parent_values, &y_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, style, parent_style, &y_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
|
||||
return dest->translate.x == src->translate.x
|
||||
&& dest->translate.y == src->translate.y;
|
||||
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;
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
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.y = _gtk_css_value_compute (src->scale.y, property_id, provider, scale, values, parent_values, &y_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, style, parent_style, &y_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
|
||||
return dest->scale.x == src->scale.x
|
||||
&& dest->scale.y == src->scale.y;
|
||||
case GTK_CSS_TRANSFORM_SKEW:
|
||||
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.y = _gtk_css_value_compute (src->skew.y, property_id, provider, scale, values, parent_values, &y_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, style, parent_style, &y_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
|
||||
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, 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;
|
||||
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;
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
default:
|
||||
@ -285,9 +284,8 @@ static GtkCssValue *
|
||||
gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssDependencies transform_deps;
|
||||
@ -308,9 +306,8 @@ gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
&value->transforms[i],
|
||||
property_id,
|
||||
provider,
|
||||
scale,
|
||||
values,
|
||||
parent_values,
|
||||
style,
|
||||
parent_style,
|
||||
&transform_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, transform_deps);
|
||||
}
|
||||
|
@ -38,14 +38,13 @@ static GtkCssValue *
|
||||
gtk_css_value_typed_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
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
|
||||
|
@ -38,9 +38,8 @@ static GtkCssValue *
|
||||
gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssStyleProperty *property;
|
||||
@ -56,9 +55,8 @@ gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
return _gtk_css_value_compute (unset_value,
|
||||
property_id,
|
||||
provider,
|
||||
scale,
|
||||
values,
|
||||
parent_values,
|
||||
style,
|
||||
parent_style,
|
||||
dependencies);
|
||||
}
|
||||
|
||||
|
@ -87,23 +87,22 @@ GtkCssValue *
|
||||
_gtk_css_value_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssDependencies fallback;
|
||||
|
||||
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_CSS_STYLE (values), NULL);
|
||||
gtk_internal_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), 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);
|
||||
|
||||
if (dependencies == NULL)
|
||||
dependencies = &fallback;
|
||||
*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
|
||||
|
@ -43,9 +43,8 @@ struct _GtkCssValueClass {
|
||||
GtkCssValue * (* compute) (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies);
|
||||
gboolean (* equal) (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2);
|
||||
@ -69,9 +68,8 @@ void _gtk_css_value_unref (GtkCssValue
|
||||
GtkCssValue *_gtk_css_value_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
int scale,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies);
|
||||
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2);
|
||||
|
@ -174,6 +174,14 @@ gtk_style_cascade_get_color (GtkStyleProviderPrivate *provider,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_style_cascade_get_scale (GtkStyleProviderPrivate *provider)
|
||||
{
|
||||
GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
|
||||
|
||||
return cascade->scale;
|
||||
}
|
||||
|
||||
static GtkCssKeyframes *
|
||||
gtk_style_cascade_get_keyframes (GtkStyleProviderPrivate *provider,
|
||||
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_settings = gtk_style_cascade_get_settings;
|
||||
iface->get_scale = gtk_style_cascade_get_scale;
|
||||
iface->get_keyframes = gtk_style_cascade_get_keyframes;
|
||||
iface->lookup = gtk_style_cascade_lookup;
|
||||
}
|
||||
|
@ -825,7 +825,6 @@ update_properties (GtkStyleContext *context,
|
||||
parent_changes,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
|
||||
&matcher,
|
||||
_gtk_style_cascade_get_scale (priv->cascade),
|
||||
parent);
|
||||
|
||||
gtk_widget_path_free (path);
|
||||
@ -857,12 +856,10 @@ build_properties (GtkStyleContext *context,
|
||||
if (_gtk_css_matcher_init (&matcher, path))
|
||||
style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
|
||||
&matcher,
|
||||
_gtk_style_cascade_get_scale (priv->cascade),
|
||||
parent);
|
||||
else
|
||||
style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
|
||||
NULL,
|
||||
_gtk_style_cascade_get_scale (priv->cascade),
|
||||
parent);
|
||||
|
||||
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,
|
||||
timestamp,
|
||||
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_clear_cache (context);
|
||||
|
@ -127,3 +127,17 @@ _gtk_style_provider_private_get_settings (GtkStyleProviderPrivate *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);
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ struct _GtkStyleProviderPrivateInterface
|
||||
GtkSettings * (* get_settings) (GtkStyleProviderPrivate *provider);
|
||||
GtkCssKeyframes * (* get_keyframes) (GtkStyleProviderPrivate *provider,
|
||||
const char *name);
|
||||
int (* get_scale) (GtkStyleProviderPrivate *provider);
|
||||
void (* lookup) (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
GtkCssLookup *lookup,
|
||||
@ -60,6 +61,7 @@ GtkCssValue * _gtk_style_provider_private_get_color (GtkStyleProvid
|
||||
const char *name);
|
||||
GtkCssKeyframes * _gtk_style_provider_private_get_keyframes(GtkStyleProviderPrivate *provider,
|
||||
const char *name);
|
||||
int _gtk_style_provider_private_get_scale (GtkStyleProviderPrivate *provider);
|
||||
void _gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
GtkCssLookup *lookup,
|
||||
|
Loading…
Reference in New Issue
Block a user