diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-25 23:03:59 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-25 23:03:59 +0000 |
commit | 42e980579d40692c2386ef7737d0a8d3d3a816cb (patch) | |
tree | 14e68be09a1d3e34c5d697b9c5c6427c48e5ba48 /src/parse/css21props.c | |
parent | bb49aeffc5f1b8ca461a51d7755cb90b0bc5344d (diff) | |
download | libcss-42e980579d40692c2386ef7737d0a8d3d3a816cb.tar.gz libcss-42e980579d40692c2386ef7737d0a8d3d3a816cb.tar.bz2 |
unicode-bidi
svn path=/trunk/libcss/; revision=5797
Diffstat (limited to 'src/parse/css21props.c')
-rw-r--r-- | src/parse/css21props.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/parse/css21props.c b/src/parse/css21props.c index cfdc1c0..e0d14d2 100644 --- a/src/parse/css21props.c +++ b/src/parse/css21props.c @@ -3839,10 +3839,41 @@ css_error parse_unicode_bidi(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 (normal, embed, bidi-override, 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[NORMAL]) { + value = UNICODE_BIDI_NORMAL; + } else if (ident->lower.ptr == c->strings[EMBED]) { + value = UNICODE_BIDI_EMBED; + } else if (ident->lower.ptr == c->strings[BIDI_OVERRIDE]) { + value = UNICODE_BIDI_BIDI_OVERRIDE; + } else + return CSS_INVALID; + + opv = buildOPV(OP_UNICODE_BIDI, 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; } |