From 4ff73dab98b1659dbfd6f53281f337381e82dda4 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 13 Aug 2022 16:22:27 +0100 Subject: Parse: Utils: Helper to get any value from flags --- src/parse/properties/utils.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h index e4c97c7..54a3fd1 100644 --- a/src/parse/properties/utils.h +++ b/src/parse/properties/utils.h @@ -19,6 +19,35 @@ static inline bool is_css_inherit(css_language *c, const css_token *token) &match) == lwc_error_ok && match)); } +static inline enum flag_value get_css_flag_value( + css_language *c, + const css_token *token) +{ + if (token->type == CSS_TOKEN_IDENT) { + bool match; + + if (lwc_string_caseless_isequal( + token->idata, c->strings[INHERIT], + &match) == lwc_error_ok && match) { + return FLAG_VALUE_INHERIT; + } else if (lwc_string_caseless_isequal( + token->idata, c->strings[INITIAL], + &match) == lwc_error_ok && match) { + return FLAG_VALUE_INITIAL; + } else if (lwc_string_caseless_isequal( + token->idata, c->strings[REVERT], + &match) == lwc_error_ok && match) { + return FLAG_VALUE_REVERT; + } else if (lwc_string_caseless_isequal( + token->idata, c->strings[UNSET], + &match) == lwc_error_ok && match) { + return FLAG_VALUE_UNSET; + } + } + + return FLAG_VALUE__NONE; +} + enum border_side_e { BORDER_SIDE_TOP = 0, BORDER_SIDE_RIGHT = 1, BORDER_SIDE_BOTTOM = 2, BORDER_SIDE_LEFT = 3 }; /** -- cgit v1.2.1