diff options
author | Michael Drake <Michael Drake tlsa@netsurf-browser.org> | 2019-05-12 16:17:12 +0100 |
---|---|---|
committer | Michael Drake <Michael Drake tlsa@netsurf-browser.org> | 2019-05-12 16:23:27 +0100 |
commit | 4989d72549b53f751d2999a771e0bc6737015810 (patch) | |
tree | 744c15bc5403563cc11be3ad1af94a2447b523f2 /src/select/properties/content.c | |
parent | d09f33131b8079f3886e0827cf458e1fc2c7f2d6 (diff) | |
download | libcss-4989d72549b53f751d2999a771e0bc6737015810.tar.gz libcss-4989d72549b53f751d2999a771e0bc6737015810.tar.bz2 |
Computed styles: Drop uncommon extension blocks.
They were a space saving feature, but they became largely
redundant with computed style sharing. They also made the
code complex and buggy in many places. E.g. the cascade,
inheritance / composition, and intial values all needed to
behave corretly when they, or their parent, had or didn't
have an uncommon block.
Also, only the uncommon block was really used.
Fixes:
https://bugs.netsurf-browser.org/mantis/view.php?id=2641
Diffstat (limited to 'src/select/properties/content.c')
-rw-r--r-- | src/select/properties/content.c | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/src/select/properties/content.c b/src/select/properties/content.c index 0506ef3..f75743d 100644 --- a/src/select/properties/content.c +++ b/src/select/properties/content.c @@ -204,43 +204,34 @@ css_error css__compose_content(const css_computed_style *parent, css_computed_style *result) { css_error error; + css_computed_content_item *copy = NULL; const css_computed_content_item *items = NULL; uint8_t type = get_content(child, &items); - if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) || - type == CSS_CONTENT_INHERIT || - (child->i.uncommon != NULL && result != child)) { - size_t n_items = 0; - css_computed_content_item *copy = NULL; - - if ((child->i.uncommon == NULL && parent->i.uncommon != NULL) || - type == CSS_CONTENT_INHERIT) { - type = get_content(parent, &items); - } - - if (type == CSS_CONTENT_SET) { - const css_computed_content_item *i; - - for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE; - i++) - n_items++; + if (type == CSS_CONTENT_INHERIT) { + type = get_content(parent, &items); + } - copy = malloc((n_items + 1) * - sizeof(css_computed_content_item)); - if (copy == NULL) - return CSS_NOMEM; + if (type == CSS_CONTENT_SET) { + size_t n_items = 0; + const css_computed_content_item *i; - memcpy(copy, items, (n_items + 1) * - sizeof(css_computed_content_item)); - } + for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE; + i++) + n_items++; - error = set_content(result, type, copy); - if (error != CSS_OK && copy != NULL) - free(copy); + copy = malloc((n_items + 1) * + sizeof(css_computed_content_item)); + if (copy == NULL) + return CSS_NOMEM; - return error; + memcpy(copy, items, (n_items + 1) * + sizeof(css_computed_content_item)); } - return CSS_OK; -} + error = set_content(result, type, copy); + if (error != CSS_OK && copy != NULL) + free(copy); + return error; +} |