summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 19:07:09 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 19:07:09 +0000
commitb82302ca99d1ee87c4251bc53536f02c826996c4 (patch)
tree2541af294d6fa9a5aa7b0c3e0220f8ed329cbc5b /src
parent56378abe781bb755c0e4d69d16035ea861b7c1e1 (diff)
downloadlibcss-b82302ca99d1ee87c4251bc53536f02c826996c4.tar.gz
libcss-b82302ca99d1ee87c4251bc53536f02c826996c4.tar.bz2
overflow
svn path=/trunk/libcss/; revision=5773
Diffstat (limited to 'src')
-rw-r--r--src/parse/css21.c3
-rw-r--r--src/parse/css21props.c41
2 files changed, 39 insertions, 5 deletions
diff --git a/src/parse/css21.c b/src/parse/css21.c
index c3dbae1..ccf0a10 100644
--- a/src/parse/css21.c
+++ b/src/parse/css21.c
@@ -62,7 +62,7 @@ enum {
LIGHTER, INSIDE, OUTSIDE, DISC, CIRCLE, SQUARE, DECIMAL,
DECIMAL_LEADING_ZERO, LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK,
LOWER_LATIN, UPPER_LATIN, ARMENIAN, GEORGIAN, LOWER_ALPHA, UPPER_ALPHA,
- INVERT,
+ INVERT, VISIBLE,
LAST_KNOWN
};
@@ -259,6 +259,7 @@ static struct {
{ "lower-alpha", SLEN("lower-alpha") },
{ "upper-alpha", SLEN("upper-alpha") },
{ "invert", SLEN("invert") },
+ { "visible", SLEN("visible") },
};
typedef struct context_entry {
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index 53a628a..554e2b1 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -2611,10 +2611,43 @@ css_error parse_overflow(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 (visible, hidden, scroll, auto, 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[VISIBLE]) {
+ value = OVERFLOW_VISIBLE;
+ } else if (ident->lower.ptr == c->strings[HIDDEN]) {
+ value = OVERFLOW_HIDDEN;
+ } else if (ident->lower.ptr == c->strings[SCROLL]) {
+ value = OVERFLOW_SCROLL;
+ } else if (ident->lower.ptr == c->strings[AUTO]) {
+ value = OVERFLOW_AUTO;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_OVERFLOW, 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;
}