summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-10-26 21:07:57 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-10-26 21:07:57 +0000
commite9b5f50f54d43697b9895671f1445d1e72879acd (patch)
treeaddcf1bf3d6ace7472bcc18ab7547a793e1bf7aa /src
parent61a53f6413dee94df35f07e4968693c69b863262 (diff)
downloadlibcss-e9b5f50f54d43697b9895671f1445d1e72879acd.tar.gz
libcss-e9b5f50f54d43697b9895671f1445d1e72879acd.tar.bz2
empty-cells
svn path=/trunk/libcss/; revision=5640
Diffstat (limited to 'src')
-rw-r--r--src/parse/css21.c3
-rw-r--r--src/parse/css21props.c37
2 files changed, 36 insertions, 4 deletions
diff --git a/src/parse/css21.c b/src/parse/css21.c
index 63da4e3..8d25b1e 100644
--- a/src/parse/css21.c
+++ b/src/parse/css21.c
@@ -57,6 +57,7 @@ enum {
INLINE_BLOCK, TABLE, INLINE_TABLE, TABLE_ROW_GROUP, TABLE_HEADER_GROUP,
TABLE_FOOTER_GROUP, TABLE_ROW, TABLE_COLUMN_GROUP, TABLE_COLUMN,
TABLE_CELL, TABLE_CAPTION, BELOW, LEVEL, ABOVE, HIGHER, LOWER,
+ SHOW, HIDE,
LAST_KNOWN
};
@@ -219,6 +220,8 @@ static struct {
{ "above", SLEN("above") },
{ "higher", SLEN("higher") },
{ "lower", SLEN("lower") },
+ { "show", SLEN("show") },
+ { "hide", SLEN("hide") },
};
typedef struct context_entry {
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index 1cfacc0..ab358d0 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -1384,10 +1384,39 @@ css_error parse_empty_cells(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 (show, hide, 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[SHOW]) {
+ value = EMPTY_CELLS_SHOW;
+ } else if (ident->lower.ptr == c->strings[HIDE]) {
+ value = EMPTY_CELLS_HIDE;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_EMPTY_CELLS, 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;
}