summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 21:28:39 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 21:28:39 +0000
commit8cd9a8e0085f886a98881d6c12a62035d5d55d2d (patch)
treeb01432061cdbfd3da6194704a6061321c2ce7ebe /src/parse
parentae9f808ae43f534ea9b4d617507ff28477df7e44 (diff)
downloadlibcss-8cd9a8e0085f886a98881d6c12a62035d5d55d2d.tar.gz
libcss-8cd9a8e0085f886a98881d6c12a62035d5d55d2d.tar.bz2
pause-after
svn path=/trunk/libcss/; revision=5779
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/css21props.c56
1 files changed, 52 insertions, 4 deletions
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index 78db66f..6a0bceb 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -2824,10 +2824,58 @@ css_error parse_pause_after(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 *token;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+ fixed length = 0;
+ uint32_t unit = 0;
+ uint32_t required_size;
+
+ /* time | percentage | IDENT(inherit) */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token == NULL)
+ return CSS_INVALID;
+
+ if (token->type == CSS_TOKEN_IDENT &&
+ token->lower.ptr == c->strings[INHERIT]) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INHERIT;
+ } else {
+ error = parse_unit_specifier(c, vector, ctx, &length, &unit);
+ if (error != CSS_OK)
+ return error;
+
+ if (unit & UNIT_ANGLE || unit & UNIT_PCT || unit & UNIT_FREQ)
+ return CSS_INVALID;
+
+ value = PAUSE_AFTER_SET;
+ }
+
+ error = parse_important(c, vector, ctx, &flags);
+ if (error != CSS_OK)
+ return error;
+
+ opv = buildOPV(OP_PAUSE_AFTER, flags, value);
+
+ required_size = sizeof(opv);
+ if ((flags & FLAG_INHERIT) == false && value == PAUSE_AFTER_SET)
+ required_size += sizeof(length) + sizeof(unit);
+
+ /* Allocate result */
+ error = css_stylesheet_style_create(c->sheet, required_size, result);
+ if (error != CSS_OK)
+ return error;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
+ if ((flags & FLAG_INHERIT) == false && value == PAUSE_AFTER_SET) {
+ memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv),
+ &length, sizeof(length));
+ memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv) +
+ sizeof(length), &unit, sizeof(unit));
+ }
return CSS_OK;
}