diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-23 23:58:26 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-23 23:58:26 +0000 |
commit | 0041e98675b7ac244c384a18399af03949274669 (patch) | |
tree | ef3febdfd4e48c9e26f03bb7cb5e4adbf64a0dde /src | |
parent | 6330432b55fce335173f67414cc7b103c23e12bf (diff) | |
download | libcss-0041e98675b7ac244c384a18399af03949274669.tar.gz libcss-0041e98675b7ac244c384a18399af03949274669.tar.bz2 |
Require comma separator in font-family and voice-family.
There's a potential quirk required here to match Mozilla, at the very least.
svn path=/trunk/libcss/; revision=6209
Diffstat (limited to 'src')
-rw-r--r-- | src/parse/properties.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/parse/properties.c b/src/parse/properties.c index 80958ac..275ad91 100644 --- a/src/parse/properties.c +++ b/src/parse/properties.c @@ -2624,10 +2624,13 @@ css_error parse_font_family(css_language *c, int temp_ctx = *ctx; uint8_t *ptr; - /* [ IDENT+ | STRING ] [ ','? [ IDENT+ | STRING ] ]* | IDENT(inherit) + /* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit) * * In the case of IDENT+, any whitespace between tokens is collapsed to * a single space + * + * \todo Mozilla makes the comma optional. + * Perhaps this is a quirk we should inherit? */ /* Pass 1: validate input and calculate space */ @@ -2722,6 +2725,11 @@ css_error parse_font_family(css_language *c, consumeWhitespace(vector, &temp_ctx); token = parserutils_vector_peek(vector, temp_ctx); + if (token != NULL && tokenIsChar(token, ',') == false && + tokenIsChar(token, '!') == false) { + return CSS_INVALID; + } + if (token != NULL && tokenIsChar(token, ',')) { parserutils_vector_iterate(vector, &temp_ctx); @@ -2907,6 +2915,13 @@ css_error parse_font_family(css_language *c, consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); + if (token != NULL && tokenIsChar(token, ',') == false && + tokenIsChar(token, '!') == false) { + css_stylesheet_style_destroy(c->sheet, *result); + *result = NULL; + return CSS_INVALID; + } + if (token != NULL && tokenIsChar(token, ',')) { parserutils_vector_iterate(vector, ctx); @@ -5766,7 +5781,7 @@ css_error parse_voice_family(css_language *c, int temp_ctx = *ctx; uint8_t *ptr; - /* [ IDENT+ | STRING ] [ ','? [ IDENT+ | STRING ] ]* | IDENT(inherit) + /* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit) * * In the case of IDENT+, any whitespace between tokens is collapsed to * a single space @@ -5851,6 +5866,11 @@ css_error parse_voice_family(css_language *c, consumeWhitespace(vector, &temp_ctx); token = parserutils_vector_peek(vector, temp_ctx); + if (token != NULL && tokenIsChar(token, ',') == false && + tokenIsChar(token, '!') == false) { + return CSS_INVALID; + } + if (token != NULL && tokenIsChar(token, ',')) { parserutils_vector_iterate(vector, &temp_ctx); @@ -6029,6 +6049,13 @@ css_error parse_voice_family(css_language *c, consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); + if (token != NULL && tokenIsChar(token, ',') == false && + tokenIsChar(token, '!') == false) { + css_stylesheet_style_destroy(c->sheet, *result); + *result = NULL; + return CSS_INVALID; + } + if (token != NULL && tokenIsChar(token, ',')) { parserutils_vector_iterate(vector, ctx); |