summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-03-04 01:16:20 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-03-04 01:16:20 +0000
commitccb0737a07d5f97e917d37252123b1293ab242fe (patch)
tree9f22aeb184df17afa860353528c4d50e9d17b78a /src
parente27b67d3098cbd96f18a02ad12a595878df4c3d9 (diff)
downloadlibcss-ccb0737a07d5f97e917d37252123b1293ab242fe.tar.gz
libcss-ccb0737a07d5f97e917d37252123b1293ab242fe.tar.bz2
compute_content()
svn path=/trunk/libcss/; revision=6691
Diffstat (limited to 'src')
-rw-r--r--src/select/properties.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/select/properties.c b/src/select/properties.c
index f5a6260..572a151 100644
--- a/src/select/properties.c
+++ b/src/select/properties.c
@@ -1157,6 +1157,47 @@ css_error initial_content(css_computed_style *style)
return set_content(style, CSS_CONTENT_NORMAL, NULL);
}
+css_error compose_content(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ css_error error;
+ const css_computed_content_item *items = NULL;
+
+ if ((child->uncommon == NULL && parent->uncommon != NULL) ||
+ css_computed_content(child, &items) ==
+ CSS_CONTENT_INHERIT) {
+ uint8_t p = css_computed_content(parent, &items);
+ size_t n_items = 0;
+ css_computed_content_item *copy = NULL;
+
+ if (p == CSS_CONTENT_SET) {
+ const css_computed_content_item *i;
+
+ for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE;
+ i++)
+ n_items++;
+
+ copy = result->alloc(NULL, (n_items + 1) *
+ sizeof(css_computed_content_item),
+ result->pw);
+ if (i == NULL)
+ return CSS_NOMEM;
+
+ memcpy(copy, items, (n_items + 1) *
+ sizeof(css_computed_content_item));
+ }
+
+ error = set_content(result, p, copy);
+ if (error != CSS_OK && copy != NULL)
+ result->alloc(copy, 0, result->pw);
+
+ return error;
+ }
+
+ return CSS_OK;
+}
+
css_error cascade_counter_increment(uint32_t opv, css_style *style,
css_select_state *state)
{