summaryrefslogtreecommitdiff
path: root/gtk/gtkstyleproperty.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2011-12-29 16:18:12 +0100
committerBenjamin Otte <otte@redhat.com>2012-01-09 18:37:51 +0100
commit57379adb3c07f5794f90a2a8bba80347af43ac30 (patch)
treeb7d455644013a564fc9e846fcb75c56681adac7c /gtk/gtkstyleproperty.c
parenta6ac53e2a9e121ef670509e1b39892710d774f7a (diff)
downloadgtk+-57379adb3c07f5794f90a2a8bba80347af43ac30.tar.gz
css: Add generic support for 'inherit' and 'initial'
CSS3 says they work for every property, so here we go.
Diffstat (limited to 'gtk/gtkstyleproperty.c')
-rw-r--r--gtk/gtkstyleproperty.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index 5eade848a0..81f1cfda02 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -2326,7 +2326,30 @@ _gtk_style_property_parse_value (const GtkStyleProperty *property,
if (property)
{
- if (_gtk_css_parser_try (parser, "none", TRUE))
+ if (_gtk_css_parser_try (parser, "initial", TRUE))
+ {
+ /* the initial value can be explicitly specified with the
+ * ‘initial’ keyword which all properties accept.
+ */
+ g_value_unset (value);
+ g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
+ g_value_set_enum (value, GTK_CSS_INITIAL);
+ return TRUE;
+ }
+ else if (_gtk_css_parser_try (parser, "inherit", TRUE))
+ {
+ /* All properties accept the ‘inherit’ value which
+ * explicitly specifies that the value will be determined
+ * by inheritance. The ‘inherit’ value can be used to
+ * strengthen inherited values in the cascade, and it can
+ * also be used on properties that are not normally inherited.
+ */
+ g_value_unset (value);
+ g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
+ g_value_set_enum (value, GTK_CSS_INHERIT);
+ return TRUE;
+ }
+ else if (_gtk_css_parser_try (parser, "none", TRUE))
{
/* Insert the default value, so it has an opportunity
* to override other style providers when merged
@@ -2383,7 +2406,9 @@ _gtk_style_property_print_value (const GtkStyleProperty *property,
css_string_funcs_init ();
- if (property)
+ if (G_VALUE_HOLDS (value, GTK_TYPE_CSS_SPECIAL_VALUE))
+ func = enum_value_print;
+ else if (property)
func = property->print_func;
else
func = NULL;