summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 21:22:35 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 21:22:35 +0000
commitae9f808ae43f534ea9b4d617507ff28477df7e44 (patch)
tree104947a72601e16c52bc7f8cc69442fe49e3f476 /src
parent05cd20c6a53a1169086dadf31d708f337fedf8de (diff)
downloadlibcss-ae9f808ae43f534ea9b4d617507ff28477df7e44.tar.gz
libcss-ae9f808ae43f534ea9b4d617507ff28477df7e44.tar.bz2
page-break-inside
svn path=/trunk/libcss/; revision=5778
Diffstat (limited to 'src')
-rw-r--r--src/bytecode/opcodes.h2
-rw-r--r--src/parse/css21props.c37
2 files changed, 34 insertions, 5 deletions
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index bd03970..7d30687 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -417,7 +417,7 @@ enum op_page_break_before {
enum op_page_break_inside {
PAGE_BREAK_INSIDE_AUTO = 0x0000,
- PAGE_BREAK_INSIDE_ALWAYS = 0x0001,
+ PAGE_BREAK_INSIDE_AVOID = 0x0001,
};
enum op_pause_after {
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index bef6c40..78db66f 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -2783,10 +2783,39 @@ css_error parse_page_break_inside(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, avoid, 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_INSIDE_AUTO;
+ } else if (ident->lower.ptr == c->strings[AVOID]) {
+ value = PAGE_BREAK_INSIDE_AVOID;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_PAGE_BREAK_INSIDE, 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;
}