diff options
Diffstat (limited to 'src/parse/properties/boxsizing.c')
-rw-r--r-- | src/parse/properties/boxsizing.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/parse/properties/boxsizing.c b/src/parse/properties/boxsizing.c index c5077fa..057b3a1 100644 --- a/src/parse/properties/boxsizing.c +++ b/src/parse/properties/boxsizing.c @@ -12,6 +12,78 @@ #include "parse/properties/properties.h" #include "parse/properties/utils.h" +css_error parse_display(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style **result) +{ + css_error error; + const css_token *ident; + uint8_t flags = 0; + uint16_t value = 0; + uint32_t opv; + + /* IDENT (inline, block, list-item, run-in, 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, none, 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->ilower == c->strings[INHERIT]) { + flags |= FLAG_INHERIT; + } else if (ident->ilower == c->strings[INLINE]) { + value = DISPLAY_INLINE; + } else if (ident->ilower == c->strings[BLOCK]) { + value = DISPLAY_BLOCK; + } else if (ident->ilower == c->strings[LIST_ITEM]) { + value = DISPLAY_LIST_ITEM; + } else if (ident->ilower == c->strings[RUN_IN]) { + value = DISPLAY_RUN_IN; + } else if (ident->ilower == c->strings[INLINE_BLOCK]) { + value = DISPLAY_INLINE_BLOCK; + } else if (ident->ilower == c->strings[TABLE]) { + value = DISPLAY_TABLE; + } else if (ident->ilower == c->strings[INLINE_TABLE]) { + value = DISPLAY_INLINE_TABLE; + } else if (ident->ilower == c->strings[TABLE_ROW_GROUP]) { + value = DISPLAY_TABLE_ROW_GROUP; + } else if (ident->ilower == c->strings[TABLE_HEADER_GROUP]) { + value = DISPLAY_TABLE_HEADER_GROUP; + } else if (ident->ilower == c->strings[TABLE_FOOTER_GROUP]) { + value = DISPLAY_TABLE_FOOTER_GROUP; + } else if (ident->ilower == c->strings[TABLE_ROW]) { + value = DISPLAY_TABLE_ROW; + } else if (ident->ilower == c->strings[TABLE_COLUMN_GROUP]) { + value = DISPLAY_TABLE_COLUMN_GROUP; + } else if (ident->ilower == c->strings[TABLE_COLUMN]) { + value = DISPLAY_TABLE_COLUMN; + } else if (ident->ilower == c->strings[TABLE_CELL]) { + value = DISPLAY_TABLE_CELL; + } else if (ident->ilower == c->strings[TABLE_CAPTION]) { + value = DISPLAY_TABLE_CAPTION; + } else if (ident->ilower == c->strings[NONE]) { + value = DISPLAY_NONE; + } else + return CSS_INVALID; + + opv = buildOPV(CSS_PROP_DISPLAY, 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; +} + css_error parse_height(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) |