diff options
author | Benjamin Otte <otte@redhat.com> | 2014-05-11 03:22:06 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-05-11 03:23:55 +0200 |
commit | 0e462f0d2d03631a2ad7d38ef7dfc4292de5f9c7 (patch) | |
tree | 0b3b71752ef1cca7fd3062185e72d694c1131d7b /gtk/gtkcssshorthandpropertyimpl.c | |
parent | 3a72e2fb2483d4dd26eb74319613ffb505d89128 (diff) | |
download | gtk+-0e462f0d2d03631a2ad7d38ef7dfc4292de5f9c7.tar.gz |
css: Implement "all" shorthand
Here's the spec:
http://dev.w3.org/csswg/css-cascade/#all-shorthand
Also use it in the reset-to-defaults CSS where a bunch of properties had
been missing.
Diffstat (limited to 'gtk/gtkcssshorthandpropertyimpl.c')
-rw-r--r-- | gtk/gtkcssshorthandpropertyimpl.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c index 15cd359676..2d2faf80f0 100644 --- a/gtk/gtkcssshorthandpropertyimpl.c +++ b/gtk/gtkcssshorthandpropertyimpl.c @@ -813,6 +813,15 @@ parse_animation (GtkCssShorthandProperty *shorthand, return TRUE; } +static gboolean +parse_all (GtkCssShorthandProperty *shorthand, + GtkCssValue **values, + GtkCssParser *parser) +{ + _gtk_css_parser_error (parser, "The 'all' property can only be set to 'initial', 'inherit' or 'unset'"); + return FALSE; +} + /*** PACKING ***/ static void @@ -1089,6 +1098,25 @@ _gtk_css_shorthand_property_register (const char *name, node->query = query_func; } +/* NB: return value is transfer: container */ +static const char ** +get_all_subproperties (void) +{ + const char **properties; + guint i, n; + + n = _gtk_css_style_property_get_n_properties (); + properties = g_new (const char *, n + 1); + properties[n] = NULL; + + for (i = 0; i < n; i++) + { + properties[i] = _gtk_style_property_get_name (GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (i))); + } + + return properties; +} + void _gtk_css_shorthand_property_init_properties (void) { @@ -1119,6 +1147,8 @@ _gtk_css_shorthand_property_init_properties (void) const char *animation_subproperties[] = { "animation-name", "animation-iteration-count", "animation-duration", "animation-delay", "animation-timing-function", "animation-direction", "animation-fill-mode", NULL }; + const char **all_subproperties; + _gtk_css_shorthand_property_register ("font", PANGO_TYPE_FONT_DESCRIPTION, font_subproperties, @@ -1227,4 +1257,13 @@ _gtk_css_shorthand_property_init_properties (void) parse_animation, NULL, NULL); + + all_subproperties = get_all_subproperties (); + _gtk_css_shorthand_property_register ("all", + G_TYPE_NONE, + all_subproperties, + parse_all, + NULL, + NULL); + g_free (all_subproperties); } |