summaryrefslogtreecommitdiff
path: root/src/select/select.c
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2016-11-29 12:12:38 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2016-11-29 12:12:38 +0000
commitcb99ab8db4246f28e4bbf25f4e1ef7716473602a (patch)
tree133e915b813d8953d870b27fd32b89f3074ad117 /src/select/select.c
parent8e7e0412adc25060e70aa84ebbd43b37c9cc710b (diff)
downloadlibcss-cb99ab8db4246f28e4bbf25f4e1ef7716473602a.tar.gz
libcss-cb99ab8db4246f28e4bbf25f4e1ef7716473602a.tar.bz2
Selection: Inline styles prevent computed style sharing.
Diffstat (limited to 'src/select/select.c')
-rw-r--r--src/select/select.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/select/select.c b/src/select/select.c
index 8488b74..a44ef4a 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -775,13 +775,14 @@ static css_error css_select_style__get_sharable_node_data_for_candidate(
}
/* If the node was affected by attribute or pseudo class rules,
- * it's not a candidate for sharing */
+ * or had an inline style, it's not a candidate for sharing */
if (node_data->flags & (
CSS_NODE_FLAGS_TAINT_PSEUDO_CLASS |
CSS_NODE_FLAGS_TAINT_ATTRIBUTE |
- CSS_NODE_FLAGS_TAINT_SIBLING)) {
+ CSS_NODE_FLAGS_TAINT_SIBLING |
+ CSS_NODE_FLAGS_HAS_INLINE_STYLE)) {
#ifdef DEBUG_STYLE_SHARING
- printf(" \t%s\tno share: candidate flags: %s%s%s\n",
+ printf(" \t%s\tno share: candidate flags: %s%s%s%s\n",
lwc_string_data(state->element.name),
(node_data->flags &
CSS_NODE_FLAGS_TAINT_PSEUDO_CLASS) ?
@@ -791,7 +792,10 @@ static css_error css_select_style__get_sharable_node_data_for_candidate(
" ATTRIBUTE" : "",
(node_data->flags &
CSS_NODE_FLAGS_TAINT_SIBLING) ?
- " SIBLING" : "");
+ " SIBLING" : "",
+ (node_data->flags &
+ CSS_NODE_FLAGS_HAS_INLINE_STYLE) ?
+ " INLINE_STYLE" : "");
#endif
return CSS_OK;
}
@@ -930,6 +934,12 @@ printf(" \t%s\tno share: node id (%s)\n", lwc_string_data(state->element.na
#endif
return CSS_OK;
}
+ if (state->node_data->flags & CSS_NODE_FLAGS_HAS_INLINE_STYLE) {
+#ifdef DEBUG_STYLE_SHARING
+printf(" \t%s\tno share: inline style\n");
+#endif
+ return CSS_OK;
+ }
while (true) {
void *share_candidate_node;
@@ -1180,6 +1190,10 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
state.node_data->flags |= CSS_NODE_FLAGS_HAS_HINTS;
}
+ if (inline_style != NULL) {
+ state.node_data->flags |= CSS_NODE_FLAGS_HAS_INLINE_STYLE;
+ }
+
/* Check if we can share another node's style */
error = css_select_style__get_sharable_node_data(node, &state, &share);
if (error != CSS_OK) {