From e8a6576c49abe7386a595201cf9d613de950cccb Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 25 Nov 2008 01:47:24 +0000 Subject: list-style-position svn path=/trunk/libcss/; revision=5768 --- src/parse/css21.c | 4 +++- src/parse/css21props.c | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/parse/css21.c b/src/parse/css21.c index 7aa63bd..7f10fca 100644 --- a/src/parse/css21.c +++ b/src/parse/css21.c @@ -59,7 +59,7 @@ enum { TABLE_CELL, TABLE_CAPTION, BELOW, LEVEL, ABOVE, HIGHER, LOWER, SHOW, HIDE, XX_SMALL, X_SMALL, SMALL, LARGE, X_LARGE, XX_LARGE, LARGER, SMALLER, NORMAL, ITALIC, OBLIQUE, SMALL_CAPS, BOLD, BOLDER, - LIGHTER, + LIGHTER, INSIDE, OUTSIDE, LAST_KNOWN }; @@ -239,6 +239,8 @@ static struct { { "bold", SLEN("bold") }, { "bolder", SLEN("bolder") }, { "lighter", SLEN("lighter") }, + { "inside", SLEN("inside") }, + { "outside", SLEN("outside") }, }; typedef struct context_entry { diff --git a/src/parse/css21props.c b/src/parse/css21props.c index 2bfd02d..dd33058 100644 --- a/src/parse/css21props.c +++ b/src/parse/css21props.c @@ -2051,10 +2051,39 @@ css_error parse_list_style_position(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 (inside, outside, 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[INSIDE]) { + value = LIST_STYLE_POSITION_INSIDE; + } else if (ident->lower.ptr == c->strings[OUTSIDE]) { + value = LIST_STYLE_POSITION_OUTSIDE; + } else + return CSS_INVALID; + + opv = buildOPV(OP_LIST_STYLE_POSITION, 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; } -- cgit v1.2.3