diff options
-rw-r--r-- | src/parse/css21.c | 4 | ||||
-rw-r--r-- | src/parse/css21props.c | 37 |
2 files changed, 36 insertions, 5 deletions
diff --git a/src/parse/css21.c b/src/parse/css21.c index 44866e8..c17ad17 100644 --- a/src/parse/css21.c +++ b/src/parse/css21.c @@ -63,7 +63,7 @@ enum { DECIMAL_LEADING_ZERO, LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK, LOWER_LATIN, UPPER_LATIN, ARMENIAN, GEORGIAN, LOWER_ALPHA, UPPER_ALPHA, INVERT, VISIBLE, ALWAYS, AVOID, X_LOW, LOW, HIGH, X_HIGH, STATIC, - RELATIVE, ABSOLUTE, ONCE, + RELATIVE, ABSOLUTE, ONCE, DIGITS, CONTINUOUS, LAST_KNOWN }; @@ -271,6 +271,8 @@ static struct { { "relative", SLEN("relative") }, { "absolute", SLEN("absolute") }, { "once", SLEN("once") }, + { "digits", SLEN("digits") }, + { "continuous", SLEN("continuous") }, }; typedef struct context_entry { diff --git a/src/parse/css21props.c b/src/parse/css21props.c index 4b8e1c7..829262d 100644 --- a/src/parse/css21props.c +++ b/src/parse/css21props.c @@ -3309,10 +3309,39 @@ css_error parse_speak_numeral(css_css21 *c, const parserutils_vector *vector, int *ctx, css_style **result) { - UNUSED(c); - UNUSED(vector); - UNUSED(ctx); - UNUSED(result); + css_error error; + const css_token *ident; + uint8_t flags = 0; + uint16_t value = 0; + uint32_t opv; + + /* IDENT (digits, continuous, inherit) */ + ident = parserutils_vector_iterate(vector, ctx); + if (ident == NULL || ident->type != CSS_TOKEN_IDENT) + return CSS_INVALID; + + error = parse_important(c, vector, ctx, &flags); + if (error != CSS_OK) + return error; + + if (ident->lower.ptr == c->strings[INHERIT]) { + flags |= FLAG_INHERIT; + } else if (ident->lower.ptr == c->strings[DIGITS]) { + value = SPEAK_NUMERAL_DIGITS; + } else if (ident->lower.ptr == c->strings[CONTINUOUS]) { + value = SPEAK_NUMERAL_CONTINUOUS; + } else + return CSS_INVALID; + + opv = buildOPV(OP_SPEAK_NUMERAL, flags, value); + + /* Allocate result */ + error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); + if (error != CSS_OK) + return error; + + /* Copy the bytecode to it */ + memcpy((*result)->bytecode, &opv, sizeof(opv)); return CSS_OK; } |