summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 22:56:34 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-25 22:56:34 +0000
commit2707bfd1f71a0785da1ffc32f14140eb29338c86 (patch)
tree7af56e10f61a5cf8acf518b796e2307db7d71435 /src
parent754cdc83af108f46062f08e25ab43d2a43bc66f2 (diff)
downloadlibcss-2707bfd1f71a0785da1ffc32f14140eb29338c86.tar.gz
libcss-2707bfd1f71a0785da1ffc32f14140eb29338c86.tar.bz2
text-indent
svn path=/trunk/libcss/; revision=5795
Diffstat (limited to 'src')
-rw-r--r--src/parse/css21props.c58
1 files changed, 54 insertions, 4 deletions
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index e58cad5..4217b1e 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -3656,6 +3656,8 @@ css_error parse_text_decoration(css_css21 *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
+ /** \todo text-decoration */
+
UNUSED(c);
UNUSED(vector);
UNUSED(ctx);
@@ -3668,10 +3670,58 @@ css_error parse_text_indent(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 *token;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+ fixed length = 0;
+ uint32_t unit = 0;
+ uint32_t required_size;
+
+ /* length | percentage | IDENT(inherit) */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token == NULL)
+ return CSS_INVALID;
+
+ if (token->type == CSS_TOKEN_IDENT &&
+ token->lower.ptr == c->strings[INHERIT]) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INHERIT;
+ } else {
+ error = parse_unit_specifier(c, vector, ctx, &length, &unit);
+ if (error != CSS_OK)
+ return error;
+
+ if (unit & UNIT_ANGLE || unit & UNIT_TIME || unit & UNIT_FREQ)
+ return CSS_INVALID;
+
+ value = TEXT_INDENT_SET;
+ }
+
+ error = parse_important(c, vector, ctx, &flags);
+ if (error != CSS_OK)
+ return error;
+
+ opv = buildOPV(OP_TEXT_INDENT, flags, value);
+
+ required_size = sizeof(opv);
+ if ((flags & FLAG_INHERIT) == false && value == TEXT_INDENT_SET)
+ required_size += sizeof(length) + sizeof(unit);
+
+ /* Allocate result */
+ error = css_stylesheet_style_create(c->sheet, required_size, result);
+ if (error != CSS_OK)
+ return error;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
+ if ((flags & FLAG_INHERIT) == false && value == TEXT_INDENT_SET) {
+ memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv),
+ &length, sizeof(length));
+ memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv) +
+ sizeof(length), &unit, sizeof(unit));
+ }
return CSS_OK;
}