summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-11-22 20:18:08 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2016-11-19 14:30:07 (GMT)
commitda2c006495db400134c3e788e398cbcba1dba1d0 (patch)
tree2623cb58dc94bac1e0f37070a383bdb113eaa3c5
parentd91bf786c42bd86a9d9159a6cd8e14e04ee29f39 (diff)
downloadlibcss-da2c006495db400134c3e788e398cbcba1dba1d0.tar.gz
libcss-da2c006495db400134c3e788e398cbcba1dba1d0.tar.bz2
Make node data contain list of partial node styles.
-rw-r--r--src/select/computed.h4
-rw-r--r--src/select/select.c26
-rw-r--r--src/select/select.h1
3 files changed, 29 insertions, 2 deletions
diff --git a/src/select/computed.h b/src/select/computed.h
index 57981b2..f77bda2 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -338,6 +338,10 @@ static inline css_computed_style * css__computed_style_ref(
if (style == NULL)
return NULL;
+ if (style->i.uncommon != NULL) {
+ style->i.uncommon->count++;
+ }
+
style->count++;
return style;
}
diff --git a/src/select/select.c b/src/select/select.c
index 5fef4e4..ec01d32 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -170,12 +170,21 @@ static css_error css__create_node_data(struct css_node_data **node_data)
static void css__destroy_node_data(struct css_node_data *node_data)
{
+ int i;
+
assert(node_data != NULL);
if (node_data->bloom != NULL) {
free(node_data->bloom);
}
+ for (i = 0; i < CSS_PSEUDO_ELEMENT_COUNT; i++) {
+ if (node_data->partial.styles[i] != NULL) {
+ css_computed_style_destroy(
+ node_data->partial.styles[i]);
+ }
+ }
+
free(node_data);
}
@@ -651,18 +660,31 @@ cleanup:
static css_error css__set_node_data(void *node, css_select_state *state,
css_select_handler *handler, void *pw)
{
+ int i;
css_error error;
css_bloom *bloom;
+ css_select_results *results;
+
+ struct css_node_data *node_data = state->node_data;
/* Set node bloom filter */
error = css__create_node_bloom(&bloom, state);
if (error != CSS_OK) {
return error;
}
- state->node_data->bloom = bloom;
+ node_data->bloom = bloom;
- error = handler->set_libcss_node_data(pw, node, state->node_data);
+ /* Set selection results */
+ results = state->results;
+ for (i = 0; i < CSS_PSEUDO_ELEMENT_COUNT; i++) {
+ node_data->partial.styles[i] =
+ css__computed_style_ref(results->styles[i]);
+ }
+
+ error = handler->set_libcss_node_data(pw, node, node_data);
if (error != CSS_OK) {
+ css__destroy_node_data(node_data);
+ state->node_data = NULL;
return error;
}
diff --git a/src/select/select.h b/src/select/select.h
index 196914d..254b095 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -32,6 +32,7 @@ typedef struct prop_state {
} prop_state;
struct css_node_data {
+ css_select_results partial;
css_bloom *bloom;
};