Commit 1454ba15 authored by Benjamin Otte's avatar Benjamin Otte

css: Huge refactoring to avoid computing wrong values

Here's the shortest description of the bug I can come up with:
When computing values, we have 3 kinds of dependencies:
(1) other properties ("currentColor" or em values)
(2) inherited properties ("inherit")
(3) generic things from the theme (@keyframes or @define-color)
Previously, we passed the GtkStyleContext as an argument, because it
provided these 3 things using:
(1) _gtk_style_context_peek_property()
(2) _gtk_style_context_peek_property(gtk_style_context_get_parent())
(3) context->priv->cascade

However, this makes it impossible to lookup values other than the ones
accessible via _gtk_style_context_peek_property(). And this is exactly
what we are doing in gtk_style_context_update_cache(). So when the cache
updates encountered case (1), they were looking up the values from the
wrong style data.

So this large patch essentially does nothing but replace the
context argument in all compute functions with new arguments for the 3
cases above:
(1) values
(2) parent_values
(3) provider

We apparently have a lot of computing code.
parent 0cc32eae
......@@ -43,10 +43,12 @@ gtk_css_value_array_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_array_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_array_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *result;
gboolean changed = FALSE;
......@@ -59,7 +61,7 @@ gtk_css_value_array_compute (GtkCssValue *value,
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
for (i = 0; i < value->n_values; i++)
{
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, context, &child_deps);
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
......
......@@ -41,10 +41,12 @@ gtk_css_value_bg_size_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_bg_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_bg_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
......@@ -56,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, context, &x_deps);
x = _gtk_css_value_compute (value->x, property_id, provider, values, parent_values, &x_deps);
if (value->y)
y = _gtk_css_value_compute (value->y, property_id, context, &y_deps);
y = _gtk_css_value_compute (value->y, property_id, provider, values, parent_values, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
......
......@@ -42,10 +42,12 @@ gtk_css_value_border_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_border_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_border_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *computed;
GtkCssDependencies child_deps;
......@@ -59,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, context, &child_deps);
computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
changed |= (computed->values[i] != value->values[i]);
}
......
......@@ -110,17 +110,19 @@ maybe_unref_section (gpointer section)
}
void
_gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
GtkStyleContext *context,
guint id,
GtkCssValue *specified,
GtkCssSection *section)
_gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *parent_values,
guint id,
GtkCssValue *specified,
GtkCssSection *section)
{
GtkCssDependencies dependencies;
GtkCssValue *value;
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
g_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values));
/* http://www.w3.org/TR/css3-cascade/#cascade
* Then, for every element, the value for each property can be found
......@@ -139,7 +141,7 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
else
_gtk_css_value_ref (specified);
value = _gtk_css_value_compute (specified, id, context, &dependencies);
value = _gtk_css_value_compute (specified, id, provider, values, parent_values, &dependencies);
_gtk_css_computed_values_set_value (values, id, value, dependencies, section);
......@@ -432,17 +434,16 @@ gtk_css_computed_values_find_animation (GtkCssComputedValues *values,
}
static void
gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values,
gint64 timestamp,
GtkCssComputedValues *source,
GtkStyleContext *context)
gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
gint64 timestamp,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *source)
{
GtkStyleProviderPrivate *provider;
GtkCssValue *durations, *delays, *timing_functions, *animations;
GtkCssValue *iteration_counts, *directions, *play_states, *fill_modes;
guint i;
provider = _gtk_style_context_get_style_provider (context);
animations = _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_ANIMATION_NAME);
durations = _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_ANIMATION_DURATION);
delays = _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_ANIMATION_DELAY);
......@@ -481,7 +482,7 @@ gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values,
if (keyframes == NULL)
continue;
keyframes = _gtk_css_keyframes_compute (keyframes, context);
keyframes = _gtk_css_keyframes_compute (keyframes, provider, values, parent_values);
animation = _gtk_css_animation_new (name,
keyframes,
......@@ -501,14 +502,15 @@ gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values,
/* PUBLIC API */
void
_gtk_css_computed_values_create_animations (GtkCssComputedValues *values,
gint64 timestamp,
GtkCssComputedValues *source,
GtkStyleContext *context)
_gtk_css_computed_values_create_animations (GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
gint64 timestamp,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *source)
{
if (source != NULL)
gtk_css_computed_values_create_css_transitions (values, timestamp, source);
gtk_css_computed_values_create_css_animations (values, timestamp, source, context);
gtk_css_computed_values_create_css_animations (values, parent_values, timestamp, provider, source);
}
GtkBitmask *
......
......@@ -24,7 +24,6 @@
#include "gtk/gtkbitmaskprivate.h"
#include "gtk/gtkcsssection.h"
#include "gtk/gtkstylecontext.h"
#include "gtk/gtkcssvalueprivate.h"
G_BEGIN_DECLS
......@@ -66,7 +65,8 @@ GType _gtk_css_computed_values_get_type (void) G_G
GtkCssComputedValues * _gtk_css_computed_values_new (void);
void _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
GtkStyleContext *context,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *parent_values,
guint id,
GtkCssValue *specified,
GtkCssSection *section);
......@@ -89,9 +89,10 @@ GtkBitmask * _gtk_css_computed_values_get_difference (GtkCssCom
GtkCssComputedValues *other);
void _gtk_css_computed_values_create_animations (GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
gint64 timestamp,
GtkCssComputedValues *source,
GtkStyleContext *context);
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *source);
GtkBitmask * _gtk_css_computed_values_advance (GtkCssComputedValues *values,
gint64 timestamp);
void _gtk_css_computed_values_cancel_animations (GtkCssComputedValues *values);
......
......@@ -37,16 +37,18 @@ gtk_css_value_corner_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_corner_compute (GtkCssValue *corner,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_corner_compute (GtkCssValue *corner,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
x = _gtk_css_value_compute (corner->x, property_id, context, &x_deps);
y = _gtk_css_value_compute (corner->y, property_id, context, &y_deps);
x = _gtk_css_value_compute (corner->x, property_id, provider, values, parent_values, &x_deps);
y = _gtk_css_value_compute (corner->y, property_id, provider, values, parent_values, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
if (x == corner->x && y == corner->y)
{
......
......@@ -50,10 +50,12 @@ gtk_css_value_ease_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_ease_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_ease_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
......
......@@ -35,10 +35,12 @@ gtk_css_value_engine_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_engine_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_engine_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
......
......@@ -36,10 +36,12 @@ gtk_css_value_enum_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_enum_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_enum_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_ref (value);
}
......
......@@ -21,6 +21,8 @@
#include "gtkcssimageprivate.h"
#include "gtkcsscomputedvaluesprivate.h"
/* for the types only */
#include "gtk/gtkcssimagecrossfadeprivate.h"
#include "gtk/gtkcssimagegradientprivate.h"
......@@ -57,10 +59,12 @@ gtk_css_image_real_get_aspect_ratio (GtkCssImage *image)
}
static GtkCssImage *
gtk_css_image_real_compute (GtkCssImage *image,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_image_real_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
return g_object_ref (image);
}
......@@ -116,16 +120,19 @@ _gtk_css_image_get_aspect_ratio (GtkCssImage *image)
}
GtkCssImage *
_gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
_gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssDependencies unused;
GtkCssImageClass *klass;
g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
if (dependencies == NULL)
dependencies = &unused;
......@@ -133,7 +140,7 @@ _gtk_css_image_compute (GtkCssImage *image,
klass = GTK_CSS_IMAGE_GET_CLASS (image);
return klass->compute (image, property_id, context, dependencies);
return klass->compute (image, property_id, provider, values, parent_values, dependencies);
}
void
......
......@@ -28,10 +28,12 @@
G_DEFINE_TYPE (GtkCssImageGradient, _gtk_css_image_gradient, GTK_TYPE_CSS_IMAGE)
static GtkCssImage *
gtk_css_image_gradient_compute (GtkCssImage *image,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_image_gradient_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImageGradient *gradient = GTK_CSS_IMAGE_GRADIENT (image);
GtkCssImageGradient *copy;
......@@ -41,7 +43,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, context, dependencies);
copy->pattern = _gtk_gradient_resolve_full (copy->gradient, provider, values, parent_values, dependencies);
return GTK_CSS_IMAGE (copy);
}
......
......@@ -409,10 +409,12 @@ gtk_css_image_linear_print (GtkCssImage *image,
}
static GtkCssImage *
gtk_css_image_linear_compute (GtkCssImage *image,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_image_linear_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
GtkCssImageLinear *copy;
......@@ -421,7 +423,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, context, dependencies);
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, values, parent_values, dependencies);
g_array_set_size (copy->stops, linear->stops->len);
for (i = 0; i < linear->stops->len; i++)
......@@ -432,12 +434,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, context, &child_deps);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
if (stop->offset)
{
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, context, &child_deps);
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, values, parent_values, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
}
else
......
......@@ -23,8 +23,8 @@
#include <cairo.h>
#include <glib-object.h>
#include "gtk/gtkstylecontext.h"
#include "gtk/gtkcssparserprivate.h"
#include "gtk/gtkcsstypesprivate.h"
G_BEGIN_DECLS
......@@ -48,64 +48,68 @@ struct _GtkCssImageClass
GObjectClass parent_class;
/* width of image or 0 if it has no width (optional) */
int (* get_width) (GtkCssImage *image);
int (* get_width) (GtkCssImage *image);
/* height of image or 0 if it has no height (optional) */
int (* get_height) (GtkCssImage *image);
int (* get_height) (GtkCssImage *image);
/* aspect ratio (width / height) of image or 0 if it has no aspect ratio (optional) */
double (* get_aspect_ratio) (GtkCssImage *image);
double (* get_aspect_ratio) (GtkCssImage *image);
/* create "computed value" in CSS terms, returns a new reference */
GtkCssImage *(* compute) (GtkCssImage *image,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies);
GtkCssImage *(* compute) (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies);
/* draw to 0,0 with the given width and height */
void (* draw) (GtkCssImage *image,
cairo_t *cr,
double width,
double height);
void (* draw) (GtkCssImage *image,
cairo_t *cr,
double width,
double height);
/* parse CSS, return TRUE on success */
gboolean (* parse) (GtkCssImage *image,
GtkCssParser *parser);
gboolean (* parse) (GtkCssImage *image,
GtkCssParser *parser);
/* print to CSS */
void (* print) (GtkCssImage *image,
GString *string);
void (* print) (GtkCssImage *image,
GString *string);
};
GType _gtk_css_image_get_type (void) G_GNUC_CONST;
gboolean _gtk_css_image_can_parse (GtkCssParser *parser);
GtkCssImage * _gtk_css_image_new_parse (GtkCssParser *parser);
int _gtk_css_image_get_width (GtkCssImage *image);
int _gtk_css_image_get_height (GtkCssImage *image);
double _gtk_css_image_get_aspect_ratio (GtkCssImage *image);
GtkCssImage * _gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies);
void _gtk_css_image_draw (GtkCssImage *image,
cairo_t *cr,
double width,
double height);
void _gtk_css_image_print (GtkCssImage *image,
GString *string);
void _gtk_css_image_get_concrete_size (GtkCssImage *image,
double specified_width,
double specified_height,
double default_width,
double default_height,
double *concrete_width,
double *concrete_height);
gboolean _gtk_css_image_can_parse (GtkCssParser *parser);
GtkCssImage * _gtk_css_image_new_parse (GtkCssParser *parser);
int _gtk_css_image_get_width (GtkCssImage *image);
int _gtk_css_image_get_height (GtkCssImage *image);
double _gtk_css_image_get_aspect_ratio (GtkCssImage *image);
GtkCssImage * _gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies);
void _gtk_css_image_draw (GtkCssImage *image,
cairo_t *cr,
double width,
double height);
void _gtk_css_image_print (GtkCssImage *image,
GString *string);
void _gtk_css_image_get_concrete_size (GtkCssImage *image,
double specified_width,
double specified_height,
double default_width,
double default_height,
double *concrete_width,
double *concrete_height);
cairo_surface_t *
_gtk_css_image_get_surface (GtkCssImage *image,
cairo_surface_t *target,
int surface_width,
int surface_height);
_gtk_css_image_get_surface (GtkCssImage *image,
cairo_surface_t *target,
int surface_width,
int surface_height);
G_END_DECLS
......
......@@ -34,10 +34,12 @@ gtk_css_value_image_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_image_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_image_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkCssImage *image, *computed;
......@@ -46,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, context, dependencies);
computed = _gtk_css_image_compute (image, property_id, provider, values, parent_values, dependencies);
if (computed == image)
{
......
......@@ -34,23 +34,25 @@ gtk_css_value_inherit_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_inherit_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_inherit_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
GtkStyleContext *parent = gtk_style_context_get_parent (context);
if (parent)
if (parent_values)
{
*dependencies = GTK_CSS_EQUALS_PARENT;
return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, property_id));
return _gtk_css_value_ref (_gtk_css_computed_values_get_value (parent_values, property_id));
}
else
{
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id,
context,
provider,
values,
parent_values,
dependencies);
}
}
......
......@@ -33,14 +33,18 @@ gtk_css_value_initial_free (GtkCssValue *value)
}
static GtkCssValue *
gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context,
GtkCssDependencies *dependencies)
gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,
GtkCssDependencies *dependencies)
{
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id,
context,
provider,
values,
parent_values,
dependencies);
}
......
......@@ -414,14 +414,18 @@ _gtk_css_keyframes_print (GtkCssKeyframes *keyframes,
}
GtkCssKeyframes *
_gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleContext *context)
_gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values)
{
GtkCssKeyframes *resolved;
guint k, p;
g_return_val_if_fail (keyframes != NULL, NULL);
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
resolved = gtk_css_keyframes_new ();
resolved->n_keyframes = keyframes->n_keyframes;
......@@ -439,7 +443,9 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
KEYFRAMES_VALUE (resolved, k, p) = _gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
resolved->property_ids[p],
context,
provider,
values,
parent_values,
NULL);
}
}
......
......@@ -36,8 +36,10 @@ void _gtk_css_keyframes_unref (GtkCssKeyframes
void _gtk_css_keyframes_print (GtkCssKeyframes *keyframes,
GString *string);
GtkCssKeyframes * _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleContext *context);
GtkCssKeyframes * _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values);
guint _gtk_css_keyframes_get_n_properties (GtkCssKeyframes *keyframes);
guint _gtk_css_keyframes_get_property_id (GtkCssKeyframes *keyframes,
......
......@@ -157,15 +157,17 @@ _gtk_css_lookup_set_computed (GtkCssLookup *lookup,
* an issue, go fix it.
**/
void
_gtk_css_lookup_resolve (GtkCssLookup *lookup,
GtkStyleContext *context,
GtkCssComputedValues *values)
_gtk_css_lookup_resolve (GtkCssLookup *lookup,
GtkStyleProviderPrivate *provider,
GtkCssComputedValues *values,
GtkCssComputedValues *parent_values)
{
guint i, n;
g_return_if_fail (lookup != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
g_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values));
n = _gtk_css_style_property_get_n_properties ();
......@@ -180,7 +182,8 @@ _gtk_css_lookup_resolve (GtkCssLookup *lookup,
else if (lookup->values[i].value ||
_gtk_bitmask_get (lookup->missing, i))
_gtk_css_computed_values_compute_value (values,
context,
provider,
parent_values,
i,
lookup->values[i].value,
lookup->values[i].section);
......
......@@ -22,30 +22,30 @@
#include "gtk/gtkbitmaskprivate.h"
#include "gtk/gtkcsscomputedvaluesprivate.h"
#include "gtk/gtkcsssection.h"
#include "gtk/gtkstylecontext.h"
G_BEGIN_DECLS
typedef struct _GtkCssLookup GtkCssLookup;
GtkCssLookup * _gtk_css_lookup_new (const GtkBitmask *relevant);
void _gtk_css_lookup_free (GtkCssLookup *lookup);
const GtkBitmask * _gtk_css_lookup_get_missing (const GtkCssLookup *lookup);
gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
guint id);
void _gtk_css_lookup_set (GtkCssLookup *lookup,
guint id,
GtkCssSection *section,
GtkCssValue *value);
void _gtk_css_lookup_set_computed (GtkCssLookup *lookup,