cssvalue: Make GtkCssShadowValue only hold one shadow

All the properties now are a GtkCssArrayValue of GtkCssSadowValue.
GtkCssArrayValue already does everything we want, so no need to
duplicate its funtionality.
This commit is contained in:
Benjamin Otte
2012-04-03 11:49:46 +02:00
parent c5878e8f6f
commit ca17270187
7 changed files with 209 additions and 274 deletions

View File

@ -153,6 +153,37 @@ _gtk_css_array_value_parse (GtkCssParser *parser,
return result;
}
GtkCssValue *
_gtk_css_array_value_compute (GtkCssValue *value,
GtkCssValue * (* compute_func) (GtkCssValue *, GtkStyleContext *),
GtkStyleContext *context)
{
GtkCssValue *result;
gboolean changed = FALSE;
guint i;
g_return_val_if_fail (value->class == &GTK_CSS_VALUE_ARRAY, NULL);
g_return_val_if_fail (compute_func != NULL, NULL);
if (value->n_values == 0)
return _gtk_css_value_ref (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] = (* compute_func) (value->values[i], context);
changed |= (result->values[i] != value->values[i]);
}
if (!changed)
{
_gtk_css_value_unref (result);
return _gtk_css_value_ref (value);
}
return result;
}
GtkCssValue *
_gtk_css_array_value_get_nth (const GtkCssValue *value,
guint i)