diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-26 23:26:16 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-26 23:26:16 +0000 |
commit | af56eb1b6d0e2a8d8b920ac0bd1bf01645d13764 (patch) | |
tree | 1cd0f041f96b3fd96cba879eab6a1e252d67a003 /src | |
parent | 18676a9b51367f64ddd3d9dc1ee313ea2250c8c1 (diff) | |
download | libcss-af56eb1b6d0e2a8d8b920ac0bd1bf01645d13764.tar.gz libcss-af56eb1b6d0e2a8d8b920ac0bd1bf01645d13764.tar.bz2 |
visibility
svn path=/trunk/libcss/; revision=5799
Diffstat (limited to 'src')
-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 6e28ab5..e3d729a 100644 --- a/src/parse/css21props.c +++ b/src/parse/css21props.c @@ -3976,10 +3976,41 @@ css_error parse_visibility(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 (visible, hidden, collapse, 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[VISIBLE]) { + value = VISIBILITY_VISIBLE; + } else if (ident->lower.ptr == c->strings[HIDDEN]) { + value = VISIBILITY_HIDDEN; + } else if (ident->lower.ptr == c->strings[COLLAPSE]) { + value = VISIBILITY_COLLAPSE; + } else + return CSS_INVALID; + + opv = buildOPV(OP_VISIBILITY, 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; } |