From 090da931105b942a42a610f0cb92c9f2cd3e7cfc Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 27 May 2009 00:26:19 +0000 Subject: Move float and alignment property parsers into positioning.c svn path=/trunk/libcss/; revision=7568 --- src/parse/properties/properties.c | 183 -------------------------------------- 1 file changed, 183 deletions(-) (limited to 'src/parse/properties/properties.c') diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c index f9d6adc..b55c785 100644 --- a/src/parse/properties/properties.c +++ b/src/parse/properties/properties.c @@ -160,51 +160,6 @@ css_error parse_caption_side(css_language *c, return CSS_OK; } -css_error parse_clear(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 (left, right, both, 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[RIGHT]) { - value = CLEAR_RIGHT; - } else if (ident->ilower == c->strings[LEFT]) { - value = CLEAR_LEFT; - } else if (ident->ilower == c->strings[BOTH]) { - value = CLEAR_BOTH; - } else if (ident->ilower == c->strings[NONE]) { - value = CLEAR_NONE; - } else - return CSS_INVALID; - - opv = buildOPV(CSS_PROP_CLEAR, 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_clip(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) @@ -762,49 +717,6 @@ css_error parse_empty_cells(css_language *c, return CSS_OK; } -css_error parse_float(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 (left, right, 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[LEFT]) { - value = FLOAT_LEFT; - } else if (ident->ilower == c->strings[RIGHT]) { - value = FLOAT_RIGHT; - } else if (ident->ilower == c->strings[NONE]) { - value = FLOAT_NONE; - } else - return CSS_INVALID; - - opv = buildOPV(CSS_PROP_FLOAT, 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_overflow(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) @@ -891,101 +803,6 @@ css_error parse_table_layout(css_language *c, return CSS_OK; } -css_error parse_vertical_align(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; - css_fixed length = 0; - uint32_t unit = 0; - uint32_t required_size; - - /* length | percentage | IDENT(baseline, sub, super, top, text-top, - * middle, bottom, text-bottom, 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 if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[BASELINE]) { - parserutils_vector_iterate(vector, ctx); - value = VERTICAL_ALIGN_BASELINE; - } else if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[SUB]) { - parserutils_vector_iterate(vector, ctx); - value = VERTICAL_ALIGN_SUB; - } else if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[SUPER]) { - parserutils_vector_iterate(vector, ctx); - value = VERTICAL_ALIGN_SUPER; - } else if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[TOP]) { - parserutils_vector_iterate(vector, ctx); - value = VERTICAL_ALIGN_TOP; - } else if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[TEXT_TOP]) { - parserutils_vector_iterate(vector, ctx); - value = VERTICAL_ALIGN_TEXT_TOP; - } else if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[MIDDLE]) { - parserutils_vector_iterate(vector, ctx); - value = VERTICAL_ALIGN_MIDDLE; - } else if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[BOTTOM]) { - parserutils_vector_iterate(vector, ctx); - value = VERTICAL_ALIGN_BOTTOM; - } else if (token->type == CSS_TOKEN_IDENT && - token->ilower == c->strings[TEXT_BOTTOM]) { - parserutils_vector_iterate(vector, ctx); - value = VERTICAL_ALIGN_TEXT_BOTTOM; - } else { - error = parse_unit_specifier(c, vector, ctx, UNIT_PX, - &length, &unit); - if (error != CSS_OK) - return error; - - if (unit & UNIT_ANGLE || unit & UNIT_TIME || unit & UNIT_FREQ) - return CSS_INVALID; - - value = VERTICAL_ALIGN_SET; - } - - error = parse_important(c, vector, ctx, &flags); - if (error != CSS_OK) - return error; - - opv = buildOPV(CSS_PROP_VERTICAL_ALIGN, flags, value); - - required_size = sizeof(opv); - if ((flags & FLAG_INHERIT) == false && value == VERTICAL_ALIGN_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 == VERTICAL_ALIGN_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; -} - css_error parse_visibility(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) -- cgit v1.2.3