summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 21:20:43 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 21:20:43 +0000
commit05cd20c6a53a1169086dadf31d708f337fedf8de (patch)
treee833feb596d4e2efc40b85c9a62ccf6eb4f66240 /src
parent5a20dd39e05239a13f5a1ed0a70678ca7f1afbc3 (diff)
downloadlibcss-05cd20c6a53a1169086dadf31d708f337fedf8de.tar.gz
libcss-05cd20c6a53a1169086dadf31d708f337fedf8de.tar.bz2
page-break-before
svn path=/trunk/libcss/; revision=5777
Diffstat (limited to 'src')
-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 bb03198..bef6c40 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -2736,10 +2736,45 @@ css_error parse_page_break_before(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 (auto, always, avoid, left, right, 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[AUTO]) {
+ value = PAGE_BREAK_BEFORE_AUTO;
+ } else if (ident->lower.ptr == c->strings[ALWAYS]) {
+ value = PAGE_BREAK_BEFORE_ALWAYS;
+ } else if (ident->lower.ptr == c->strings[AVOID]) {
+ value = PAGE_BREAK_BEFORE_AVOID;
+ } else if (ident->lower.ptr == c->strings[LEFT]) {
+ value = PAGE_BREAK_BEFORE_LEFT;
+ } else if (ident->lower.ptr == c->strings[RIGHT]) {
+ value = PAGE_BREAK_BEFORE_RIGHT;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_PAGE_BREAK_BEFORE, 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;
}