summaryrefslogtreecommitdiff
path: root/src/parse/properties/margin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse/properties/margin.c')
-rw-r--r--src/parse/properties/margin.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c
index 7817d50..1ee56f7 100644
--- a/src/parse/properties/margin.c
+++ b/src/parse/properties/margin.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_margin(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
@@ -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;
}