styleproperty: make background-image an array value

This also requires having the GtkCssArrayValue parse func forward the
base GFile from the style property parse implementation.
This commit is contained in:
Cosimo Cecchi 2012-05-10 11:18:29 -04:00
parent f65970b521
commit 580b585fc9
2 changed files with 49 additions and 6 deletions

View File

@ -616,6 +616,49 @@ css_image_value_assign (GtkCssStyleProperty *property,
return _gtk_css_image_value_new (NULL);
}
static GtkCssValue *
background_image_value_parse_one (GtkCssParser *parser)
{
return css_image_value_parse (NULL, parser);
}
static GtkCssValue *
background_image_value_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_array_value_parse (parser, background_image_value_parse_one, FALSE);
}
static GtkCssValue *
background_image_value_compute_one (GtkCssValue *value,
GtkStyleContext *context)
{
return css_image_value_compute (NULL, context, value);
}
static GtkCssValue *
background_image_value_compute (GtkCssStyleProperty *property,
GtkStyleContext *context,
GtkCssValue *specified)
{
return _gtk_css_array_value_compute (specified, background_image_value_compute_one, context);
}
static void
background_image_value_query (GtkCssStyleProperty *property,
const GtkCssValue *css_value,
GValue *value)
{
css_image_value_query (property, _gtk_css_array_value_get_nth (css_value, 0), value);
}
static GtkCssValue *
background_image_value_assign (GtkCssStyleProperty *property,
const GValue *value)
{
return _gtk_css_array_value_new (css_image_value_assign (property, value));
}
static GtkCssValue *
font_size_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
@ -1374,12 +1417,12 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_PROPERTY_BACKGROUND_IMAGE,
CAIRO_GOBJECT_TYPE_PATTERN,
GTK_STYLE_PROPERTY_ANIMATED,
css_image_value_parse,
background_image_value_parse,
NULL,
css_image_value_compute,
css_image_value_query,
css_image_value_assign,
_gtk_css_image_value_new (NULL));
background_image_value_compute,
background_image_value_query,
background_image_value_assign,
_gtk_css_array_value_new (_gtk_css_image_value_new (NULL)));
gtk_css_style_property_register ("border-image-source",
GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE,

View File

@ -292,7 +292,7 @@ _gtk_theming_background_init_context (GtkThemingBackground *bg)
_gtk_theming_background_apply_clip (bg);
_gtk_theming_background_apply_origin (bg);
bg->image = _gtk_css_image_value_get_image (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_IMAGE));
bg->image = _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_IMAGE), 0));
}
void