diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-05-27 00:35:16 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-05-27 00:35:16 +0000 |
commit | fc4b21067cd35d2e748b78c4c03acede29443220 (patch) | |
tree | b2e0541cf4a22e47249cbd38688e70884c817b9f /src/parse | |
parent | 94074cb3afd111b15d46e108593b0b4db40e141a (diff) | |
download | libcss-fc4b21067cd35d2e748b78c4c03acede29443220.tar.gz libcss-fc4b21067cd35d2e748b78c4c03acede29443220.tar.bz2 |
Move color parser to text.c
svn path=/trunk/libcss/; revision=7571
Diffstat (limited to 'src/parse')
-rw-r--r-- | src/parse/properties/properties.c | 54 | ||||
-rw-r--r-- | src/parse/properties/text.c | 54 |
2 files changed, 54 insertions, 54 deletions
diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c index 3c7f3a4..eca2cf8 100644 --- a/src/parse/properties/properties.c +++ b/src/parse/properties/properties.c @@ -119,60 +119,6 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] = parse_z_index, }; -css_error parse_color(css_language *c, - const parserutils_vector *vector, int *ctx, - css_style **result) -{ - css_error error; - const css_token *token; - uint8_t flags = 0; - uint16_t value = 0; - uint32_t opv; - uint32_t colour = 0; - uint32_t required_size; - - /* colour | IDENT (inherit) */ - token= parserutils_vector_peek(vector, *ctx); - if (token == NULL) - return CSS_INVALID; - - if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[INHERIT]) { - parserutils_vector_iterate(vector, ctx); - flags |= FLAG_INHERIT; - } else { - error = parse_colour_specifier(c, vector, ctx, &colour); - if (error != CSS_OK) - return error; - - value = COLOR_SET; - } - - error = parse_important(c, vector, ctx, &flags); - if (error != CSS_OK) - return error; - - opv = buildOPV(CSS_PROP_COLOR, flags, value); - - required_size = sizeof(opv); - if ((flags & FLAG_INHERIT) == false && value == COLOR_SET) - required_size += sizeof(colour); - - /* 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 == COLOR_SET) { - memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv), - &colour, sizeof(colour)); - } - - return CSS_OK; -} - css_error parse_cursor(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) diff --git a/src/parse/properties/text.c b/src/parse/properties/text.c index 8b71c73..3e9dc72 100644 --- a/src/parse/properties/text.c +++ b/src/parse/properties/text.c @@ -12,6 +12,60 @@ #include "parse/properties/properties.h" #include "parse/properties/utils.h" +css_error parse_color(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style **result) +{ + css_error error; + const css_token *token; + uint8_t flags = 0; + uint16_t value = 0; + uint32_t opv; + uint32_t colour = 0; + uint32_t required_size; + + /* colour | IDENT (inherit) */ + token= parserutils_vector_peek(vector, *ctx); + if (token == NULL) + return CSS_INVALID; + + if (token->type == CSS_TOKEN_IDENT && + token->ilower == c->strings[INHERIT]) { + parserutils_vector_iterate(vector, ctx); + flags |= FLAG_INHERIT; + } else { + error = parse_colour_specifier(c, vector, ctx, &colour); + if (error != CSS_OK) + return error; + + value = COLOR_SET; + } + + error = parse_important(c, vector, ctx, &flags); + if (error != CSS_OK) + return error; + + opv = buildOPV(CSS_PROP_COLOR, flags, value); + + required_size = sizeof(opv); + if ((flags & FLAG_INHERIT) == false && value == COLOR_SET) + required_size += sizeof(colour); + + /* 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 == COLOR_SET) { + memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv), + &colour, sizeof(colour)); + } + + return CSS_OK; +} + css_error parse_direction(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) |