Gitweb links:
...log
http://git.netsurf-browser.org/libcss.git/shortlog/7abcc2ecb4fe57118c6f25...
...commit
http://git.netsurf-browser.org/libcss.git/commit/7abcc2ecb4fe57118c6f25be...
...tree
http://git.netsurf-browser.org/libcss.git/tree/7abcc2ecb4fe57118c6f25be57...
The branch, tlsa/shared-styles has been updated
via 7abcc2ecb4fe57118c6f25be57f8d0b8ee01a79c (commit)
via 27058a04d35ac484c20fb3d7681e8aa80e254cd2 (commit)
from 97b17997ca1edf823cf59b68d0b158e6a80f00f3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=7abcc2ecb4fe57118c6f...
commit 7abcc2ecb4fe57118c6f25be57f8d0b8ee01a79c
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Make node data contain list of partial node styles.
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 4d58c3d..9670242 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);
}
@@ -657,17 +666,28 @@ 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;
+
+ /* 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, state->node_data);
+ error = handler->set_libcss_node_data(pw, node, node_data);
if (error != CSS_OK) {
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;
};
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=27058a04d35ac484c20f...
commit 27058a04d35ac484c20fb3d7681e8aa80e254cd2
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Separate node data creation and node bloom creation.
diff --git a/src/select/select.c b/src/select/select.c
index ccdd013..4d58c3d 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -578,20 +578,14 @@ 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;
+ *node_bloom = NULL;
+
/* Create the node's bloom */
bloom = calloc(sizeof(css_bloom), CSS_BLOOM_SIZE);
if (bloom == NULL) {
@@ -642,14 +636,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;
@@ -659,6 +646,37 @@ cleanup:
return error;
}
+/**
+ * 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)
+{
+ 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
-----------------------------------------------------------------------
Summary of changes:
src/select/computed.h | 4 +++
src/select/select.c | 74 +++++++++++++++++++++++++++++++++++++------------
src/select/select.h | 1 +
3 files changed, 61 insertions(+), 18 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 ccdd013..9670242 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);
}
@@ -578,20 +587,14 @@ 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;
+ *node_bloom = NULL;
+
/* Create the node's bloom */
bloom = calloc(sizeof(css_bloom), CSS_BLOOM_SIZE);
if (bloom == NULL) {
@@ -642,14 +645,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;
@@ -659,6 +655,48 @@ cleanup:
return error;
}
+/**
+ * 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)
+{
+ 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;
+ }
+ node_data->bloom = bloom;
+
+ /* 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) {
+ return error;
+ }
+
+ state->node_data = NULL;
+
+ return CSS_OK;
+}
+
/**
* Select a style for the given node
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;
};
--
Cascading Style Sheets library