summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-10-26 15:15:34 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-10-26 15:15:34 +0000
commita8f62498c30b910a7badf6eed07aae9b58d77a57 (patch)
tree6f067ea11ba4661373d9dc4eca9239c201df2857 /src
parent40157e06e218b7c29f3191ac10c6eb9ea92f666e (diff)
downloadlibcss-a8f62498c30b910a7badf6eed07aae9b58d77a57.tar.gz
libcss-a8f62498c30b910a7badf6eed07aae9b58d77a57.tar.bz2
caption-side
svn path=/trunk/libcss/; revision=5635
Diffstat (limited to 'src')
-rw-r--r--src/parse/css21props.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index c263dc1..8ad6dad 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -874,10 +874,39 @@ css_error parse_caption_side(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 (top, bottom, 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[TOP]) {
+ value = CAPTION_SIDE_TOP;
+ } else if (ident->lower.ptr == c->strings[BOTTOM]) {
+ value = CAPTION_SIDE_BOTTOM;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_CAPTION_SIDE, flags, value);
+
+ /* Allocate result */
+ *result = css_stylesheet_style_create(c->sheet, sizeof(opv));
+ if (*result == NULL)
+ return CSS_NOMEM;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
return CSS_OK;
}