diff options
author | Benjamin Otte <otte@redhat.com> | 2014-06-16 22:13:07 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-06-17 00:01:25 +0200 |
commit | aa6652aac7f6bcf61df111f5ce81c656086e3249 (patch) | |
tree | e717eb3ef927d9f404b26d548bc91760addd8085 /gtk/gtkcssprovider.c | |
parent | f0f9c2aa37893cf5d3f09ce9c8ac36a88d661e37 (diff) | |
download | gtk+-aa6652aac7f6bcf61df111f5ce81c656086e3249.tar.gz |
cssprovider: Names starting with -gtk- aren't style props
We want to have the "-gtk-" prefix for our custom CSS properties. But
we also want to parse names starting with a "-" as style properties.
So make sure that "-gtk-" is treated like a normal property and we emit
errors when somebody uses it wrong.
This is to catch errors with people typing
-gtk-iconsource: none;
instead of the correct
-gtk-icon-source: none;
Diffstat (limited to 'gtk/gtkcssprovider.c')
-rw-r--r-- | gtk/gtkcssprovider.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index 242f1b9327..30881beda1 100644 --- a/gtk/gtkcssprovider.c +++ b/gtk/gtkcssprovider.c @@ -2342,6 +2342,18 @@ parse_selector_list (GtkCssScanner *scanner) return selectors; } +static gboolean +name_is_style_property (const char *name) +{ + if (name[0] != '-') + return FALSE; + + if (g_str_has_prefix (name, "-gtk-")) + return FALSE; + + return TRUE; +} + static void parse_declaration (GtkCssScanner *scanner, GtkCssRuleset *ruleset) @@ -2356,7 +2368,7 @@ parse_declaration (GtkCssScanner *scanner, goto check_for_semicolon; property = _gtk_style_property_lookup (name); - if (property == NULL && name[0] != '-') + if (property == NULL && !name_is_style_property (name)) { gtk_css_provider_error (scanner->provider, scanner, @@ -2441,7 +2453,7 @@ parse_declaration (GtkCssScanner *scanner, gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_VALUE); } - else if (name[0] == '-') + else if (name_is_style_property (name)) { char *value_str; |