summaryrefslogtreecommitdiff
path: root/src/parse/css21props.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-26 23:41:15 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-26 23:41:15 +0000
commit94c40fb372814286df08a857f7f28680f84e6d3f (patch)
tree01eae6f9bd9467df44449ef3cf6e7fabedafbb3e /src/parse/css21props.c
parentaf29c3f287a3b758e06d5244cdb70f403dac0030 (diff)
downloadlibcss-94c40fb372814286df08a857f7f28680f84e6d3f.tar.gz
libcss-94c40fb372814286df08a857f7f28680f84e6d3f.tar.bz2
white-space
svn path=/trunk/libcss/; revision=5801
Diffstat (limited to 'src/parse/css21props.c')
-rw-r--r--src/parse/css21props.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index 59c34e3..569cce9 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -4129,10 +4129,45 @@ css_error parse_white_space(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, pre, nowrap, pre-wrap, pre-line, 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 = WHITE_SPACE_NORMAL;
+ } else if (ident->lower.ptr == c->strings[PRE]) {
+ value = WHITE_SPACE_PRE;
+ } else if (ident->lower.ptr == c->strings[NOWRAP]) {
+ value = WHITE_SPACE_NOWRAP;
+ } else if (ident->lower.ptr == c->strings[PRE_WRAP]) {
+ value = WHITE_SPACE_PRE_WRAP;
+ } else if (ident->lower.ptr == c->strings[PRE_LINE]) {
+ value = WHITE_SPACE_PRE_LINE;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_WHITE_SPACE, 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;
}