summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-11-22 17:28:52 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2016-11-19 14:30:07 +0000
commitcd5aa421206501a8651baa5cb4d19a96c4374cbe (patch)
tree7859d99fdaf8340f958625f579b7bf534baa0752
parentf3b877ef70858a39846f2c206482703cd395d7d6 (diff)
downloadlibcss-cd5aa421206501a8651baa5cb4d19a96c4374cbe.tar.gz
libcss-cd5aa421206501a8651baa5cb4d19a96c4374cbe.tar.bz2
Separate node data creation and node bloom creation.
-rw-r--r--src/select/select.c55
1 files changed, 37 insertions, 18 deletions
diff --git a/src/select/select.c b/src/select/select.c
index 30ea622..5fef4e4 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -581,21 +581,15 @@ static css_error css__get_parent_bloom(void *parent,
return CSS_OK;
}
-/**
- * Set a node's data
- *
- * \param parent Node to set node data for
- * \param handler Dispatch table of handler functions
- * \param pw Client-specific private data for handler functions
- * \return CSS_OK on success, appropriate error otherwise.
- */
-static css_error css__set_node_data(void *node, css_select_state *state,
- css_select_handler *handler, void *pw)
+static css_error css__create_node_bloom(
+ css_bloom **node_bloom, css_select_state *state)
{
css_error error;
css_bloom *bloom;
lwc_hash hash;
+ *node_bloom = NULL;
+
/* Create the node's bloom */
bloom = calloc(sizeof(css_bloom), CSS_BLOOM_SIZE);
if (bloom == NULL) {
@@ -635,14 +629,7 @@ static css_error css__set_node_data(void *node, css_select_state *state,
/* Merge parent bloom into node bloom */
css_bloom_merge(state->node_data->bloom, bloom);
- state->node_data->bloom = bloom;
-
- /* Set node bloom filter */
- error = handler->set_libcss_node_data(pw, node, state->node_data);
- if (error != CSS_OK)
- goto cleanup;
-
- state->node_data = NULL;
+ *node_bloom = bloom;
return CSS_OK;
@@ -652,6 +639,38 @@ cleanup:
return error;
}
+/**
+ * Set a node's data
+ *
+ * \param node Node to set node data for
+ * \param state Selection state for node
+ * \param handler Dispatch table of handler functions
+ * \param pw Client-specific private data for handler functions
+ * \return CSS_OK on success, appropriate error otherwise.
+ */
+static css_error css__set_node_data(void *node, css_select_state *state,
+ css_select_handler *handler, void *pw)
+{
+ css_error error;
+ css_bloom *bloom;
+
+ /* Set node bloom filter */
+ error = css__create_node_bloom(&bloom, state);
+ if (error != CSS_OK) {
+ return error;
+ }
+ state->node_data->bloom = bloom;
+
+ error = handler->set_libcss_node_data(pw, node, state->node_data);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ state->node_data = NULL;
+
+ return CSS_OK;
+}
+
/**
* Select a style for the given node