From 4e76c3f860c327ce980704619857e438fb734030 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 5 Mar 2009 01:29:18 +0000 Subject: Compose position and quotes svn path=/trunk/libcss/; revision=6705 --- src/select/properties.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'src/select/properties.c') diff --git a/src/select/properties.c b/src/select/properties.c index 60aa77d..b3d5208 100644 --- a/src/select/properties.c +++ b/src/select/properties.c @@ -3264,6 +3264,17 @@ css_error initial_position(css_computed_style *style) return set_position(style, CSS_POSITION_STATIC); } +css_error compose_position(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + if (css_computed_position(child) == CSS_POSITION_INHERIT) { + return set_position(result, css_computed_position(parent)); + } + + return CSS_OK; +} + css_error cascade_quotes(uint32_t opv, css_style *style, css_select_state *state) { @@ -3337,6 +3348,46 @@ css_error initial_quotes(css_computed_style *style) return set_quotes(style, CSS_QUOTES_DEFAULT, NULL); } +css_error compose_quotes(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + css_error error; + lwc_string **quotes = NULL; + + if ((child->uncommon == NULL && parent->uncommon != NULL) || + css_computed_quotes(child, "es) == + CSS_QUOTES_INHERIT) { + uint8_t p = css_computed_quotes(parent, "es); + size_t n_quotes = 0; + lwc_string **copy = NULL; + + if (quotes != NULL) { + lwc_string **i; + + for (i = quotes; (*i) != NULL; i++) + n_quotes++; + + copy = result->alloc(NULL, (n_quotes + 1) * + sizeof(lwc_string *), + result->pw); + if (copy == NULL) + return CSS_NOMEM; + + memcpy(copy, quotes, (n_quotes + 1) * + sizeof(lwc_string *)); + } + + error = set_quotes(result, p, copy); + if (error != CSS_OK && copy != NULL) + result->alloc(copy, 0, result->pw); + + return error; + } + + return CSS_OK; +} + css_error cascade_richness(uint32_t opv, css_style *style, css_select_state *state) { -- cgit v1.2.3