diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-03-05 01:29:18 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-03-05 01:29:18 +0000 |
commit | 4e76c3f860c327ce980704619857e438fb734030 (patch) | |
tree | bc81c4082b41195ff0f75b95eaeb3193f93b3d71 /src | |
parent | d43e656f71ba0c50542ae30d212d8b478203698f (diff) | |
download | libcss-4e76c3f860c327ce980704619857e438fb734030.tar.gz libcss-4e76c3f860c327ce980704619857e438fb734030.tar.bz2 |
Compose position and quotes
svn path=/trunk/libcss/; revision=6705
Diffstat (limited to 'src')
-rw-r--r-- | src/select/properties.c | 51 |
1 files changed, 51 insertions, 0 deletions
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) { |