diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-08-16 20:27:24 +0100 |
---|---|---|
committer | Michael Drake <mdrake.unique@gmail.com> | 2022-08-29 13:49:20 +0100 |
commit | 010b9a79ece709d364dbf3930b72d2a7e0bac045 (patch) | |
tree | a037acfb28e57b5c81e8515798772cf6ba5a976a | |
parent | 51f108c9fa28758a0adbd91571e19f795c21ea2e (diff) | |
download | libcss-010b9a79ece709d364dbf3930b72d2a7e0bac045.tar.gz libcss-010b9a79ece709d364dbf3930b72d2a7e0bac045.tar.bz2 |
Select: Support CSS property-wide 'unset' value
-rw-r--r-- | src/select/select.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/select/select.c b/src/select/select.c index 955dcce..7b5b71a 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -1286,8 +1286,15 @@ css_error css_select_style(css_select_ctx *ctx, void *node, state.current_pseudo = CSS_PSEUDO_ELEMENT_NONE; state.computed = state.results->styles[CSS_PSEUDO_ELEMENT_NONE]; for (i = 0; i < CSS_N_PROPERTIES; i++) { - const prop_state *prop = - &state.props[i][CSS_PSEUDO_ELEMENT_NONE]; + prop_state *prop = &state.props[i][CSS_PSEUDO_ELEMENT_NONE]; + + if (prop->explicit_default == FLAG_VALUE_UNSET) { + if (prop_dispatch[i].inherited == true) { + prop->explicit_default = FLAG_VALUE_INHERIT; + } else { + prop->explicit_default = FLAG_VALUE_INITIAL; + } + } /* If the property is still unset or it's set to inherit * and we're the root element, then set it to its initial @@ -1313,7 +1320,15 @@ css_error css_select_style(css_select_ctx *ctx, void *node, continue; for (i = 0; i < CSS_N_PROPERTIES; i++) { - const prop_state *prop = &state.props[i][j]; + prop_state *prop = &state.props[i][j]; + + if (prop->explicit_default == FLAG_VALUE_UNSET) { + if (prop_dispatch[i].inherited == true) { + prop->explicit_default = FLAG_VALUE_INHERIT; + } else { + prop->explicit_default = FLAG_VALUE_INITIAL; + } + } /* If the property is still unset then set it * to its initial value. */ |