diff options
Diffstat (limited to 'src/parse')
51 files changed, 994 insertions, 357 deletions
diff --git a/src/parse/font_face.c b/src/parse/font_face.c index f17d50e..055a118 100644 --- a/src/parse/font_face.c +++ b/src/parse/font_face.c @@ -41,7 +41,7 @@ static bool font_rule_font_family_reserved(css_language *c, } static css_error font_face_parse_font_family(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_font_face *font_face) { css_error error; @@ -60,7 +60,7 @@ static css_error font_face_parse_font_family(css_language *c, } static css_error font_face_src_parse_format(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_font_face_format *format) { bool match; @@ -120,7 +120,7 @@ static css_error font_face_src_parse_format(css_language *c, } static css_error font_face_src_parse_spec_or_name(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, lwc_string **location, css_font_face_location_type *location_type, css_font_face_format *format) @@ -194,10 +194,10 @@ static css_error font_face_src_parse_spec_or_name(css_language *c, } static css_error font_face_parse_src(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_font_face *font_face) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; css_error error = CSS_OK; const css_token *token; css_font_face_src *srcs = NULL, *new_srcs = NULL; @@ -258,10 +258,10 @@ cleanup: } static css_error font_face_parse_font_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_font_face *font_face) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; css_error error = CSS_OK; const css_token *token; enum css_font_style_e style = 0; @@ -299,10 +299,10 @@ static css_error font_face_parse_font_style(css_language *c, } static css_error font_face_parse_font_weight(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_font_face *font_face) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; css_error error = CSS_OK; const css_token *token; enum css_font_weight_e weight = 0; @@ -374,7 +374,7 @@ static css_error font_face_parse_font_weight(css_language *c, */ css_error css__parse_font_descriptor(css_language *c, const css_token *descriptor, const parserutils_vector *vector, - int *ctx, css_rule_font_face *rule) + int32_t *ctx, css_rule_font_face *rule) { css_font_face *font_face = rule->font_face; css_error error; diff --git a/src/parse/font_face.h b/src/parse/font_face.h index 435380e..dc00ef1 100644 --- a/src/parse/font_face.h +++ b/src/parse/font_face.h @@ -17,6 +17,6 @@ css_error css__parse_font_descriptor(css_language *c, const css_token *descriptor, const parserutils_vector *vector, - int *ctx, struct css_rule_font_face *rule); + int32_t *ctx, struct css_rule_font_face *rule); #endif diff --git a/src/parse/important.c b/src/parse/important.c index 1066d90..950fc6a 100644 --- a/src/parse/important.c +++ b/src/parse/important.c @@ -25,10 +25,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_important(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, uint8_t *result) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; bool match = false; const css_token *token; @@ -87,7 +87,10 @@ void css__make_style_important(css_style *style) offset++; /* Advance past any property-specific data */ - if (hasFlagValue(opv) == false) { + if (hasFlagValue(opv) == false && value == VALUE_IS_CALC) { + /* All VALUE_IS_CALC have the form OPV UNIT STRIDX */ + offset += 2; + } else if (hasFlagValue(opv) == false) { switch (op) { case CSS_PROP_AZIMUTH: if ((value & ~AZIMUTH_BEHIND) == AZIMUTH_ANGLE) @@ -346,6 +349,16 @@ void css__make_style_important(css_style *style) offset++; /* value */ break; + case CSS_PROP_FILL_OPACITY: + if (value == FILL_OPACITY_SET) + offset++; /* value */ + break; + + case CSS_PROP_STROKE_OPACITY: + if (value == STROKE_OPACITY_SET) + offset++; /* value */ + break; + case CSS_PROP_ORDER: if (value == ORDER_SET) offset++; /* value */ diff --git a/src/parse/important.h b/src/parse/important.h index ba5e118..e939c4b 100644 --- a/src/parse/important.h +++ b/src/parse/important.h @@ -12,7 +12,7 @@ #include "parse/language.h" css_error css__parse_important(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, uint8_t *result); void css__make_style_important(css_style *style); diff --git a/src/parse/language.c b/src/parse/language.c index c2d02d7..936ab3d 100644 --- a/src/parse/language.c +++ b/src/parse/language.c @@ -63,37 +63,37 @@ static css_error lookupNamespace(css_language *c, /* Selector list parsing */ static css_error parseClass(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector_detail *specific); static css_error parseAttrib(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector_detail *specific); static css_error parseNth(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector_detail_value *value); static css_error parsePseudo(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool in_not, css_selector_detail *specific); static css_error parseSpecific(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool in_not, css_selector_detail *specific); static css_error parseAppendSpecific(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector **parent); static css_error parseSelectorSpecifics(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector **parent); static css_error parseTypeSelector(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_qname *qname); static css_error parseSimpleSelector(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector **result); static css_error parseCombinator(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_combinator *result); static css_error parseSelector(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector **result); static css_error parseSelectorList(css_language *c, const parserutils_vector *vector, css_rule *rule); @@ -101,7 +101,7 @@ static css_error parseSelectorList(css_language *c, /* Declaration parsing */ static css_error parseProperty(css_language *c, const css_token *property, const parserutils_vector *vector, - int *ctx, css_rule *rule); + int32_t *ctx, css_rule *rule); /** * Create a CSS language parser @@ -790,7 +790,7 @@ css_error handleDeclaration(css_language *c, const parserutils_vector *vector) { css_error error; const css_token *token, *ident; - int ctx = 0; + int32_t ctx = 0; context_entry *entry; css_rule *rule; @@ -945,7 +945,7 @@ css_error lookupNamespace(css_language *c, lwc_string *prefix, lwc_string **uri) ******************************************************************************/ css_error parseClass(css_language *c, const parserutils_vector *vector, - int *ctx, css_selector_detail *specific) + int32_t *ctx, css_selector_detail *specific) { css_qname qname; css_selector_detail_value detail_value; @@ -976,7 +976,7 @@ css_error parseClass(css_language *c, const parserutils_vector *vector, } css_error parseAttrib(css_language *c, const parserutils_vector *vector, - int *ctx, css_selector_detail *specific) + int32_t *ctx, css_selector_detail *specific) { css_qname qname; css_selector_detail_value detail_value; @@ -1078,7 +1078,7 @@ css_error parseAttrib(css_language *c, const parserutils_vector *vector, } css_error parseNth(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector_detail_value *value) { const css_token *token; @@ -1279,7 +1279,7 @@ css_error parseNth(css_language *c, } css_error parsePseudo(css_language *c, const parserutils_vector *vector, - int *ctx, bool in_not, css_selector_detail *specific) + int32_t *ctx, bool in_not, css_selector_detail *specific) { static const struct { @@ -1459,7 +1459,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector, } css_error parseSpecific(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool in_not, css_selector_detail *specific) { css_error error; @@ -1514,7 +1514,7 @@ css_error parseSpecific(css_language *c, } css_error parseAppendSpecific(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector **parent) { css_error error; @@ -1529,7 +1529,7 @@ css_error parseAppendSpecific(css_language *c, } css_error parseSelectorSpecifics(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector **parent) { css_error error; @@ -1551,7 +1551,7 @@ css_error parseSelectorSpecifics(css_language *c, } css_error parseTypeSelector(css_language *c, const parserutils_vector *vector, - int *ctx, css_qname *qname) + int32_t *ctx, css_qname *qname) { const css_token *token; css_error error; @@ -1612,10 +1612,10 @@ css_error parseTypeSelector(css_language *c, const parserutils_vector *vector, } css_error parseSimpleSelector(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_selector **result) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; css_error error; const css_token *token; css_selector *selector; @@ -1678,7 +1678,7 @@ css_error parseSimpleSelector(css_language *c, } css_error parseCombinator(css_language *c, const parserutils_vector *vector, - int *ctx, css_combinator *result) + int32_t *ctx, css_combinator *result) { const css_token *token; css_combinator comb = CSS_COMBINATOR_NONE; @@ -1719,7 +1719,7 @@ css_error parseCombinator(css_language *c, const parserutils_vector *vector, } css_error parseSelector(css_language *c, const parserutils_vector *vector, - int *ctx, css_selector **result) + int32_t *ctx, css_selector **result) { css_error error; const css_token *token = NULL; @@ -1785,7 +1785,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector, css_error error; const css_token *token = NULL; css_selector *selector = NULL; - int ctx = 0; + int32_t ctx = 0; /* Strip any leading whitespace (can happen if in nested block) */ consumeWhitespace(vector, &ctx); @@ -1843,7 +1843,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector, ******************************************************************************/ css_error parseProperty(css_language *c, const css_token *property, - const parserutils_vector *vector, int *ctx, css_rule *rule) + const parserutils_vector *vector, int32_t *ctx, css_rule *rule) { css_error error; css_prop_handler handler = NULL; diff --git a/src/parse/language.h b/src/parse/language.h index 2ab4987..81a096a 100644 --- a/src/parse/language.h +++ b/src/parse/language.h @@ -64,7 +64,7 @@ css_error css__language_destroy(css_language *language); * \param vector The vector to consume from * \param ctx The vector's context */ -static inline void consumeWhitespace(const parserutils_vector *vector, int *ctx) +static inline void consumeWhitespace(const parserutils_vector *vector, int32_t *ctx) { const css_token *token = NULL; diff --git a/src/parse/mq.c b/src/parse/mq.c index b5478a1..5031e34 100644 --- a/src/parse/mq.c +++ b/src/parse/mq.c @@ -79,11 +79,11 @@ void css__mq_query_destroy(css_mq_query *media) } static css_error mq_parse_condition(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool permit_or, css_mq_cond **cond); static css_error mq_parse_ratio( - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, const css_token *numerator, css_fixed *ratio) { const css_token *token; @@ -260,7 +260,7 @@ static css_error mq_parse_range__convert_to_level_4( } static css_error mq_parse_range(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, const css_token *name_or_value, css_mq_feature **feature) { @@ -443,7 +443,7 @@ static css_error mq_parse_range(lwc_string **strings, } static css_error mq_parse_media_feature(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_mq_feature **feature) { const css_token *name_or_value, *token; @@ -565,7 +565,7 @@ static css_error mq_parse_media_feature(lwc_string **strings, * CSS Syntax Module Level 3: 8.2 */ static css_error mq_parse_consume_any_value(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool until, const char until_char) { const css_token *token; @@ -627,7 +627,7 @@ static css_error mq_parse_consume_any_value(lwc_string **strings, } static css_error mq_parse_general_enclosed(lwc_string **strings, - const parserutils_vector *vector, int *ctx) + const parserutils_vector *vector, int32_t *ctx) { const css_token *token; css_error error; @@ -671,7 +671,7 @@ static css_error mq_parse_general_enclosed(lwc_string **strings, } static css_error mq_parse_media_in_parens(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_mq_cond_or_feature **cond_or_feature) { const css_token *token; @@ -754,7 +754,7 @@ static css_error mq_parse_media_in_parens(lwc_string **strings, } static css_error mq_parse_condition(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool permit_or, css_mq_cond **cond) { const css_token *token; @@ -959,7 +959,7 @@ static css_error mq_parse_type(lwc_string **strings, lwc_string *type, } static css_error mq_parse_media_query(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_mq_query **query) { const css_token *token; @@ -984,7 +984,7 @@ static css_error mq_parse_media_query(lwc_string **strings, lwc_string_caseless_isequal(token->idata, strings[NOT], &match) == lwc_error_ok && match) { - int old_ctx = *ctx; + int32_t old_ctx = *ctx; parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); @@ -1100,7 +1100,7 @@ static css_error css__mq_parse__create_not_all( } css_error css__mq_parse_media_list(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_mq_query **media) { css_mq_query *result = NULL, *last = NULL; @@ -1162,7 +1162,7 @@ static css_error css_parse_media_query_handle_event( const parserutils_vector *tokens, void *pw) { - int idx = 0; + int32_t idx = 0; css_error err; css_mq_query *media; const css_token *tok; diff --git a/src/parse/mq.h b/src/parse/mq.h index 7a51578..ec19419 100644 --- a/src/parse/mq.h +++ b/src/parse/mq.h @@ -88,7 +88,7 @@ css_error css_parse_media_query(lwc_string **strings, css_mq_query **media_out); css_error css__mq_parse_media_list(lwc_string **strings, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_mq_query **media); void css__mq_query_destroy(css_mq_query *media); diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile index 6461dda..df84d49 100644 --- a/src/parse/properties/Makefile +++ b/src/parse/properties/Makefile @@ -45,6 +45,7 @@ DIR_SOURCES := \ cue.c \ cursor.c \ elevation.c \ + fill_opacity.c \ flex.c \ flex_flow.c \ font.c \ @@ -61,6 +62,7 @@ DIR_SOURCES := \ play_during.c \ properties.c \ quotes.c \ + stroke_opacity.c \ text_decoration.c \ utils.c \ voice_family.c diff --git a/src/parse/properties/azimuth.c b/src/parse/properties/azimuth.c index c1ff9ae..a9265d1 100644 --- a/src/parse/properties/azimuth.c +++ b/src/parse/properties/azimuth.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_azimuth(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; css_error error; const css_token *token; uint8_t flags = 0; diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c index e11fcc9..20aeb30 100644 --- a/src/parse/properties/background.c +++ b/src/parse/properties/background.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_background(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; css_error error = CSS_OK; diff --git a/src/parse/properties/background_position.c b/src/parse/properties/background_position.c index 534950c..1d87e6a 100644 --- a/src/parse/properties/background_position.c +++ b/src/parse/properties/background_position.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_background_position(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; css_error error; const css_token *token; uint8_t flags = 0; diff --git a/src/parse/properties/border.c b/src/parse/properties/border.c index 26cdbcd..be269ab 100644 --- a/src/parse/properties/border.c +++ b/src/parse/properties/border.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border(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; css_error error; error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_TOP); diff --git a/src/parse/properties/border_color.c b/src/parse/properties/border_color.c index 41dbc2a..60b401e 100644 --- a/src/parse/properties/border_color.c +++ b/src/parse/properties/border_color.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_color(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]; diff --git a/src/parse/properties/border_spacing.c b/src/parse/properties/border_spacing.c index b931eda..e00fb27 100644 --- a/src/parse/properties/border_spacing.c +++ b/src/parse/properties/border_spacing.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_spacing(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; css_error error; const css_token *token; css_fixed length[2] = { 0 }; diff --git a/src/parse/properties/border_style.c b/src/parse/properties/border_style.c index 7be1f8d..4d54900 100644 --- a/src/parse/properties/border_style.c +++ b/src/parse/properties/border_style.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_style(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]; diff --git a/src/parse/properties/border_width.c b/src/parse/properties/border_width.c index 90bd4cc..b11ca05 100644 --- a/src/parse/properties/border_width.c +++ b/src/parse/properties/border_width.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_width(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]; diff --git a/src/parse/properties/clip.c b/src/parse/properties/clip.c index 76fa364..4bf653d 100644 --- a/src/parse/properties/clip.c +++ b/src/parse/properties/clip.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_clip(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; css_error error; const css_token *token; int num_lengths = 0; diff --git a/src/parse/properties/column_rule.c b/src/parse/properties/column_rule.c index 146783c..7bfcad5 100644 --- a/src/parse/properties/column_rule.c +++ b/src/parse/properties/column_rule.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_column_rule(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; css_error error; diff --git a/src/parse/properties/columns.c b/src/parse/properties/columns.c index edc7ee6..277a305 100644 --- a/src/parse/properties/columns.c +++ b/src/parse/properties/columns.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_columns(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; css_error error = CSS_OK; diff --git a/src/parse/properties/content.c b/src/parse/properties/content.c index 186abcc..7c03c6a 100644 --- a/src/parse/properties/content.c +++ b/src/parse/properties/content.c @@ -29,11 +29,11 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_content(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result) { - int orig_ctx = *ctx; - css_error error; + int32_t orig_ctx = *ctx; + css_error error = CSS_INVALID; const css_token *token; enum flag_value flag_value; bool match; @@ -42,7 +42,7 @@ css_error css__parse_content(css_language *c, token = parserutils_vector_iterate(vector, ctx); if (token == NULL) { *ctx = orig_ctx; - return CSS_INVALID; + return error; } flag_value = get_css_flag_value(c, token); diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c index 1e8b007..85d8122 100644 --- a/src/parse/properties/css_property_parser_gen.c +++ b/src/parse/properties/css_property_parser_gen.c @@ -19,6 +19,12 @@ * list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:) */ +typedef enum { + CALC_ANY, + CALC_NUMBER, + CALC_UNIT, +} calc_kind; + struct keyval { char *key; char *val; @@ -44,7 +50,12 @@ struct keyval *get_keyval(char **pos) } else { kvlen = (endpos - *pos); } + nkeyval = calloc(1, sizeof(struct keyval) + kvlen + 1); + if (nkeyval == NULL) { + /* allocation failed, cannot proceed */ + return NULL; + } memcpy(nkeyval + 1, *pos, kvlen); @@ -106,7 +117,7 @@ void output_header(FILE *outputf, const char *descriptor, struct keyval *parser_ " * If the input is invalid, then \\a *ctx remains unchanged.\n" " */\n" "css_error css__parse_%s(css_language *c,\n" - " const parserutils_vector *vector, int *ctx,\n" + " const parserutils_vector *vector, int32_t *ctx,\n" " css_style *result%s)\n" "{\n", descriptor, @@ -120,7 +131,7 @@ void output_header(FILE *outputf, const char *descriptor, struct keyval *parser_ void output_token_type_check(FILE *outputf, bool do_token_check, struct keyval_list *IDENT, struct keyval_list *URI, struct keyval_list *NUMBER) { fprintf(outputf, - " int orig_ctx = *ctx;\n" + " int32_t orig_ctx = *ctx;\n" " css_error error;\n" " const css_token *token;\n" " bool match;\n\n" @@ -311,12 +322,35 @@ void output_color(FILE *outputf, struct keyval *parseid, struct keyval_list *kvl parseid->val); } +void output_calc(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist) +{ + struct keyval *ckv = kvlist->item[0]; + const char *kind; + + if (strcmp(ckv->key, "NUMBER") == 0) + kind = "UNIT_CALC_NUMBER"; + else if (strcmp(ckv->key, "ANY") == 0) + kind = "UNIT_CALC_ANY"; + else + kind = ckv->key; + + fprintf(outputf, + "if ((token->type == CSS_TOKEN_FUNCTION) && " + "(lwc_string_caseless_isequal(token->idata, c->strings[CALC], &match) == lwc_error_ok && match))" + " {\n" + "\t\terror = css__parse_calc(c, vector, ctx, result, buildOPV(%s, 0, %s), %s);\n" + "\t} else ", + parseid->val, + ckv->val, + kind + ); +} + void output_length_unit(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist) { struct keyval *ckv = kvlist->item[0]; int ident_count; - fprintf(outputf, "{\n" "\t\tcss_fixed length = 0;\n" @@ -523,6 +557,7 @@ int main(int argc, char **argv) struct keyval_list WRAP; struct keyval_list NUMBER; struct keyval_list COLOR; + struct keyval_list CALC; if (argc < 2) { @@ -555,6 +590,7 @@ int main(int argc, char **argv) COLOR.count = 0; LENGTH_UNIT.count = 0; IDENT_LIST.count = 0; + CALC.count = 0; curlist = &base; @@ -570,7 +606,7 @@ int main(int argc, char **argv) if (strcmp(rkv->key, "WRAP") == 0) { WRAP.item[WRAP.count++] = rkv; only_ident = false; - } else if (strcmp(rkv->key, "NUMBER") == 0) { + } else if (curlist == &base && strcmp(rkv->key, "NUMBER") == 0) { if (rkv->val[0] == '(') { curlist = &NUMBER; } else if (rkv->val[0] == ')') { @@ -607,6 +643,14 @@ int main(int argc, char **argv) } only_ident = false; do_token_check = false; + } else if (strcmp(rkv->key, "CALC") == 0) { + if (rkv->val[0] == '(') { + curlist = &CALC; + } else if (rkv->val[0] == ')') { + curlist = &base; + } + only_ident = false; + do_token_check = false; } else if (strcmp(rkv->key, "COLOR") == 0) { COLOR.item[COLOR.count++] = rkv; do_token_check = false; @@ -630,7 +674,7 @@ int main(int argc, char **argv) /* header */ -output_header(outputf, descriptor, base.item[0], is_generic); + output_header(outputf, descriptor, base.item[0], is_generic); if (WRAP.count > 0) { output_wrap(outputf, base.item[0], &WRAP); @@ -644,6 +688,10 @@ output_header(outputf, descriptor, base.item[0], is_generic); if (URI.count > 0) output_uri(outputf, base.item[0], &URI); + if (CALC.count > 0) { + output_calc(outputf, base.item[0], &CALC); + } + if (NUMBER.count > 0) output_number(outputf, base.item[0], &NUMBER); diff --git a/src/parse/properties/cue.c b/src/parse/properties/cue.c index 98844bd..db64412 100644 --- a/src/parse/properties/cue.c +++ b/src/parse/properties/cue.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_cue(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; css_error error; const css_token *first_token; const css_token *token; diff --git a/src/parse/properties/cursor.c b/src/parse/properties/cursor.c index ad2200c..b61d9a9 100644 --- a/src/parse/properties/cursor.c +++ b/src/parse/properties/cursor.c @@ -27,10 +27,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_cursor(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; css_error error = CSS_OK; const css_token *token; enum flag_value flag_value; diff --git a/src/parse/properties/elevation.c b/src/parse/properties/elevation.c index 7fe5bf2..b456799 100644 --- a/src/parse/properties/elevation.c +++ b/src/parse/properties/elevation.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_elevation(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; css_error error; const css_token *token; uint8_t flags = 0; diff --git a/src/parse/properties/fill_opacity.c b/src/parse/properties/fill_opacity.c new file mode 100644 index 0000000..caed86f --- /dev/null +++ b/src/parse/properties/fill_opacity.c @@ -0,0 +1,82 @@ +/* + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + */ + +#include <assert.h> +#include <string.h> + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "parse/properties/properties.h" +#include "parse/properties/utils.h" + +/** + * Parse fill-opacity + * + * \param c Parsing context + * \param vector Vector of tokens to process + * \param ctx Pointer to vector iteration context + * \param result resulting style + * \return CSS_OK on success, + * CSS_NOMEM on memory exhaustion, + * CSS_INVALID if the input is not valid + * + * Post condition: \a *ctx is updated with the next token to process + * If the input is invalid, then \a *ctx remains unchanged. + */ +css_error css__parse_fill_opacity(css_language *c, + const parserutils_vector *vector, int32_t *ctx, + css_style *result) +{ + int32_t orig_ctx = *ctx; + css_error error; + const css_token *token; + enum flag_value flag_value; + + token = parserutils_vector_iterate(vector, ctx); + if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) { + *ctx = orig_ctx; + return CSS_INVALID; + } + + 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_FILL_OPACITY); + + } else if (token->type == CSS_TOKEN_NUMBER) { + css_fixed num = 0; + size_t consumed = 0; + + num = css__number_from_lwc_string(token->idata, false, &consumed); + /* Invalid if there are trailing characters */ + if (consumed != lwc_string_length(token->idata)) { + *ctx = orig_ctx; + return CSS_INVALID; + } + + /* Clamp to range [0,1] */ + if (num < 0) + num = 0; + if (num > INTTOFIX(1)) + num = INTTOFIX(1); + + error = css__stylesheet_style_appendOPV(result, CSS_PROP_FILL_OPACITY, 0, FILL_OPACITY_SET); + if (error != CSS_OK) { + *ctx = orig_ctx; + return error; + } + + error = css__stylesheet_style_append(result, num); + } else { + error = CSS_INVALID; + } + + if (error != CSS_OK) + *ctx = orig_ctx; + + return error; +} + diff --git a/src/parse/properties/flex.c b/src/parse/properties/flex.c index d8f3848..a29309b 100644 --- a/src/parse/properties/flex.c +++ b/src/parse/properties/flex.c @@ -29,10 +29,10 @@ */ css_error css__parse_flex(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; css_error error; diff --git a/src/parse/properties/flex_flow.c b/src/parse/properties/flex_flow.c index 2d9c60a..a5e2926 100644 --- a/src/parse/properties/flex_flow.c +++ b/src/parse/properties/flex_flow.c @@ -29,10 +29,10 @@ */ css_error css__parse_flex_flow(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; css_error error; diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c index 7ce9701..2d95cd8 100644 --- a/src/parse/properties/font.c +++ b/src/parse/properties/font.c @@ -45,6 +45,7 @@ static inline uint32_t css__to_parse_unit(css_unit u) case CSS_UNIT_S: return UNIT_S; case CSS_UNIT_HZ: return UNIT_HZ; case CSS_UNIT_KHZ: return UNIT_KHZ; + case CSS_UNIT_CALC: assert(0); } return 0; @@ -224,12 +225,12 @@ static css_error parse_system_font(css_language *c, * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_font(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result) { const css_token *token; css_error error; - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; int prev_ctx; css_system_font system_font; diff --git a/src/parse/properties/font_family.c b/src/parse/properties/font_family.c index b309f45..2f8782e 100644 --- a/src/parse/properties/font_family.c +++ b/src/parse/properties/font_family.c @@ -99,10 +99,10 @@ static css_code_t font_family_value(css_language *c, const css_token *token, boo * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_font_family(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; css_error error; const css_token *token; bool match; diff --git a/src/parse/properties/font_weight.c b/src/parse/properties/font_weight.c index abe0b78..77ec9a1 100644 --- a/src/parse/properties/font_weight.c +++ b/src/parse/properties/font_weight.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_font_weight(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; css_error error; const css_token *token; uint8_t flags = 0; diff --git a/src/parse/properties/list_style.c b/src/parse/properties/list_style.c index e6e8eae..1cb373a 100644 --- a/src/parse/properties/list_style.c +++ b/src/parse/properties/list_style.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_list_style(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; css_error error; diff --git a/src/parse/properties/list_style_type.c b/src/parse/properties/list_style_type.c index fe66bcb..eb7f363 100644 --- a/src/parse/properties/list_style_type.c +++ b/src/parse/properties/list_style_type.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_list_style_type(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; css_error error; const css_token *ident; uint8_t flags = 0; diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c index 63adddc..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]; diff --git a/src/parse/properties/opacity.c b/src/parse/properties/opacity.c index 5d7b176..22acd76 100644 --- a/src/parse/properties/opacity.c +++ b/src/parse/properties/opacity.c @@ -27,10 +27,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_opacity(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; css_error error; const css_token *token; enum flag_value flag_value; diff --git a/src/parse/properties/outline.c b/src/parse/properties/outline.c index 8ceac8a..ac91ffd 100644 --- a/src/parse/properties/outline.c +++ b/src/parse/properties/outline.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_outline(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; css_error error; diff --git a/src/parse/properties/overflow.c b/src/parse/properties/overflow.c index 7bc1938..dbb373a 100644 --- a/src/parse/properties/overflow.c +++ b/src/parse/properties/overflow.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_overflow(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; css_error error1, error2 = CSS_OK; const css_token *token; enum flag_value flag_value; diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c index bef3607..a87ffa5 100644 --- a/src/parse/properties/padding.c +++ b/src/parse/properties/padding.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_padding(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; css_fixed side_length[4]; diff --git a/src/parse/properties/pause.c b/src/parse/properties/pause.c index b238d20..e558337 100644 --- a/src/parse/properties/pause.c +++ b/src/parse/properties/pause.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_pause(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; css_error error; const css_token *first_token; const css_token *token; diff --git a/src/parse/properties/play_during.c b/src/parse/properties/play_during.c index 54e048f..da7f236 100644 --- a/src/parse/properties/play_during.c +++ b/src/parse/properties/play_during.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_play_during(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; css_error error; const css_token *token; uint8_t flags = 0; diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c index 06524da..2cc849c 100644 --- a/src/parse/properties/properties.c +++ b/src/parse/properties/properties.c @@ -74,6 +74,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] = css__parse_display, css__parse_elevation, css__parse_empty_cells, + css__parse_fill_opacity, css__parse_flex, css__parse_flex_basis, css__parse_flex_direction, @@ -140,6 +141,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] = css__parse_speak, css__parse_speech_rate, css__parse_stress, + css__parse_stroke_opacity, css__parse_table_layout, css__parse_text_align, css__parse_text_decoration, @@ -261,6 +263,8 @@ const uint32_t property_unit_mask[CSS_N_PROPERTIES] = { [CSS_PROP_WORD_SPACING] = UNIT_MASK_WORD_SPACING, [CSS_PROP_Z_INDEX] = UNIT_MASK_Z_INDEX, [CSS_PROP_OPACITY] = UNIT_MASK_OPACITY, + [CSS_PROP_FILL_OPACITY] = UNIT_MASK_FILL_OPACITY, + [CSS_PROP_STROKE_OPACITY] = UNIT_MASK_STROKE_OPACITY, [CSS_PROP_BREAK_AFTER] = UNIT_MASK_BREAK_AFTER, [CSS_PROP_BREAK_BEFORE] = UNIT_MASK_BREAK_BEFORE, [CSS_PROP_BREAK_INSIDE] = UNIT_MASK_BREAK_INSIDE, diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen index 4fd8ba0..3452f81 100644 --- a/src/parse/properties/properties.gen +++ b/src/parse/properties/properties.gen @@ -6,6 +6,13 @@ #property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:) #property:CSS_PROP_ENUM WRAP: +# When a property takes a NUMBER and/or LENGTH_UNIT you may add calc() support: +# In the below, PROPERTY_FOO_CALC is the opcode enum for the set-but-calculated value bytecode. +# e.g. HEIGHT_SET (for a LENGTH_UNIT) would be HEIGHT_CALC here. +# CALC:( UNIT_??:PROPERTY_FOO_CALC CALC:) <-- When a default unit must be considered +# CALC:( NUMBER:PROPERTY_FOO_CALC CALC:) <-- When a number must be produced (not a dimension) +# CALC:( ANY:PROPERTY_FOO_CALC CALC:) <-- When a number or dimension is valid (e.g. line-height) + background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:) border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: INITIAL: REVERT: UNSET: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:) @@ -16,41 +23,41 @@ cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,C direction:CSS_PROP_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:) -display:CSS_PROP_DISPLAY IDENT:( INHERIT: INITIAL: REVERT: UNSET: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX IDENT:) +display:CSS_PROP_DISPLAY IDENT:( INHERIT: INITIAL: REVERT: UNSET: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX GRID:0,DISPLAY_GRID INLINE_GRID:0,DISPLAY_INLINE_GRID IDENT:) empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: INITIAL: REVERT: UNSET: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:) float:CSS_PROP_FLOAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:) -font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:) +font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:FONT_SIZE_CALC CALC:) font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:) font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:) -height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:) +height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:HEIGHT_CALC CALC:) -letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:) +letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:) CALC:( UNIT_PX:LETTER_SPACING_CALC CALC:) -line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:) +line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( ANY:LINE_HEIGHT_CALC CALC:) border_top:BORDER_SIDE_TOP WRAP:css__parse_border_side border_bottom:BORDER_SIDE_BOTTOM WRAP:css__parse_border_side border_left:BORDER_SIDE_LEFT WRAP:css__parse_border_side border_right:BORDER_SIDE_RIGHT WRAP:css__parse_border_side -max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:) +max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MAX_HEIGHT_CALC CALC:) -max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:) +max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MAX_WIDTH_CALC CALC:) -min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:) +min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MIN_HEIGHT_CALC CALC:) -min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:) +min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MIN_WIDTH_CALC CALC:) color:CSS_PROP_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLOR_SET #generic for padding_{top, bottom, left, right}.c -padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:) +padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:PADDING_CALC CALC:) padding_bottom:CSS_PROP_PADDING_BOTTOM WRAP:css__parse_padding_side padding_left:CSS_PROP_PADDING_LEFT WRAP:css__parse_padding_side @@ -59,7 +66,7 @@ padding_right:CSS_PROP_PADDING_RIGHT WRAP:css__parse_padding_side #generic for margin_{top, bottom, left, right}.c -margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:) +margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:) CALC:( UNIT_PX:MARGIN_CALC CALC:) margin_top:CSS_PROP_MARGIN_TOP WRAP:css__parse_margin_side margin_bottom:CSS_PROP_MARGIN_BOTTOM WRAP:css__parse_margin_side @@ -67,7 +74,7 @@ margin_left:CSS_PROP_MARGIN_LEFT WRAP:css__parse_margin_side margin_right:CSS_PROP_MARGIN_RIGHT WRAP:css__parse_margin_side #generic for {top, bottom, left, right}.c -side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:) +side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:) CALC:( UNIT_PX:BOTTOM_CALC CALC:) top:CSS_PROP_TOP WRAP:css__parse_side bottom:CSS_PROP_BOTTOM WRAP:css__parse_side @@ -76,7 +83,7 @@ right:CSS_PROP_RIGHT WRAP:css__parse_side #generic for border_{top, bottom, left, right}_width.c -border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:) +border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:BORDER_WIDTH_CALC CALC:) border_top_width:CSS_PROP_BORDER_TOP_WIDTH WRAP:css__parse_border_side_width border_bottom_width:CSS_PROP_BORDER_BOTTOM_WIDTH WRAP:css__parse_border_side_width @@ -120,7 +127,7 @@ list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: INITIAL: REVERT: UNS list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:) -orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:) +orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:ORPHANS_CALC CALC:) outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET @@ -133,24 +140,23 @@ overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE: overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:) - page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:) page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:) page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:) -pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:) +pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_S:PAUSE_AFTER_CALC CALC:) -pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:) +pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_S:PAUSE_BEFORE_CALC CALC:) -pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:) +pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_HZ:PITCH_CALC CALC:) -pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:) +pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:) CALC:( NUMBER:PITCH_RANGE_CALC CALC:) -position:CSS_PROP_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED IDENT:) +position:CSS_PROP_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED STICKY:0,POSITION_STICKY IDENT:) -richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:) +richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:) CALC:( NUMBER:RICHNESS_CALC CALC:) speak:CSS_PROP_SPEAK IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:) @@ -160,37 +166,35 @@ speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: INITIAL: REVERT: UNSET: DI speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: INITIAL: REVERT: UNSET: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:) -speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:) +speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:SPEECH_RATE_CALC CALC:) -stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:) +stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:) CALC:( NUMBER:STRESS_CALC CALC:) table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:) text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:) -text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:) +text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:) CALC:( UNIT_PX:TEXT_INDENT_CALC CALC:) text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: INITIAL: REVERT: UNSET: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:) unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:) -vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:) +vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:) CALC:( UNIT_PX:VERTICAL_ALIGN_CALC CALC:) visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:) -volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:) +volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:) CALC:( ANY:VOLUME_CALC CALC:) white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:) -widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:) - - -width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:) +widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:WIDOWS_CALC CALC:) -word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:) +width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:WIDTH_CALC CALC:) -z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:) +word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:) CALC:( UNIT_PX:WORD_SPACING_CALC CALC:) +z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:) CALC:( NUMBER:Z_INDEX_CALC CALC:) break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:) @@ -198,11 +202,11 @@ break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:) -column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:) +column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:COLUMN_COUNT_CALC CALC:) column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: INITIAL: REVERT: UNSET: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:) -column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:) +column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:) CALC:( UNIT_PX:COLUMN_GAP_CALC CALC:) column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLUMN_RULE_COLOR_SET @@ -212,7 +216,7 @@ column_rule_width:CSS_PROP_COLUMN_RULE_WIDTH WRAP:css__parse_border_side_width column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:) -column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:) +column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:) CALC:( UNIT_PX:COLUMN_WIDTH_CALC CALC:) writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: INITIAL: REVERT: UNSET: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:) @@ -224,16 +228,16 @@ align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETC align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:) -flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:) +flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:FLEX_BASIS_CALC CALC:) flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:) -flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:) +flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:FLEX_GROW_CALC CALC:) -flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:) +flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:FLEX_SHRINK_CALC CALC:) flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:) justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:) -order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORDER_SET NUMBER:) +order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORDER_SET NUMBER:) CALC:( NUMBER:ORDER_CALC CALC:) diff --git a/src/parse/properties/properties.h b/src/parse/properties/properties.h index 1e7f821..17b7f41 100644 --- a/src/parse/properties/properties.h +++ b/src/parse/properties/properties.h @@ -17,445 +17,451 @@ * Type of property handler function */ typedef css_error (*css_prop_handler)(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); extern const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP]; css_error css__parse_align_content(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_align_items(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_align_self(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_azimuth(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_background(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_background_attachment(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_background_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_background_image(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_background_position(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_background_repeat(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_bottom(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_bottom_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_bottom_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_bottom_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_collapse(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_left(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_left_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_left_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_left_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_right(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_right_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_right_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_right_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_spacing(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_top(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_top_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_top_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_top_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_border_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_bottom(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_box_sizing(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_break_after(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_break_before(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_break_inside(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_caption_side(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_clear(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_clip(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_columns(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_count(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_fill(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_gap(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_rule(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_rule_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_rule_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_rule_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_span(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_column_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_content(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_counter_increment(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_counter_reset(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_cue(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_cue_after(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_cue_before(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_cursor(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_direction(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_display(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_elevation(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_empty_cells(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, + css_style *result); +css_error css__parse_fill_opacity(css_language *c, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_flex(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_flex_basis(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_flex_direction(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_flex_flow(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_flex_grow(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_flex_shrink(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_flex_wrap(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_float(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_font(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_font_family(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_font_size(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_font_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_font_variant(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_font_weight(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_height(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_justify_content(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_left(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_letter_spacing(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_line_height(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_list_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_list_style_image(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_list_style_position(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_list_style_type(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_margin(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_margin_bottom(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_margin_left(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_margin_right(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_margin_top(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_max_height(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_max_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_min_height(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_min_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_opacity(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_order(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_orphans(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_outline(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_outline_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_outline_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_outline_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_overflow(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_overflow_x(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_overflow_y(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_padding(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_padding_bottom(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_padding_left(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_padding_right(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_padding_top(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_page_break_after(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_page_break_before(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_page_break_inside(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_pause(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_pause_after(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_pause_before(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_pitch_range(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_pitch(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_play_during(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_position(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_quotes(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_richness(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_right(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_speak_header(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_speak_numeral(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_speak_punctuation(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_speak(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_speech_rate(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_stress(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, + css_style *result); +css_error css__parse_stroke_opacity(css_language *c, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_table_layout(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_text_align(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_text_decoration(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_text_indent(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_text_transform(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_top(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_unicode_bidi(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_vertical_align(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_visibility(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_voice_family(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_volume(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_white_space(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_widows(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_word_spacing(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_writing_mode(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); css_error css__parse_z_index(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result); /** Mapping from property bytecode index to bytecode unit class mask. */ @@ -546,6 +552,8 @@ extern const uint32_t property_unit_mask[CSS_N_PROPERTIES]; #define UNIT_MASK_WORD_SPACING (UNIT_LENGTH) #define UNIT_MASK_Z_INDEX (0) #define UNIT_MASK_OPACITY (0) +#define UNIT_MASK_FILL_OPACITY (0) +#define UNIT_MASK_STROKE_OPACITY (0) #define UNIT_MASK_BREAK_AFTER (0) #define UNIT_MASK_BREAK_BEFORE (0) #define UNIT_MASK_BREAK_INSIDE (0) diff --git a/src/parse/properties/quotes.c b/src/parse/properties/quotes.c index b71158f..f5360a4 100644 --- a/src/parse/properties/quotes.c +++ b/src/parse/properties/quotes.c @@ -28,10 +28,10 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_quotes(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; css_error error = CSS_INVALID; const css_token *token; enum flag_value flag_value; diff --git a/src/parse/properties/stroke_opacity.c b/src/parse/properties/stroke_opacity.c new file mode 100644 index 0000000..7c10998 --- /dev/null +++ b/src/parse/properties/stroke_opacity.c @@ -0,0 +1,82 @@ +/* + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + */ + +#include <assert.h> +#include <string.h> + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "parse/properties/properties.h" +#include "parse/properties/utils.h" + +/** + * Parse stroke-opacity + * + * \param c Parsing context + * \param vector Vector of tokens to process + * \param ctx Pointer to vector iteration context + * \param result resulting style + * \return CSS_OK on success, + * CSS_NOMEM on memory exhaustion, + * CSS_INVALID if the input is not valid + * + * Post condition: \a *ctx is updated with the next token to process + * If the input is invalid, then \a *ctx remains unchanged. + */ +css_error css__parse_stroke_opacity(css_language *c, + const parserutils_vector *vector, int32_t *ctx, + css_style *result) +{ + int32_t orig_ctx = *ctx; + css_error error; + const css_token *token; + enum flag_value flag_value; + + token = parserutils_vector_iterate(vector, ctx); + if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) { + *ctx = orig_ctx; + return CSS_INVALID; + } + + 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_STROKE_OPACITY); + + } else if (token->type == CSS_TOKEN_NUMBER) { + css_fixed num = 0; + size_t consumed = 0; + + num = css__number_from_lwc_string(token->idata, false, &consumed); + /* Invalid if there are trailing characters */ + if (consumed != lwc_string_length(token->idata)) { + *ctx = orig_ctx; + return CSS_INVALID; + } + + /* Clamp to range [0,1] */ + if (num < 0) + num = 0; + if (num > INTTOFIX(1)) + num = INTTOFIX(1); + + error = css__stylesheet_style_appendOPV(result, CSS_PROP_STROKE_OPACITY, 0, STROKE_OPACITY_SET); + if (error != CSS_OK) { + *ctx = orig_ctx; + return error; + } + + error = css__stylesheet_style_append(result, num); + } else { + error = CSS_INVALID; + } + + if (error != CSS_OK) + *ctx = orig_ctx; + + return error; +} + diff --git a/src/parse/properties/text_decoration.c b/src/parse/properties/text_decoration.c index 1345b8e..acfda5f 100644 --- a/src/parse/properties/text_decoration.c +++ b/src/parse/properties/text_decoration.c @@ -28,14 +28,14 @@ * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_text_decoration(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; css_error error = CSS_INVALID; const css_token *token; enum flag_value flag_value; - bool match; + bool match = false; /* IDENT([ underline || overline || line-through || blink ]) * | IDENT (none, inherit) */ diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c index 1e184f8..5af1695 100644 --- a/src/parse/properties/utils.c +++ b/src/parse/properties/utils.c @@ -126,10 +126,10 @@ css_error css__parse_list_style_type_value(css_language *c, const css_token *ide * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result, enum border_side_e side) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; int prev_ctx; const css_token *token; css_error error = CSS_OK; @@ -366,10 +366,10 @@ static void HSL_to_RGB(css_fixed hue, css_fixed sat, css_fixed lit, uint8_t *r, * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_colour_specifier(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, uint16_t *value, uint32_t *result) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; const css_token *token; bool match; css_error error; @@ -913,11 +913,11 @@ css_error css__parse_hash_colour(lwc_string *data, uint32_t *result) * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_unit_specifier(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, uint32_t default_unit, css_fixed *length, uint32_t *unit) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; const css_token *token; css_fixed num; size_t consumed = 0; @@ -938,7 +938,7 @@ css_error css__parse_unit_specifier(css_language *c, if (token->type == CSS_TOKEN_DIMENSION) { size_t len = lwc_string_length(token->idata); const char *data = lwc_string_data(token->idata); - css_unit temp_unit = CSS_UNIT_PX; + uint32_t temp_unit = CSS_UNIT_PX; error = css__parse_unit_keyword(data + consumed, len - consumed, &temp_unit); @@ -947,7 +947,7 @@ css_error css__parse_unit_specifier(css_language *c, return error; } - *unit = (uint32_t) temp_unit; + *unit = temp_unit; } else if (token->type == CSS_TOKEN_NUMBER) { /* Non-zero values are permitted in quirks mode */ if (num != 0) { @@ -966,8 +966,8 @@ css_error css__parse_unit_specifier(css_language *c, * dimensions separated from their units by whitespace * (e.g. "0 px") */ - int temp_ctx = *ctx; - css_unit temp_unit; + int32_t temp_ctx = *ctx; + uint32_t temp_unit; consumeWhitespace(vector, &temp_ctx); @@ -981,7 +981,7 @@ css_error css__parse_unit_specifier(css_language *c, if (error == CSS_OK) { c->sheet->quirks_used = true; *ctx = temp_ctx; - *unit = (uint32_t) temp_unit; + *unit = temp_unit; } } } @@ -1103,7 +1103,7 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit) * The resulting string's reference is passed to the caller */ css_error css__ident_list_or_string_to_string(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool (*reserved)(css_language *c, const css_token *ident), lwc_string **result) { @@ -1141,11 +1141,11 @@ css_error css__ident_list_or_string_to_string(css_language *c, * The resulting string's reference is passed to the caller */ css_error css__ident_list_to_string(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool (*reserved)(css_language *c, const css_token *ident), lwc_string **result) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; const css_token *token; css_error error = CSS_OK; parserutils_buffer *buffer; @@ -1229,12 +1229,12 @@ cleanup: * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__comma_list_to_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool (*reserved)(css_language *c, const css_token *ident), css_code_t (*get_value)(css_language *c, const css_token *token, bool first), css_style *result) { - int orig_ctx = *ctx; + int32_t orig_ctx = *ctx; int prev_ctx = orig_ctx; const css_token *token; bool first = true; @@ -1333,3 +1333,364 @@ cleanup: return error; } + +/******************************************************************************/ + +/* CALC + * + * calc( <calc-sum> ) + * + * where + * <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]* + * + * where + * <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]* + * + * where + * <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> ) + * + * + * Once a calc() expression is parsed, it generates into the bytecode as + * an opV where the V is VALUE_IS_CALC, then a unit kind which is the + * expected resolved type for the calc, and a string index. The string is + * another kind of bytecode, essentially it's a sequence of stack machine + * operations which are one of the calc_opcodes enum. They are: + * + * * CALC_PUSH_NUMBER (N) + * - takes a css_fixed and pushes it onto the operand stack + * * CALC_PUSH_VALUE (V) + * - takes a css_fixed and a unit, and pushes them + * * CALC_{ADD,SUBTRACT,MULTIPLY,DIVIDE} (+ - * /) + * - pop two values, perform the operation, push the result + * * CALC_FINISH (=) + * - pop the top value from the stack and return it. + * + * As an example: + * + * calc(10px + (4rem / 2)) => + * V 10 px + * V 4 rem + * N 2 + * / + * + + * = + */ + +static css_error +css__parse_calc_sum(css_language *c, + enum css_properties_e property, + const parserutils_vector *vector, int *ctx, + parserutils_buffer *result); + +static css_error +css__parse_calc_number( + const parserutils_vector *vector, int *ctx, + parserutils_buffer *result) +{ + const css_token *token; + css_fixed num; + size_t consumed; + css_code_t push = CALC_PUSH_NUMBER; + + /* Consume the number token */ + token = parserutils_vector_iterate(vector, ctx); + if (token == NULL || token->type != CSS_TOKEN_NUMBER) { + return CSS_INVALID; + } + + num = css__number_from_string((const uint8_t *)lwc_string_data(token->idata), + lwc_string_length(token->idata), false, &consumed); + + if (consumed != lwc_string_length(token->idata)) { + return CSS_INVALID; + } + + return css_error_from_parserutils_error( + parserutils_buffer_appendv(result, 2, + &push, sizeof(push), + &num, sizeof(num) + ) + ); +} + +static css_error +css__parse_calc_value(css_language *c, + enum css_properties_e property, + const parserutils_vector *vector, int *ctx, + parserutils_buffer *result) +{ + css_error error; + int orig_ctx = *ctx; + const css_token *token; + + /* On entry, we are already pointing at the value to parse, so peek it */ + token = parserutils_vector_peek(vector, *ctx); + if (tokenIsChar(token, '(')) { + parserutils_vector_iterate(vector, ctx); + consumeWhitespace(vector, ctx); + error = css__parse_calc_sum(c, property, vector, ctx, result); + if (error != CSS_OK) { + return error; + } + + token = parserutils_vector_peek(vector, *ctx); + if (!tokenIsChar(token, ')')) { + return CSS_INVALID; + } + /* Consume the close-paren to complete this value */ + parserutils_vector_iterate(vector, ctx); + } else switch (token->type) { + case CSS_TOKEN_NUMBER: + error = css__parse_calc_number(vector, ctx, result); + if (error != CSS_OK) { + return error; + } + break; + case CSS_TOKEN_DIMENSION: /* Fall through */ + case CSS_TOKEN_PERCENTAGE: + { + css_fixed length = 0; + uint32_t unit = 0; + css_code_t push = CALC_PUSH_VALUE; + *ctx = orig_ctx; + + error = css__parse_unit_specifier(c, vector, ctx, UNIT_CALC_NUMBER, &length, &unit); + if (error != CSS_OK) { + *ctx = orig_ctx; + return error; + } + + if (!(unit & property_unit_mask[property])) { + /* This unit is not valid for this property. */ + return CSS_INVALID; + } + + error = css_error_from_parserutils_error( + parserutils_buffer_appendv(result, 3, + &push, sizeof(push), + &length, sizeof(length), + &unit, sizeof(unit) + ) + ); + + } + break; + + default: + error = CSS_INVALID; + break; + } + + consumeWhitespace(vector, ctx); + return error; +} + +/* Both this, and css_parse_calc_sum must stop when it encounters a close-paren. + * If it hasn't had any useful tokens before that, it's an error. It does not + * need to restore ctx before returning an error but it does need to ensure that + * the close paren has not been consumed + */ +static css_error +css__parse_calc_product(css_language *c, + enum css_properties_e property, + const parserutils_vector *vector, int *ctx, + parserutils_buffer *result) +{ + css_error error = CSS_OK; + const css_token *token; + css_code_t operator; + + /* First parse a value */ + error = css__parse_calc_value(c, property, vector, ctx, result); + if (error != CSS_OK) { + return error; + } + + do { + /* What is our next token? */ + token = parserutils_vector_peek(vector, *ctx); + if (token == NULL) { + error = CSS_INVALID; + break; + } else if ( + tokenIsChar(token, ')') || + tokenIsChar(token, '+') || + tokenIsChar(token, '-')) + break; + else if (tokenIsChar(token, '*')) + operator = CALC_MULTIPLY; + else if (tokenIsChar(token, '/')) + operator = CALC_DIVIDE; + else { + error = CSS_INVALID; + break; + } + /* Consume that * or / now */ + parserutils_vector_iterate(vector, ctx); + + consumeWhitespace(vector, ctx); + + if (operator == CALC_MULTIPLY) { + /* parse another value */ + error = css__parse_calc_value(c, property, vector, + ctx, result); + } else { + error = css__parse_calc_number(vector, ctx, result); + } + if (error != CSS_OK) + break; + + /* emit the multiplication/division operator */ + error = css_error_from_parserutils_error( + parserutils_buffer_append(result, (const uint8_t *)&operator, sizeof(operator)) + ); + } while (1); + /* We've fallen off, either we had an error or we're left with ')' */ + return error; +} + + +css_error +css__parse_calc_sum(css_language *c, + enum css_properties_e property, + const parserutils_vector *vector, int *ctx, + parserutils_buffer *result) +{ + css_error error = CSS_OK; + const css_token *token; + css_code_t operator; + + /* First parse a product */ + error = css__parse_calc_product(c, property, vector, ctx, result); + if (error != CSS_OK) { + return error; + } + + do { + /* What is our next token? */ + token = parserutils_vector_peek(vector, *ctx); + if (token == NULL) { + error = CSS_INVALID; + break; + } else if (tokenIsChar(token, ')')) + break; + else if (tokenIsChar(token, '+')) + operator = CALC_ADD; + else if (tokenIsChar(token, '-')) + operator = CALC_SUBTRACT; + else { + error = CSS_INVALID; + break; + } + /* Consume that + or - now */ + parserutils_vector_iterate(vector, ctx); + consumeWhitespace(vector, ctx); + + /* parse another product */ + error = css__parse_calc_product(c, property, vector, ctx, result); + if (error != CSS_OK) + break; + + /* emit the addition/subtraction operator */ + error = css_error_from_parserutils_error( + parserutils_buffer_append(result, (const uint8_t *)&operator, sizeof(operator)) + ); + } while (1); + /* We've fallen off, either we had an error or we're left with ')' */ + return error; +} + +/* Documented in utils.h */ +css_error css__parse_calc(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result, + css_code_t OPV, + uint32_t unit) +{ + int orig_ctx = *ctx; + const css_token *token; + css_error error = CSS_OK; + css_style *calc_style = NULL; + parserutils_buffer *calc_buffer = NULL; + lwc_string *calc_expr = NULL; + uint32_t expr_index = 0; + css_code_t finish = CALC_FINISH; + enum css_properties_e property = getOpcode(OPV); + + consumeWhitespace(vector, ctx); + + token = parserutils_vector_peek(vector, *ctx); + if (token == NULL) { + *ctx = orig_ctx; + return CSS_INVALID; + } + + if (parserutils_buffer_create(&calc_buffer) != PARSERUTILS_OK) { + /* Since &calc_buffer is valid, the only error case is NONMEM */ + *ctx = orig_ctx; + return CSS_NOMEM; + } + + error = css__stylesheet_style_create(c->sheet, &calc_style); + if (error != CSS_OK) + goto cleanup; + + error = css__stylesheet_style_append(calc_style, OPV); + if (error != CSS_OK) + goto cleanup; + + error = css__stylesheet_style_append(calc_style, (css_code_t) unit); + if (error != CSS_OK) + goto cleanup; + + error = css__parse_calc_sum(c, property, vector, ctx, calc_buffer); + if (error != CSS_OK) + goto cleanup; + + consumeWhitespace(vector, ctx); + token = parserutils_vector_peek(vector, *ctx); + if (!tokenIsChar(token, ')')) { + /* If we don't get a close-paren, give up now */ + error = CSS_INVALID; + goto cleanup; + } + + /* Append the indicator that the calc is finished */ + error = css_error_from_parserutils_error( + parserutils_buffer_append(calc_buffer, (const uint8_t *)&finish, sizeof(finish)) + ); + if (error != CSS_OK) + goto cleanup; + + /* Swallow that close paren */ + parserutils_vector_iterate(vector, ctx); + + /* Create the lwc string representing the calculation and store it in */ + error = css_error_from_lwc_error( + lwc_intern_string((const char *)calc_buffer->data, calc_buffer->length, &calc_expr) + ); + if (error != CSS_OK) + goto cleanup; + + /* This always takes ownership of calc_expr, so we should not use after this */ + error = css__stylesheet_string_add(calc_style->sheet, calc_expr, &expr_index); + if (error != CSS_OK) + goto cleanup; + + error = css__stylesheet_style_append(calc_style, + (css_code_t) expr_index); + if (error != CSS_OK) { + goto cleanup; + } + + error = css__stylesheet_merge_style(result, calc_style); +cleanup: + css__stylesheet_style_destroy(calc_style); + parserutils_buffer_destroy(calc_buffer); + /* We do not need to clean up calc_expr, it will never leak */ + if (error != CSS_OK) { + *ctx = orig_ctx; + } + + return error; +} diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h index 54a3fd1..a079f35 100644 --- a/src/parse/properties/utils.h +++ b/src/parse/properties/utils.h @@ -66,7 +66,7 @@ enum border_side_e { BORDER_SIDE_TOP = 0, BORDER_SIDE_RIGHT = 1, BORDER_SIDE_BOT * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result, enum border_side_e side); /** @@ -85,7 +85,7 @@ css_error css__parse_border_side(css_language *c, * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side_color(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result, enum css_properties_e op); /** @@ -104,7 +104,7 @@ css_error css__parse_border_side_color(css_language *c, * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result, enum css_properties_e op); @@ -124,7 +124,7 @@ css_error css__parse_border_side_style(css_language *c, * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side_width(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result, enum css_properties_e op); @@ -144,7 +144,7 @@ css_error css__parse_border_side_width(css_language *c, * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_side(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result, enum css_properties_e op); @@ -163,7 +163,7 @@ css_error css__parse_side(css_language *c, * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_margin_side(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result, enum css_properties_e op); /** @@ -181,7 +181,7 @@ css_error css__parse_margin_side(css_language *c, * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_padding_side(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, css_style *result, enum css_properties_e op); @@ -194,7 +194,7 @@ css_error css__parse_list_style_type_value(css_language *c, const css_token *token, uint16_t *value); css_error css__parse_colour_specifier(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, uint16_t *value, uint32_t *result); css_error css__parse_named_colour(css_language *c, lwc_string *data, @@ -203,7 +203,7 @@ css_error css__parse_named_colour(css_language *c, lwc_string *data, css_error css__parse_hash_colour(lwc_string *data, uint32_t *result); css_error css__parse_unit_specifier(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, uint32_t default_unit, css_fixed *length, uint32_t *unit); @@ -211,21 +211,45 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit); css_error css__ident_list_or_string_to_string(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool (*reserved)(css_language *c, const css_token *ident), lwc_string **result); css_error css__ident_list_to_string(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool (*reserved)(css_language *c, const css_token *ident), lwc_string **result); css_error css__comma_list_to_style(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int32_t *ctx, bool (*reserved)(css_language *c, const css_token *ident), css_code_t (*get_value)(css_language *c, const css_token *token, bool first), css_style *result); +/** + * Parse a CSS calc() invocation + * + * Calc can generate a number of kinds of units, so we have to tell the + * parser the kind of unit we're aiming for (e.g. UNIT_PX, UNIT_ANGLE, etc.) + * + * \param[in] c Parsing context + * \param[in] vector Vector of tokens to process + * \param[in] ctx Pointer to vector iteration context + * \param[in] result Pointer to location to receive resulting style + * \param[in] OPV The CSS property we are calculating for + * \param[in] unit The kind of unit which we want to come out of this calc() + * \return CSS_OK on success, + * CSS_NOMEM on memory exhaustion, + CSS_INVALID if the input is not valid + * + * Post condition: \a *ctx is updated with the next token to process + * If the input is invalid, then \a *ctx remains unchanged. + */ +css_error css__parse_calc(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result, + css_code_t OPV, + uint32_t unit); #endif diff --git a/src/parse/properties/voice_family.c b/src/parse/properties/voice_family.c index f62ba15..45d63f1 100644 --- a/src/parse/properties/voice_family.c +++ b/src/parse/properties/voice_family.c @@ -84,10 +84,10 @@ static css_code_t voice_family_value(css_language *c, const css_token *token, bo * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_voice_family(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; css_error error; const css_token *token; enum flag_value flag_value; diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c index dd579f1..ff4aab1 100644 --- a/src/parse/propstrings.c +++ b/src/parse/propstrings.c @@ -148,6 +148,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = { SMAP("display"), SMAP("elevation"), SMAP("empty-cells"), + SMAP("fill-opacity"), SMAP("flex"), SMAP("flex-basis"), SMAP("flex-direction"), @@ -214,6 +215,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = { SMAP("speak"), SMAP("speech-rate"), SMAP("stress"), + SMAP("stroke-opacity"), SMAP("table-layout"), SMAP("text-align"), SMAP("text-decoration"), @@ -486,6 +488,10 @@ const stringmap_entry stringmap[LAST_KNOWN] = { SMAP("or"), SMAP("only"), SMAP("infinite"), + SMAP("grid"), + SMAP("inline-grid"), + SMAP("sticky"), + SMAP("calc"), SMAP("aliceblue"), SMAP("antiquewhite"), diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h index df3bcf1..968d2b2 100644 --- a/src/parse/propstrings.h +++ b/src/parse/propstrings.h @@ -51,22 +51,23 @@ enum { COLUMN_COUNT, COLUMN_FILL, COLUMN_GAP, COLUMN_RULE, COLUMN_RULE_COLOR, COLUMN_RULE_STYLE, COLUMN_RULE_WIDTH, COLUMN_SPAN, COLUMN_WIDTH, CONTENT, COUNTER_INCREMENT, COUNTER_RESET, CUE, CUE_AFTER, CUE_BEFORE, - CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, FLEX, FLEX_BASIS, - FLEX_DIRECTION, FLEX_FLOW, FLEX_GROW, FLEX_SHRINK, FLEX_WRAP, - LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_VARIANT, - FONT_WEIGHT, HEIGHT, JUSTIFY_CONTENT, LEFT, LETTER_SPACING, LINE_HEIGHT, - LIST_STYLE, LIST_STYLE_IMAGE, LIST_STYLE_POSITION, LIST_STYLE_TYPE, - MARGIN, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, - MAX_HEIGHT, MAX_WIDTH, MIN_HEIGHT, MIN_WIDTH, OPACITY, ORDER, ORPHANS, - OUTLINE, OUTLINE_COLOR, OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, - OVERFLOW_X, OVERFLOW_Y, PADDING, PADDING_BOTTOM, PADDING_LEFT, - PADDING_RIGHT, PADDING_TOP, PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE, - PAGE_BREAK_INSIDE, PAUSE, PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH, - PLAY_DURING, POSITION, QUOTES, RICHNESS, RIGHT, SPEAK_HEADER, - SPEAK_NUMERAL, SPEAK_PUNCTUATION, SPEAK, SPEECH_RATE, STRESS, - TABLE_LAYOUT, TEXT_ALIGN, TEXT_DECORATION, TEXT_INDENT, TEXT_TRANSFORM, - TOP, UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME, - WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, WRITING_MODE, Z_INDEX, + CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, FILL_OPACITY, FLEX, + FLEX_BASIS, FLEX_DIRECTION, FLEX_FLOW, FLEX_GROW, FLEX_SHRINK, + FLEX_WRAP, LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, + FONT_VARIANT, FONT_WEIGHT, HEIGHT, JUSTIFY_CONTENT, LEFT, + LETTER_SPACING, LINE_HEIGHT, LIST_STYLE, LIST_STYLE_IMAGE, + LIST_STYLE_POSITION, LIST_STYLE_TYPE, MARGIN, MARGIN_BOTTOM, + MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, MAX_HEIGHT, MAX_WIDTH, + MIN_HEIGHT, MIN_WIDTH, OPACITY, ORDER, ORPHANS, OUTLINE, OUTLINE_COLOR, + OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, OVERFLOW_X, OVERFLOW_Y, PADDING, + PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT, PADDING_TOP, + PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE, PAGE_BREAK_INSIDE, PAUSE, + PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH, PLAY_DURING, POSITION, + QUOTES, RICHNESS, RIGHT, SPEAK_HEADER, SPEAK_NUMERAL, SPEAK_PUNCTUATION, + SPEAK, SPEECH_RATE, STRESS, STROKE_OPACITY, TABLE_LAYOUT, TEXT_ALIGN, + TEXT_DECORATION, TEXT_INDENT, TEXT_TRANSFORM, TOP, UNICODE_BIDI, + VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME, WHITE_SPACE, WIDOWS, + WIDTH, WORD_SPACING, WRITING_MODE, Z_INDEX, LAST_PROP = Z_INDEX, @@ -109,6 +110,7 @@ enum { VERTICAL_LR, CONTENT_BOX, BORDER_BOX, STRETCH, INLINE_FLEX, FLEX_START, FLEX_END, SPACE_BETWEEN, SPACE_AROUND, SPACE_EVENLY, ROW, ROW_REVERSE, COLUMN_REVERSE, WRAP_STRING, WRAP_REVERSE, AND, OR, ONLY, INFINITE, + GRID, INLINE_GRID, STICKY, CALC, /* Named colours */ FIRST_COLOUR, |