summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 01:47:24 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 01:47:24 +0000
commite8a6576c49abe7386a595201cf9d613de950cccb (patch)
treef8c5a675e6fab2a8a17af07a2c484d2e2f813c93 /src
parent19f379ef1cd72ba749656755fda3baa1a3cddd01 (diff)
downloadlibcss-e8a6576c49abe7386a595201cf9d613de950cccb.tar.gz
libcss-e8a6576c49abe7386a595201cf9d613de950cccb.tar.bz2
list-style-position
svn path=/trunk/libcss/; revision=5768
Diffstat (limited to 'src')
-rw-r--r--src/parse/css21.c4
-rw-r--r--src/parse/css21props.c37
2 files changed, 36 insertions, 5 deletions
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;
}