From b1146a417a2f0b5d57436c7e4f9345eff122b8e1 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 25 Nov 2008 02:04:52 +0000 Subject: list-style-type. Apparently, upper-greek doesn't exist, so remove it from the bytecode. svn path=/trunk/libcss/; revision=5769 --- src/bytecode/opcodes.h | 15 ++++++----- src/parse/css21.c | 18 +++++++++++++- src/parse/css21props.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 87 insertions(+), 13 deletions(-) diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h index a6a477b..b97b738 100644 --- a/src/bytecode/opcodes.h +++ b/src/bytecode/opcodes.h @@ -327,14 +327,13 @@ enum op_list_style_type { LIST_STYLE_TYPE_LOWER_ROMAN = 0x0005, LIST_STYLE_TYPE_UPPER_ROMAN = 0x0006, LIST_STYLE_TYPE_LOWER_GREEK = 0x0007, - LIST_STYLE_TYPE_UPPER_GREEK = 0x0008, - LIST_STYLE_TYPE_LOWER_LATIN = 0x0009, - LIST_STYLE_TYPE_UPPER_LATIN = 0x000a, - LIST_STYLE_TYPE_ARMENIAN = 0x000b, - LIST_STYLE_TYPE_GEORGIAN = 0x000c, - LIST_STYLE_TYPE_LOWER_ALPHA = 0x000d, - LIST_STYLE_TYPE_UPPER_ALPHA = 0x000e, - LIST_STYLE_TYPE_NONE = 0x000f, + LIST_STYLE_TYPE_LOWER_LATIN = 0x0008, + LIST_STYLE_TYPE_UPPER_LATIN = 0x0009, + LIST_STYLE_TYPE_ARMENIAN = 0x000a, + LIST_STYLE_TYPE_GEORGIAN = 0x000b, + LIST_STYLE_TYPE_LOWER_ALPHA = 0x000c, + LIST_STYLE_TYPE_UPPER_ALPHA = 0x000d, + LIST_STYLE_TYPE_NONE = 0x000e, }; enum op_margin { diff --git a/src/parse/css21.c b/src/parse/css21.c index 7f10fca..35a6aee 100644 --- a/src/parse/css21.c +++ b/src/parse/css21.c @@ -59,7 +59,9 @@ 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, INSIDE, OUTSIDE, + LIGHTER, INSIDE, OUTSIDE, DISC, CIRCLE, SQUARE, DECIMAL, + DECIMAL_LEADING_ZERO, LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK, + LOWER_LATIN, UPPER_LATIN, ARMENIAN, GEORGIAN, LOWER_ALPHA, UPPER_ALPHA, LAST_KNOWN }; @@ -241,6 +243,20 @@ static struct { { "lighter", SLEN("lighter") }, { "inside", SLEN("inside") }, { "outside", SLEN("outside") }, + { "disc", SLEN("disc") }, + { "circle", SLEN("circle") }, + { "square", SLEN("square") }, + { "decimal", SLEN("decimal") }, + { "decimal-leading-zero", SLEN("decimal-leading-zero") }, + { "lower-roman", SLEN("lower-roman") }, + { "upper-roman", SLEN("upper-roman") }, + { "lower-greek", SLEN("lower-greek") }, + { "lower-latin", SLEN("lower-latin") }, + { "upper-latin", SLEN("upper-latin") }, + { "armenian", SLEN("armenian") }, + { "georgian", SLEN("georgian") }, + { "lower-alpha", SLEN("lower-alpha") }, + { "upper-alpha", SLEN("upper-alpha") }, }; typedef struct context_entry { diff --git a/src/parse/css21props.c b/src/parse/css21props.c index dd33058..8574f82 100644 --- a/src/parse/css21props.c +++ b/src/parse/css21props.c @@ -2092,10 +2092,69 @@ css_error parse_list_style_type(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 (disc, circle, square, decimal, decimal-leading-zero, + * lower-roman, upper-roman, lower-greek, lower-latin, + * upper-latin, armenian, georgian, lower-alpha, upper-alpha, + * none, 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[DISC]) { + value = LIST_STYLE_TYPE_DISC; + } else if (ident->lower.ptr == c->strings[CIRCLE]) { + value = LIST_STYLE_TYPE_CIRCLE; + } else if (ident->lower.ptr == c->strings[SQUARE]) { + value = LIST_STYLE_TYPE_SQUARE; + } else if (ident->lower.ptr == c->strings[DECIMAL]) { + value = LIST_STYLE_TYPE_DECIMAL; + } else if (ident->lower.ptr == c->strings[DECIMAL_LEADING_ZERO]) { + value = LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO; + } else if (ident->lower.ptr == c->strings[LOWER_ROMAN]) { + value = LIST_STYLE_TYPE_LOWER_ROMAN; + } else if (ident->lower.ptr == c->strings[UPPER_ROMAN]) { + value = LIST_STYLE_TYPE_UPPER_ROMAN; + } else if (ident->lower.ptr == c->strings[LOWER_GREEK]) { + value = LIST_STYLE_TYPE_LOWER_GREEK; + } else if (ident->lower.ptr == c->strings[LOWER_LATIN]) { + value = LIST_STYLE_TYPE_LOWER_LATIN; + } else if (ident->lower.ptr == c->strings[UPPER_LATIN]) { + value = LIST_STYLE_TYPE_UPPER_LATIN; + } else if (ident->lower.ptr == c->strings[ARMENIAN]) { + value = LIST_STYLE_TYPE_ARMENIAN; + } else if (ident->lower.ptr == c->strings[GEORGIAN]) { + value = LIST_STYLE_TYPE_GEORGIAN; + } else if (ident->lower.ptr == c->strings[LOWER_ALPHA]) { + value = LIST_STYLE_TYPE_LOWER_ALPHA; + } else if (ident->lower.ptr == c->strings[UPPER_ALPHA]) { + value = LIST_STYLE_TYPE_UPPER_ALPHA; + } else if (ident->lower.ptr == c->strings[NONE]) { + value = LIST_STYLE_TYPE_NONE; + } else + return CSS_INVALID; + + opv = buildOPV(OP_LIST_STYLE_TYPE, 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