cssparser: Make _gtk_css_parser_has_number() a bit smarter

Previously we just checked the first character. And if that was a "-" as
in "-gtk-some-special-value", we assumed it was a number. Which it
clearly wasn't.

Test included
This commit is contained in:
Benjamin Otte 2016-02-23 04:19:42 +01:00
parent 437dec6295
commit 3056d793a4
4 changed files with 22 additions and 1 deletions

View File

@ -599,8 +599,15 @@ _gtk_css_parser_try_double (GtkCssParser *parser,
gboolean
_gtk_css_parser_has_number (GtkCssParser *parser)
{
char c;
if (parser->data[0] == '-' || parser->data[0] == '+')
c = parser->data[1];
else
c = parser->data[0];
/* ahem */
return strchr ("+-0123456789.", parser->data[0]) != NULL;
return g_ascii_isdigit (c) || c == '.';
}
GtkCssValue *

View File

@ -195,6 +195,8 @@ test_data = \
background-shorthand-single.ref.css \
background-size.css \
background-size.ref.css \
background-win32-color-is-no-error.css \
background-win32-color-is-no-error.ref.css \
border.css \
border.errors \
border.ref.css \

View File

@ -0,0 +1,3 @@
a {
background: -gtk-win32-color(edit, highlight);
}

View File

@ -0,0 +1,9 @@
a {
background-clip: border-box;
background-color: -gtk-win32-color(edit, highlight);
background-image: none;
background-origin: padding-box;
background-position: left top;
background-repeat: repeat;
background-size: auto;
}