From 42e980579d40692c2386ef7737d0a8d3d3a816cb Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 25 Nov 2008 23:03:59 +0000 Subject: unicode-bidi svn path=/trunk/libcss/; revision=5797 --- src/parse/css21props.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'src/parse/css21props.c') 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; } -- cgit v1.2.3