summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 21:45:56 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 21:45:56 +0000
commitea62ade8dd519f3feec1c8dab1176c9486916f91 (patch)
treebe0767b54a91f538bcf2d1219f985aca7563893b
parentb327b6652ac1757816f079bddea6fb87ec1c60c9 (diff)
downloadlibcss-ea62ade8dd519f3feec1c8dab1176c9486916f91.tar.gz
libcss-ea62ade8dd519f3feec1c8dab1176c9486916f91.tar.bz2
position
svn path=/trunk/libcss/; revision=5784
-rw-r--r--src/parse/css21.c6
-rw-r--r--src/parse/css21props.c43
2 files changed, 44 insertions, 5 deletions
diff --git a/src/parse/css21.c b/src/parse/css21.c
index 2300475..943f55e 100644
--- a/src/parse/css21.c
+++ b/src/parse/css21.c
@@ -62,7 +62,8 @@ 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, VISIBLE, ALWAYS, AVOID, X_LOW, LOW, HIGH, X_HIGH,
+ INVERT, VISIBLE, ALWAYS, AVOID, X_LOW, LOW, HIGH, X_HIGH, STATIC,
+ RELATIVE, ABSOLUTE,
LAST_KNOWN
};
@@ -266,6 +267,9 @@ static struct {
{ "low", SLEN("low") },
{ "high", SLEN("high") },
{ "x-high", SLEN("x-high") },
+ { "static", SLEN("static") },
+ { "relative", SLEN("relative") },
+ { "absolute", SLEN("absolute") },
};
typedef struct context_entry {
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index c3510cc..9fbdfc5 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -3075,6 +3075,8 @@ css_error parse_play_during(css_css21 *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
+ /** \todo play-during */
+
UNUSED(c);
UNUSED(vector);
UNUSED(ctx);
@@ -3087,10 +3089,43 @@ css_error parse_position(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 (static, relative, absolute, fixed, 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[STATIC]) {
+ value = POSITION_STATIC;
+ } else if (ident->lower.ptr == c->strings[RELATIVE]) {
+ value = POSITION_RELATIVE;
+ } else if (ident->lower.ptr == c->strings[ABSOLUTE]) {
+ value = POSITION_ABSOLUTE;
+ } else if (ident->lower.ptr == c->strings[FIXED]) {
+ value = POSITION_FIXED;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_POSITION, 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;
}