summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parse/css21.c5
-rw-r--r--src/parse/css21props.c39
2 files changed, 39 insertions, 5 deletions
diff --git a/src/parse/css21.c b/src/parse/css21.c
index ecf589c..fe207b6 100644
--- a/src/parse/css21.c
+++ b/src/parse/css21.c
@@ -58,7 +58,7 @@ enum {
TABLE_FOOTER_GROUP, TABLE_ROW, TABLE_COLUMN_GROUP, TABLE_COLUMN,
TABLE_CELL, TABLE_CAPTION, BELOW, LEVEL, ABOVE, HIGHER, LOWER,
SHOW, HIDE, XX_SMALL, X_SMALL, SMALL, LARGE, X_LARGE, XX_LARGE,
- LARGER, SMALLER,
+ LARGER, SMALLER, NORMAL, ITALIC, OBLIQUE,
LAST_KNOWN
};
@@ -231,6 +231,9 @@ static struct {
{ "xx-large", SLEN("xx-large") },
{ "larger", SLEN("larger") },
{ "smaller", SLEN("smaller") },
+ { "normal", SLEN("normal") },
+ { "italic", SLEN("italic") },
+ { "oblique", SLEN("oblique") },
};
typedef struct context_entry {
diff --git a/src/parse/css21props.c b/src/parse/css21props.c
index cc4cdaa..ff41ceb 100644
--- a/src/parse/css21props.c
+++ b/src/parse/css21props.c
@@ -1579,10 +1579,41 @@ css_error parse_font_style(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 (normal, italic, oblique, 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[NORMAL]) {
+ value = FONT_STYLE_NORMAL;
+ } else if (ident->lower.ptr == c->strings[ITALIC]) {
+ value = FONT_STYLE_ITALIC;
+ } else if (ident->lower.ptr == c->strings[OBLIQUE]) {
+ value = FONT_STYLE_OBLIQUE;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_FONT_STYLE, 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;
}