css: Initialize value before calling compute function

This commit is contained in:
Benjamin Otte 2012-01-14 05:00:54 +01:00
parent f7e0ce3b28
commit 5e5e8367ce
2 changed files with 6 additions and 10 deletions

View File

@ -287,7 +287,6 @@ gtk_css_style_property_real_compute_value (GtkCssStyleProperty *property,
GtkStyleContext *context,
const GValue *specified)
{
g_value_init (computed, _gtk_style_property_get_value_type (GTK_STYLE_PROPERTY (property)));
_gtk_css_style_compute_value (computed, context, specified);
}
@ -465,6 +464,8 @@ _gtk_css_style_property_compute_value (GtkCssStyleProperty *property,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (G_IS_VALUE (specified));
g_value_init (computed, _gtk_css_style_property_get_computed_type (property));
property->compute_value (property, computed, context, specified);
}

View File

@ -52,11 +52,6 @@ color_compute (GtkCssStyleProperty *property,
GtkStyleContext *context,
const GValue *specified)
{
g_value_init (computed, GDK_TYPE_RGBA);
/* for when resolvage fails */
restart:
if (G_VALUE_HOLDS (specified, GTK_TYPE_SYMBOLIC_COLOR))
{
GtkSymbolicColor *symbolic = g_value_get_boxed (specified);
@ -92,8 +87,10 @@ restart:
}
else
{
specified = _gtk_css_style_property_get_initial_value (property);
goto restart;
color_compute (property,
computed,
context,
_gtk_css_style_property_get_initial_value (property));
}
}
@ -446,7 +443,6 @@ css_image_value_compute (GtkCssStyleProperty *property,
if (image)
image = _gtk_css_image_compute (image, context);
g_value_init (computed, GTK_TYPE_CSS_IMAGE);
g_value_take_object (computed, image);
}
@ -465,7 +461,6 @@ compute_border_width (GtkCssStyleProperty *property,
style = _gtk_css_style_property_lookup_by_id (_gtk_css_style_property_get_id (property) - 1);
border_style = g_value_get_enum (_gtk_style_context_peek_property (context, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (style))));
g_value_init (computed, G_TYPE_INT);
if (border_style == GTK_BORDER_STYLE_NONE ||
border_style == GTK_BORDER_STYLE_HIDDEN)
g_value_set_int (computed, 0);