summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-08-13 16:23:56 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2022-08-28 15:35:15 +0100
commitdbcb2165bee48cacb35faa58c9aad7ac67a0ad55 (patch)
tree8c6573ae9fe6ebd8af7ff8eead85c387557a5c3b
parent434695b971ba95326e26da843e797f4126090d4e (diff)
downloadlibcss-dbcb2165bee48cacb35faa58c9aad7ac67a0ad55.tar.gz
libcss-dbcb2165bee48cacb35faa58c9aad7ac67a0ad55.tar.bz2
Parse: Nongenerated properties: Explicit defaults
-rw-r--r--src/parse/properties/azimuth.c21
-rw-r--r--src/parse/properties/background.c21
-rw-r--r--src/parse/properties/background_position.c18
-rw-r--r--src/parse/properties/border_color.c17
-rw-r--r--src/parse/properties/border_spacing.c15
-rw-r--r--src/parse/properties/border_style.c17
-rw-r--r--src/parse/properties/border_width.c17
-rw-r--r--src/parse/properties/clip.c15
-rw-r--r--src/parse/properties/column_rule.c12
-rw-r--r--src/parse/properties/columns.c9
-rw-r--r--src/parse/properties/content.c10
-rw-r--r--src/parse/properties/cue.c16
-rw-r--r--src/parse/properties/cursor.c11
-rw-r--r--src/parse/properties/elevation.c18
-rw-r--r--src/parse/properties/flex.c21
-rw-r--r--src/parse/properties/flex_flow.c18
-rw-r--r--src/parse/properties/font.c23
-rw-r--r--src/parse/properties/font_family.c25
-rw-r--r--src/parse/properties/font_weight.c21
-rw-r--r--src/parse/properties/list_style.c15
-rw-r--r--src/parse/properties/list_style_type.c18
-rw-r--r--src/parse/properties/margin.c21
-rw-r--r--src/parse/properties/opacity.c10
-rw-r--r--src/parse/properties/outline.c15
-rw-r--r--src/parse/properties/overflow.c11
-rw-r--r--src/parse/properties/padding.c17
-rw-r--r--src/parse/properties/pause.c16
-rw-r--r--src/parse/properties/play_during.c18
-rw-r--r--src/parse/properties/quotes.c12
-rw-r--r--src/parse/properties/text_decoration.c7
-rw-r--r--src/parse/properties/voice_family.c13
31 files changed, 363 insertions, 135 deletions
diff --git a/src/parse/properties/azimuth.c b/src/parse/properties/azimuth.c
index f54189b..c1ff9ae 100644
--- a/src/parse/properties/azimuth.c
+++ b/src/parse/properties/azimuth.c
@@ -53,11 +53,30 @@ css_error css__parse_azimuth(css_language *c,
}
if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT],
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
flags = FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
+ } else if (token->type == CSS_TOKEN_IDENT &&
(lwc_string_caseless_isequal(token->idata, c->strings[LEFTWARDS],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c
index 01b995e..e11fcc9 100644
--- a/src/parse/properties/background.c
+++ b/src/parse/properties/background.c
@@ -45,31 +45,38 @@ css_error css__parse_background(css_language *c,
css_style * image_style;
css_style * position_style;
css_style * repeat_style;
-
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_ATTACHMENT);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_ATTACHMENT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_IMAGE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_IMAGE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_POSITION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_POSITION);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_REPEAT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BACKGROUND_REPEAT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/background_position.c b/src/parse/properties/background_position.c
index 6932c05..534950c 100644
--- a/src/parse/properties/background_position.c
+++ b/src/parse/properties/background_position.c
@@ -54,6 +54,24 @@ css_error css__parse_background_position(css_language *c,
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
flags = FLAG_INHERIT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
} else {
int i;
diff --git a/src/parse/properties/border_color.c b/src/parse/properties/border_color.c
index 28d30b7..41dbc2a 100644
--- a/src/parse/properties/border_color.c
+++ b/src/parse/properties/border_color.c
@@ -37,6 +37,7 @@ css_error css__parse_border_color(css_language *c,
uint16_t side_val[4];
uint32_t side_color[4];
uint32_t side_count = 0;
+ enum flag_value flag_value;
css_error error;
/* Firstly, handle inherit */
@@ -44,20 +45,26 @@ css_error css__parse_border_color(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_COLOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_COLOR);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_COLOR);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/border_spacing.c b/src/parse/properties/border_spacing.c
index 2322a5a..b931eda 100644
--- a/src/parse/properties/border_spacing.c
+++ b/src/parse/properties/border_spacing.c
@@ -36,7 +36,7 @@ css_error css__parse_border_spacing(css_language *c,
const css_token *token;
css_fixed length[2] = { 0 };
uint32_t unit[2] = { 0 };
- bool match;
+ enum flag_value flag_value;
/* length length? | IDENT(inherit) */
token = parserutils_vector_peek(vector, *ctx);
@@ -45,16 +45,13 @@ css_error css__parse_border_spacing(css_language *c,
return CSS_INVALID;
}
- if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
parserutils_vector_iterate(vector, ctx);
/* inherit */
- error = css__stylesheet_style_appendOPV(result,
- CSS_PROP_BORDER_SPACING,
- FLAG_INHERIT,
- 0);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_SPACING);
} else {
int num_lengths = 0;
diff --git a/src/parse/properties/border_style.c b/src/parse/properties/border_style.c
index a0d264d..7be1f8d 100644
--- a/src/parse/properties/border_style.c
+++ b/src/parse/properties/border_style.c
@@ -38,26 +38,33 @@ css_error css__parse_border_style(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_STYLE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_STYLE);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/border_width.c b/src/parse/properties/border_width.c
index bc911c9..90bd4cc 100644
--- a/src/parse/properties/border_width.c
+++ b/src/parse/properties/border_width.c
@@ -40,26 +40,33 @@ css_error css__parse_border_width(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_WIDTH);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_TOP_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_RIGHT_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_BOTTOM_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_WIDTH);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_BORDER_LEFT_WIDTH);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/clip.c b/src/parse/properties/clip.c
index 7862d4a..76fa364 100644
--- a/src/parse/properties/clip.c
+++ b/src/parse/properties/clip.c
@@ -37,6 +37,7 @@ css_error css__parse_clip(css_language *c,
int num_lengths = 0;
css_fixed length[4] = { 0 };
uint32_t unit[4] = { 0 };
+ enum flag_value flag_value;
bool match;
/* FUNCTION(rect) [ [ IDENT(auto) | length ] CHAR(,)? ]{3}
@@ -48,14 +49,12 @@ css_error css__parse_clip(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css__stylesheet_style_appendOPV(result,
- CSS_PROP_CLIP,
- FLAG_INHERIT,
- 0);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result,
+ flag_value, CSS_PROP_CLIP);
+
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(
token->idata, c->strings[AUTO],
diff --git a/src/parse/properties/column_rule.c b/src/parse/properties/column_rule.c
index ba57565..146783c 100644
--- a/src/parse/properties/column_rule.c
+++ b/src/parse/properties/column_rule.c
@@ -41,26 +41,28 @@ css_error css__parse_column_rule(css_language *c,
css_style *color_style;
css_style *style_style;
css_style *width_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_RULE_WIDTH);
-
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/columns.c b/src/parse/properties/columns.c
index b245740..edc7ee6 100644
--- a/src/parse/properties/columns.c
+++ b/src/parse/properties/columns.c
@@ -39,19 +39,22 @@ css_error css__parse_columns(css_language *c,
bool count = true;
css_style *width_style;
css_style *count_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_WIDTH);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_COLUMN_COUNT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/content.c b/src/parse/properties/content.c
index 10f221f..186abcc 100644
--- a/src/parse/properties/content.c
+++ b/src/parse/properties/content.c
@@ -35,6 +35,7 @@ css_error css__parse_content(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* IDENT(normal, none, inherit) | [ ... ]+ */
@@ -44,12 +45,11 @@ css_error css__parse_content(css_language *c,
return CSS_INVALID;
}
+ flag_value = get_css_flag_value(c, token);
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_CONTENT);
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_CONTENT);
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata,
c->strings[NORMAL],
diff --git a/src/parse/properties/cue.c b/src/parse/properties/cue.c
index eef10d1..98844bd 100644
--- a/src/parse/properties/cue.c
+++ b/src/parse/properties/cue.c
@@ -57,15 +57,23 @@ css_error css__parse_cue(css_language *c,
error = css__parse_cue_after(c, vector, ctx, result);
} else {
/* second token - might be useful */
- if (is_css_inherit(c, token)) {
- /* another inherit which is bogus */
+ enum flag_value flag_value;
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* another generic property reset value
+ * which is bogus */
error = CSS_INVALID;
} else {
error = css__parse_cue_after(c, vector, ctx, result);
if (error == CSS_OK) {
/* second token parsed */
- if (is_css_inherit(c, first_token)) {
- /* valid second token after inherit */
+ flag_value = get_css_flag_value(c, first_token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* valid second token after
+ * generic property reset value */
error = CSS_INVALID;
}
} else {
diff --git a/src/parse/properties/cursor.c b/src/parse/properties/cursor.c
index ad3ac47..ad2200c 100644
--- a/src/parse/properties/cursor.c
+++ b/src/parse/properties/cursor.c
@@ -33,6 +33,7 @@ css_error css__parse_cursor(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* [ (URI ',')* IDENT(auto, crosshair, default, pointer, move, e-resize,
@@ -48,11 +49,11 @@ css_error css__parse_cursor(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_CURSOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_CURSOR);
} else {
bool first = true;
diff --git a/src/parse/properties/elevation.c b/src/parse/properties/elevation.c
index fea35a3..7fe5bf2 100644
--- a/src/parse/properties/elevation.c
+++ b/src/parse/properties/elevation.c
@@ -55,6 +55,24 @@ css_error css__parse_elevation(css_language *c,
flags = FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_IDENT &&
(lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_INITIAL;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_REVERT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ parserutils_vector_iterate(vector, ctx);
+ flags = FLAG_UNSET;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
token->idata, c->strings[BELOW],
&match) == lwc_error_ok && match)) {
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/flex.c b/src/parse/properties/flex.c
index 9e284d9..d8f3848 100644
--- a/src/parse/properties/flex.c
+++ b/src/parse/properties/flex.c
@@ -44,29 +44,30 @@ css_error css__parse_flex(css_language *c,
css_style *basis_style;
bool short_auto = false;
bool short_none = false;
+ enum flag_value flag_value;
bool match;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
-
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_GROW);
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_SHRINK);
-
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_BASIS);
-
- if (error == CSS_OK)
+ if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
return error;
diff --git a/src/parse/properties/flex_flow.c b/src/parse/properties/flex_flow.c
index e2d0e0c..2d9c60a 100644
--- a/src/parse/properties/flex_flow.c
+++ b/src/parse/properties/flex_flow.c
@@ -40,26 +40,28 @@ css_error css__parse_flex_flow(css_language *c,
bool wrap = true;
css_style *direction_style;
css_style *wrap_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
-
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result,
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_DIRECTION);
- if (error != CSS_OK)
+ if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result,
+ error = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_FLEX_WRAP);
-
- if (error == CSS_OK)
+ if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
return error;
- }
+ }
/* allocate styles */
error = css__stylesheet_style_create(c->sheet, &direction_style);
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 5010242..7ce9701 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -243,6 +243,7 @@ css_error css__parse_font(css_language *c,
css_style *size_style;
css_style *line_height_style;
css_style *family_style;
+ enum flag_value flag_value;
int svw;
/* Firstly, handle inherit */
@@ -250,28 +251,36 @@ css_error css__parse_font(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_STYLE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_VARIANT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_VARIANT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_WEIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_WEIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_SIZE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_SIZE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LINE_HEIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LINE_HEIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FONT_FAMILY);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/font_family.c b/src/parse/properties/font_family.c
index 23c080b..b309f45 100644
--- a/src/parse/properties/font_family.c
+++ b/src/parse/properties/font_family.c
@@ -127,7 +127,30 @@ css_error css__parse_font_family(css_language *c,
(lwc_string_caseless_isequal(
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY);
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_initial(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_revert(result,
+ CSS_PROP_FONT_FAMILY);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ error = css_stylesheet_style_unset(result,
+ CSS_PROP_FONT_FAMILY);
+
} else {
*ctx = orig_ctx;
diff --git a/src/parse/properties/font_weight.c b/src/parse/properties/font_weight.c
index 8e57e5f..abe0b78 100644
--- a/src/parse/properties/font_weight.c
+++ b/src/parse/properties/font_weight.c
@@ -47,10 +47,29 @@ css_error css__parse_font_weight(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(
+ if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_INITIAL;
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_REVERT;
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_UNSET;
+
} else if (token->type == CSS_TOKEN_NUMBER) {
size_t consumed = 0;
css_fixed num = css__number_from_lwc_string(token->idata,
diff --git a/src/parse/properties/list_style.c b/src/parse/properties/list_style.c
index b2c8de3..e6e8eae 100644
--- a/src/parse/properties/list_style.c
+++ b/src/parse/properties/list_style.c
@@ -41,23 +41,28 @@ css_error css__parse_list_style(css_language *c,
css_style *image_style;
css_style *position_style;
css_style *type_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_IMAGE);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_IMAGE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_POSITION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_POSITION);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_TYPE);
-
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_LIST_STYLE_TYPE);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/list_style_type.c b/src/parse/properties/list_style_type.c
index ccaa133..fe66bcb 100644
--- a/src/parse/properties/list_style_type.c
+++ b/src/parse/properties/list_style_type.c
@@ -49,10 +49,26 @@ css_error css__parse_list_style_type(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(
+ if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
ident->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_INITIAL;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_REVERT;
+ } else if (ident->type == CSS_TOKEN_IDENT &&
+ (lwc_string_caseless_isequal(
+ ident->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags = FLAG_UNSET;
} else {
error = css__parse_list_style_type_value(c, ident, &value);
if (error != CSS_OK) {
diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c
index 7817d50..63adddc 100644
--- a/src/parse/properties/margin.c
+++ b/src/parse/properties/margin.c
@@ -40,26 +40,33 @@ css_error css__parse_margin(css_language *c,
uint32_t side_count = 0;
bool match;
css_error error;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_TOP);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_TOP);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_RIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_RIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_BOTTOM);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_BOTTOM);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_LEFT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_MARGIN_LEFT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
@@ -70,7 +77,9 @@ css_error css__parse_margin(css_language *c,
do {
prev_ctx = *ctx;
- if ((token != NULL) && is_css_inherit(c, token)) {
+ flag_value = get_css_flag_value(c, token);
+
+ if ((token != NULL) && flag_value != FLAG_VALUE__NONE) {
*ctx = orig_ctx;
return CSS_INVALID;
}
diff --git a/src/parse/properties/opacity.c b/src/parse/properties/opacity.c
index e8b7c3e..5d7b176 100644
--- a/src/parse/properties/opacity.c
+++ b/src/parse/properties/opacity.c
@@ -33,7 +33,7 @@ css_error css__parse_opacity(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
- bool match;
+ enum flag_value flag_value;
token = parserutils_vector_iterate(vector, ctx);
if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) {
@@ -41,8 +41,12 @@ css_error css__parse_opacity(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_OPACITY);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OPACITY);
+
} else if (token->type == CSS_TOKEN_NUMBER) {
css_fixed num = 0;
size_t consumed = 0;
diff --git a/src/parse/properties/outline.c b/src/parse/properties/outline.c
index 4d4fbf0..8ceac8a 100644
--- a/src/parse/properties/outline.c
+++ b/src/parse/properties/outline.c
@@ -41,23 +41,28 @@ css_error css__parse_outline(css_language *c,
css_style *color_style;
css_style *style_style;
css_style *width_style;
+ enum flag_value flag_value;
/* Firstly, handle inherit */
token = parserutils_vector_peek(vector, *ctx);
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_COLOR);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_COLOR);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_STYLE);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_STYLE);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_WIDTH);
-
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_OUTLINE_WIDTH);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/overflow.c b/src/parse/properties/overflow.c
index ca133ed..7bc1938 100644
--- a/src/parse/properties/overflow.c
+++ b/src/parse/properties/overflow.c
@@ -34,6 +34,7 @@ css_error css__parse_overflow(css_language *c,
int orig_ctx = *ctx;
css_error error1, error2 = CSS_OK;
const css_token *token;
+ enum flag_value flag_value;
bool match;
token = parserutils_vector_iterate(vector, ctx);
@@ -42,12 +43,12 @@ css_error css__parse_overflow(css_language *c,
return CSS_INVALID;
}
- if ((lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT], &match) == lwc_error_ok &&
- match)) {
- error1 = css_stylesheet_style_inherit(result,
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error1 = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_OVERFLOW_X);
- error2 = css_stylesheet_style_inherit(result,
+ error2 = css_stylesheet_style_flag_value(result, flag_value,
CSS_PROP_OVERFLOW_Y);
} else if ((lwc_string_caseless_isequal(token->idata,
diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c
index 7f5b9f6..bef3607 100644
--- a/src/parse/properties/padding.c
+++ b/src/parse/properties/padding.c
@@ -37,6 +37,7 @@ css_error css__parse_padding(css_language *c,
css_fixed side_length[4];
uint32_t side_unit[4];
uint32_t side_count = 0;
+ enum flag_value flag_value;
css_error error;
/* Firstly, handle inherit */
@@ -44,20 +45,26 @@ css_error css__parse_padding(css_language *c,
if (token == NULL)
return CSS_INVALID;
- if (is_css_inherit(c, token)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_TOP);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_TOP);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_RIGHT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_RIGHT);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_BOTTOM);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_BOTTOM);
if (error != CSS_OK)
return error;
- error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_LEFT);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_PADDING_LEFT);
if (error == CSS_OK)
parserutils_vector_iterate(vector, ctx);
diff --git a/src/parse/properties/pause.c b/src/parse/properties/pause.c
index e45a8f4..b238d20 100644
--- a/src/parse/properties/pause.c
+++ b/src/parse/properties/pause.c
@@ -57,15 +57,23 @@ css_error css__parse_pause(css_language *c,
error = css__parse_pause_after(c, vector, ctx, result);
} else {
/* second token - might be useful */
- if (is_css_inherit(c, token)) {
- /* another bogus inherit */
+ enum flag_value flag_value;
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* another generic property reset value
+ * which is bogus */
error = CSS_INVALID;
} else {
error = css__parse_pause_after(c, vector, ctx, result);
if (error == CSS_OK) {
/* second token parsed */
- if (is_css_inherit(c, first_token)) {
- /* valid second token after inherit */
+ flag_value = get_css_flag_value(c, first_token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ /* valid second token after
+ * generic property reset value */
error = CSS_INVALID;
}
} else {
diff --git a/src/parse/properties/play_during.c b/src/parse/properties/play_during.c
index 109ae64..54e048f 100644
--- a/src/parse/properties/play_during.c
+++ b/src/parse/properties/play_during.c
@@ -54,14 +54,32 @@ css_error css__parse_play_during(css_language *c,
token->idata, c->strings[INHERIT],
&match) == lwc_error_ok && match)) {
flags |= FLAG_INHERIT;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[INITIAL],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_INITIAL;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[REVERT],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_REVERT;
+
+ } else if ((lwc_string_caseless_isequal(
+ token->idata, c->strings[UNSET],
+ &match) == lwc_error_ok && match)) {
+ flags |= FLAG_UNSET;
+
} else if ((lwc_string_caseless_isequal(
token->idata, c->strings[NONE],
&match) == lwc_error_ok && match)) {
value = PLAY_DURING_NONE;
+
} else if ((lwc_string_caseless_isequal(
token->idata, c->strings[AUTO],
&match) == lwc_error_ok && match)) {
value = PLAY_DURING_AUTO;
+
} else {
*ctx = orig_ctx;
return CSS_INVALID;
diff --git a/src/parse/properties/quotes.c b/src/parse/properties/quotes.c
index 9d3c4c9..b71158f 100644
--- a/src/parse/properties/quotes.c
+++ b/src/parse/properties/quotes.c
@@ -34,6 +34,7 @@ css_error css__parse_quotes(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* [ STRING STRING ]+ | IDENT(none,inherit) */
@@ -45,11 +46,12 @@ css_error css__parse_quotes(css_language *c,
return CSS_INVALID;
}
- if ((token->type == CSS_TOKEN_IDENT) &&
- (lwc_string_caseless_isequal(token->idata,
- c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_QUOTES);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_QUOTES);
+
} else if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata,
c->strings[NONE],
diff --git a/src/parse/properties/text_decoration.c b/src/parse/properties/text_decoration.c
index a7bae24..1345b8e 100644
--- a/src/parse/properties/text_decoration.c
+++ b/src/parse/properties/text_decoration.c
@@ -34,6 +34,7 @@ css_error css__parse_text_decoration(css_language *c,
int orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
+ enum flag_value flag_value;
bool match;
/* IDENT([ underline || overline || line-through || blink ])
@@ -44,10 +45,14 @@ css_error css__parse_text_decoration(css_language *c,
return CSS_INVALID;
}
+ flag_value = get_css_flag_value(c, token);
+
if (lwc_string_caseless_isequal(token->idata,
c->strings[INHERIT],
&match) == lwc_error_ok && match) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_TEXT_DECORATION);
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_TEXT_DECORATION);
+
} else if (lwc_string_caseless_isequal(token->idata,
c->strings[NONE],
&match) == lwc_error_ok && match) {
diff --git a/src/parse/properties/voice_family.c b/src/parse/properties/voice_family.c
index 193cb6b..f62ba15 100644
--- a/src/parse/properties/voice_family.c
+++ b/src/parse/properties/voice_family.c
@@ -90,7 +90,7 @@ css_error css__parse_voice_family(css_language *c,
int orig_ctx = *ctx;
css_error error;
const css_token *token;
- bool match;
+ enum flag_value flag_value;
/* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit)
*
@@ -105,11 +105,12 @@ css_error css__parse_voice_family(css_language *c,
return CSS_INVALID;
}
- if (token->type == CSS_TOKEN_IDENT &&
- (lwc_string_caseless_isequal(
- token->idata, c->strings[INHERIT],
- &match) == lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result, CSS_PROP_VOICE_FAMILY);
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_VOICE_FAMILY);
+
} else {
*ctx = orig_ctx;