summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 22:24:22 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 22:24:22 +0000
commitcef5aec7535b00e96d37dba22b66bbc3866a4121 (patch)
treedfee2e23b5a042ebca009ff324a5a57686c7943c /src/parse
parent68bc37815cf700de1b7074a87a964d4803893492 (diff)
downloadlibcss-cef5aec7535b00e96d37dba22b66bbc3866a4121.tar.gz
libcss-cef5aec7535b00e96d37dba22b66bbc3866a4121.tar.bz2
speak-header
svn path=/trunk/libcss/; revision=5786
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/css21.c3
-rw-r--r--src/parse/css21props.c37
2 files changed, 35 insertions, 5 deletions
diff --git a/src/parse/css21.c b/src/parse/css21.c
index 943f55e..44866e8 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,
+ RELATIVE, ABSOLUTE, ONCE,
LAST_KNOWN
};
@@ -270,6 +270,7 @@ static struct {
{ "static", SLEN("static") },
{ "relative", SLEN("relative") },
{ "absolute", SLEN("absolute") },
+ { "once", SLEN("once") },
};
typedef struct context_entry {
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index c386a62..4b8e1c7 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -3268,10 +3268,39 @@ css_error parse_speak_header(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 (once, always, 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[ONCE]) {
+ value = SPEAK_HEADER_ONCE;
+ } else if (ident->lower.ptr == c->strings[ALWAYS]) {
+ value = SPEAK_HEADER_ALWAYS;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_SPEAK_HEADER, 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;
}