summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-08-13 16:22:27 +0100
committerMichael Drake <mdrake.unique@gmail.com>2022-08-29 13:49:20 +0100
commit4ff73dab98b1659dbfd6f53281f337381e82dda4 (patch)
treef4a0b017f7a457d0b5c6e989a6e11ab194804665 /src
parent1815b305ea226fa8a9cf8582df259e0bde76bbdf (diff)
downloadlibcss-4ff73dab98b1659dbfd6f53281f337381e82dda4.tar.gz
libcss-4ff73dab98b1659dbfd6f53281f337381e82dda4.tar.bz2
Parse: Utils: Helper to get any value from flags
Diffstat (limited to 'src')
-rw-r--r--src/parse/properties/utils.h29
1 files changed, 29 insertions, 0 deletions
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 };
/**