From 010b9a79ece709d364dbf3930b72d2a7e0bac045 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 16 Aug 2022 20:27:24 +0100 Subject: Select: Support CSS property-wide 'unset' value --- src/select/select.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/select/select.c') 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. */ -- cgit v1.2.3