aboutsummaryrefslogtreecommitdiff
path: root/src/cssparser.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-10 17:55:58 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-10 17:55:58 +0100
commiteb6c379aeffe3e3ce626fb4ab8fa46dbd7766cbf (patch)
treeb59cee2d85ae474c8edbaea8bfd3f8b64cd26d98 /src/cssparser.cc
parentd4a1b71555071730503f09db02c562e48cf06419 (diff)
add support for negative numbers in CSS parser
Diffstat (limited to 'src/cssparser.cc')
-rw-r--r--src/cssparser.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cssparser.cc b/src/cssparser.cc
index e4637099..0fb0d3d8 100644
--- a/src/cssparser.cc
+++ b/src/cssparser.cc
@@ -426,7 +426,13 @@ static void Css_next_token(CssParser * parser)
}
}
- // \todo handle negative numbers according to CSS 2.1
+ // handle negative numbers
+ if (c == '-') {
+ if (i < MAX_STR_LEN - 1)
+ parser->tval[i++] = c;
+ c = Css_getc(parser);
+ }
+
if (isdigit(c)) {
parser->ttype = CSS_TK_DECINT;
do {
@@ -475,6 +481,12 @@ static void Css_next_token(CssParser * parser)
return;
}
+ if (i) {
+ Css_ungetc(parser); /* ungetc '-' */
+ i--;
+ c = Css_getc(parser);
+ }
+
if (isalpha(c) || c == '_' || c == '-') {
parser->ttype = CSS_TK_SYMBOL;