From d6e9f636d693fb129b373862d69ae85c861049f0 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 18 Sep 2023 10:36:48 -0400 Subject: Add support for SVG fill-opacity property https://www.w3.org/TR/SVGTiny12/painting.html#FillOpacityProperty This property is unique to SVG documents, but is otherwise analogous to the usual CSS "opacity" property. --- docs/Bytecode | 11 ++- include/libcss/computed.h | 4 ++ include/libcss/properties.h | 6 ++ src/bytecode/opcodes.h | 5 ++ src/parse/important.c | 5 ++ src/parse/properties/Makefile | 1 + src/parse/properties/fill_opacity.c | 82 ++++++++++++++++++++++ src/parse/properties/properties.c | 2 + src/parse/properties/properties.h | 4 ++ src/parse/propstrings.c | 1 + src/parse/propstrings.h | 33 ++++----- src/select/autogenerated_computed.h | 12 ++-- src/select/autogenerated_propget.h | 46 ++++++++++--- src/select/autogenerated_propset.h | 37 +++++++--- src/select/computed.c | 6 ++ src/select/dispatch.c | 4 ++ src/select/properties/Makefile | 1 + src/select/properties/fill_opacity.c | 73 ++++++++++++++++++++ src/select/properties/properties.h | 1 + src/select/select_config.py | 1 + test/data/parse2/INDEX | 1 + test/data/parse2/svg.dat | 39 +++++++++++ test/data/select/defaulting.dat | 13 ++++ test/data/select/tests1.dat | 127 +++++++++++++++++++++++++++++++++++ test/dump.h | 12 ++++ test/dump_computed.h | 24 +++++++ 26 files changed, 513 insertions(+), 38 deletions(-) create mode 100644 src/parse/properties/fill_opacity.c create mode 100644 src/select/properties/fill_opacity.c create mode 100644 test/data/parse2/svg.dat diff --git a/docs/Bytecode b/docs/Bytecode index 67450cd..65926a9 100644 --- a/docs/Bytecode +++ b/docs/Bytecode @@ -1383,4 +1383,13 @@ Opcodes bit 7 clear => Reserved for future expansion bits 0-6: MBZ -7c-3ff - Reserved for future expansion. +7c - fill-opacity + (14bits) : + bits 8-13: MBZ + bits 0-7 : + bit 7 set => number follows + bits 0-6: MBZ + bit 7 clear => Reserved for future expansion + bits 0-6: MBZ + +7d-3ff - Reserved for future expansion. diff --git a/include/libcss/computed.h b/include/libcss/computed.h index 30e369b..c3aa922 100644 --- a/include/libcss/computed.h +++ b/include/libcss/computed.h @@ -338,6 +338,10 @@ uint8_t css_computed_opacity( const css_computed_style *style, css_fixed *opacity); +uint8_t css_computed_fill_opacity( + const css_computed_style *style, + css_fixed *fill_opacity); + uint8_t css_computed_text_transform( const css_computed_style *style); diff --git a/include/libcss/properties.h b/include/libcss/properties.h index af0a1f5..07a71aa 100644 --- a/include/libcss/properties.h +++ b/include/libcss/properties.h @@ -138,6 +138,7 @@ enum css_properties_e { CSS_PROP_FLEX_WRAP = 0x079, CSS_PROP_JUSTIFY_CONTENT = 0x07a, CSS_PROP_ORDER = 0x07b, + CSS_PROP_FILL_OPACITY = 0x07c, CSS_N_PROPERTIES }; @@ -451,6 +452,11 @@ enum css_empty_cells_e { CSS_EMPTY_CELLS_HIDE = 0x2 }; +enum css_fill_opacity_e { + CSS_FILL_OPACITY_INHERIT = 0x0, + CSS_FILL_OPACITY_SET = 0x1 +}; + enum css_flex_basis_e { CSS_FLEX_BASIS_INHERIT = 0x0, CSS_FLEX_BASIS_SET = 0x1, diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h index 8bc05b4..df062af 100644 --- a/src/bytecode/opcodes.h +++ b/src/bytecode/opcodes.h @@ -351,6 +351,11 @@ enum op_empty_cells { EMPTY_CELLS_HIDE = 0x0001 }; +enum op_fill_opacity { + FILL_OPACITY_SET = 0x0080 +}; + + enum op_flex_basis { FLEX_BASIS_AUTO = 0x0000, FLEX_BASIS_CONTENT = 0x0001, diff --git a/src/parse/important.c b/src/parse/important.c index f4aef00..6e2590e 100644 --- a/src/parse/important.c +++ b/src/parse/important.c @@ -346,6 +346,11 @@ 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_ORDER: if (value == ORDER_SET) offset++; /* value */ diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile index 6461dda..fc7ac76 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 \ 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 +#include + +#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/properties.c b/src/parse/properties/properties.c index 06524da..c1187ca 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, @@ -261,6 +262,7 @@ 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_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.h b/src/parse/properties/properties.h index 83aa32b..25ef60e 100644 --- a/src/parse/properties/properties.h +++ b/src/parse/properties/properties.h @@ -208,6 +208,9 @@ css_error css__parse_elevation(css_language *c, css_error css__parse_empty_cells(css_language *c, 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, int32_t *ctx, css_style *result); @@ -546,6 +549,7 @@ 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_BREAK_AFTER (0) #define UNIT_MASK_BREAK_BEFORE (0) #define UNIT_MASK_BREAK_INSIDE (0) diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c index 786a3b7..62c149a 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"), diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h index 6d6dd49..2725df2 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, 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, diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h index c65cf98..e5d05c7 100644 --- a/src/select/autogenerated_computed.h +++ b/src/select/autogenerated_computed.h @@ -52,6 +52,7 @@ struct css_computed_style_i { * direction 2 * display 5 * empty_cells 2 + * fill_opacity 1 4 * flex_basis 2 + 5 4 * flex_direction 3 * flex_grow 1 4 @@ -140,9 +141,9 @@ struct css_computed_style_i { * quotes 1 sizeof(ptr) * * --- --- --- - * 462 bits 228 + 8sizeof(ptr) bytes + * 463 bits 232 + 8sizeof(ptr) bytes * =================== - * 286 + 8sizeof(ptr) bytes + * 290 + 8sizeof(ptr) bytes * * Bit allocations: * @@ -197,10 +198,10 @@ struct css_computed_style_i { * overflow_y; overflow_x; justify_content; font_family; flex_direction; clear; * quotes * - * 14 bbaaorplfecuCk.................. + * 14 bbaaorplfeicuCk................. * background_color; background_attachment; orphans; order; opacity; - * list_style_image; flex_shrink; flex_grow; counter_reset; counter_increment; - * color; background_image + * list_style_image; flex_shrink; flex_grow; fill_opacity; counter_reset; + * counter_increment; color; background_image */ uint32_t bits[15]; @@ -229,6 +230,7 @@ struct css_computed_style_i { css_color column_rule_color; css_fixed column_rule_width; css_fixed column_width; + css_fixed fill_opacity; css_fixed flex_basis; css_fixed flex_grow; css_fixed flex_shrink; diff --git a/src/select/autogenerated_propget.h b/src/select/autogenerated_propget.h index 6c958aa..206c7ee 100644 --- a/src/select/autogenerated_propget.h +++ b/src/select/autogenerated_propget.h @@ -140,8 +140,8 @@ static inline uint8_t get_background_color(const css_computed_style *style, #undef BACKGROUND_COLOR_MASK #define BACKGROUND_IMAGE_INDEX 14 -#define BACKGROUND_IMAGE_SHIFT 18 -#define BACKGROUND_IMAGE_MASK 0x40000 +#define BACKGROUND_IMAGE_SHIFT 17 +#define BACKGROUND_IMAGE_MASK 0x20000 static inline uint8_t get_background_image_bits(const css_computed_style *style) { uint32_t bits = style->i.bits[BACKGROUND_IMAGE_INDEX]; @@ -878,8 +878,8 @@ static inline uint8_t get_clip( #undef CLIP_MASK #define COLOR_INDEX 14 -#define COLOR_SHIFT 19 -#define COLOR_MASK 0x80000 +#define COLOR_SHIFT 18 +#define COLOR_MASK 0x40000 static inline uint8_t get_color_bits(const css_computed_style *style) { uint32_t bits = style->i.bits[COLOR_INDEX]; @@ -1166,8 +1166,8 @@ static inline uint8_t get_content(const css_computed_style *style, const #undef CONTENT_MASK #define COUNTER_INCREMENT_INDEX 14 -#define COUNTER_INCREMENT_SHIFT 20 -#define COUNTER_INCREMENT_MASK 0x100000 +#define COUNTER_INCREMENT_SHIFT 19 +#define COUNTER_INCREMENT_MASK 0x80000 static inline uint8_t get_counter_increment_bits(const css_computed_style *style) { @@ -1195,8 +1195,8 @@ static inline uint8_t get_counter_increment(const css_computed_style *style, #undef COUNTER_INCREMENT_MASK #define COUNTER_RESET_INDEX 14 -#define COUNTER_RESET_SHIFT 21 -#define COUNTER_RESET_MASK 0x200000 +#define COUNTER_RESET_SHIFT 20 +#define COUNTER_RESET_MASK 0x100000 static inline uint8_t get_counter_reset_bits(const css_computed_style *style) { uint32_t bits = style->i.bits[COUNTER_RESET_INDEX]; @@ -1328,6 +1328,36 @@ static inline uint8_t get_empty_cells(const css_computed_style *style) #undef EMPTY_CELLS_SHIFT #undef EMPTY_CELLS_MASK +#define FILL_OPACITY_INDEX 14 +#define FILL_OPACITY_SHIFT 21 +#define FILL_OPACITY_MASK 0x200000 +static inline uint8_t get_fill_opacity_bits(const css_computed_style *style) +{ + uint32_t bits = style->i.bits[FILL_OPACITY_INDEX]; + bits &= FILL_OPACITY_MASK; + bits >>= FILL_OPACITY_SHIFT; + + /* 1bit: t : type */ + return (bits & 0x1); +} +static inline uint8_t get_fill_opacity(const css_computed_style *style, + css_fixed *fixed) +{ + uint32_t bits = style->i.bits[FILL_OPACITY_INDEX]; + bits &= FILL_OPACITY_MASK; + bits >>= FILL_OPACITY_SHIFT; + + /* 1bit: t : type */ + if ((bits & 0x1) == CSS_FILL_OPACITY_SET) { + *fixed = style->i.fill_opacity; + } + + return (bits & 0x1); +} +#undef FILL_OPACITY_INDEX +#undef FILL_OPACITY_SHIFT +#undef FILL_OPACITY_MASK + #define FLEX_BASIS_INDEX 7 #define FLEX_BASIS_SHIFT 4 #define FLEX_BASIS_MASK 0x7f0 diff --git a/src/select/autogenerated_propset.h b/src/select/autogenerated_propset.h index 71d1596..850545c 100644 --- a/src/select/autogenerated_propset.h +++ b/src/select/autogenerated_propset.h @@ -104,8 +104,8 @@ static inline css_error set_background_color(css_computed_style *style, uint8_t #undef BACKGROUND_COLOR_MASK #define BACKGROUND_IMAGE_INDEX 14 -#define BACKGROUND_IMAGE_SHIFT 18 -#define BACKGROUND_IMAGE_MASK 0x40000 +#define BACKGROUND_IMAGE_SHIFT 17 +#define BACKGROUND_IMAGE_MASK 0x20000 static inline css_error set_background_image(css_computed_style *style, uint8_t type, lwc_string *string) @@ -639,8 +639,8 @@ static inline css_error set_clip( #undef CLIP_MASK #define COLOR_INDEX 14 -#define COLOR_SHIFT 19 -#define COLOR_MASK 0x80000 +#define COLOR_SHIFT 18 +#define COLOR_MASK 0x40000 static inline css_error set_color(css_computed_style *style, uint8_t type, css_color color) @@ -902,8 +902,8 @@ static inline css_error set_content( #undef CONTENT_MASK #define COUNTER_INCREMENT_INDEX 14 -#define COUNTER_INCREMENT_SHIFT 20 -#define COUNTER_INCREMENT_MASK 0x100000 +#define COUNTER_INCREMENT_SHIFT 19 +#define COUNTER_INCREMENT_MASK 0x80000 static inline css_error set_counter_increment(css_computed_style *style, uint8_t type, css_computed_counter *counter_arr) @@ -938,8 +938,8 @@ static inline css_error set_counter_increment(css_computed_style *style, #undef COUNTER_INCREMENT_MASK #define COUNTER_RESET_INDEX 14 -#define COUNTER_RESET_SHIFT 21 -#define COUNTER_RESET_MASK 0x200000 +#define COUNTER_RESET_SHIFT 20 +#define COUNTER_RESET_MASK 0x100000 static inline css_error set_counter_reset(css_computed_style *style, uint8_t type, css_computed_counter *counter_arr) @@ -1063,6 +1063,27 @@ static inline css_error set_empty_cells(css_computed_style *style, uint8_t type) #undef EMPTY_CELLS_SHIFT #undef EMPTY_CELLS_MASK +#define FILL_OPACITY_INDEX 14 +#define FILL_OPACITY_SHIFT 21 +#define FILL_OPACITY_MASK 0x200000 + +static inline css_error set_fill_opacity(css_computed_style *style, uint8_t + type, css_fixed fixed) +{ + uint32_t *bits = &style->i.bits[FILL_OPACITY_INDEX]; + + /* 1bit: t : type */ + *bits = (*bits & ~FILL_OPACITY_MASK) | (((uint32_t)type & 0x1) << + FILL_OPACITY_SHIFT); + + style->i.fill_opacity = fixed; + + return CSS_OK; +} +#undef FILL_OPACITY_INDEX +#undef FILL_OPACITY_SHIFT +#undef FILL_OPACITY_MASK + #define FLEX_BASIS_INDEX 7 #define FLEX_BASIS_SHIFT 4 #define FLEX_BASIS_MASK 0x7f0 diff --git a/src/select/computed.c b/src/select/computed.c index c257f17..a0c92bb 100644 --- a/src/select/computed.c +++ b/src/select/computed.c @@ -810,6 +810,12 @@ uint8_t css_computed_opacity(const css_computed_style *style, return get_opacity(style, opacity); } +uint8_t css_computed_fill_opacity(const css_computed_style *style, + css_fixed *fill_opacity) +{ + return get_fill_opacity(style, fill_opacity); +} + uint8_t css_computed_text_transform(const css_computed_style *style) { return get_text_transform(style); diff --git a/src/select/dispatch.c b/src/select/dispatch.c index a6c868d..c8efa44 100644 --- a/src/select/dispatch.c +++ b/src/select/dispatch.c @@ -514,5 +514,9 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = { { PROPERTY_FUNCS(order), 0, + }, + { + PROPERTY_FUNCS(fill_opacity), + 0, } }; diff --git a/src/select/properties/Makefile b/src/select/properties/Makefile index 6c6cf84..2e10f4a 100644 --- a/src/select/properties/Makefile +++ b/src/select/properties/Makefile @@ -50,6 +50,7 @@ direction.c \ display.c \ elevation.c \ empty_cells.c \ +fill_opacity.c \ flex_basis.c \ flex_direction.c \ flex_grow.c \ diff --git a/src/select/properties/fill_opacity.c b/src/select/properties/fill_opacity.c new file mode 100644 index 0000000..af0b52b --- /dev/null +++ b/src/select/properties/fill_opacity.c @@ -0,0 +1,73 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_fill_opacity(uint32_t opv, css_style *style, + css_select_state *state) +{ + uint16_t value = CSS_FILL_OPACITY_INHERIT; + css_fixed fill_opacity = 0; + + if (hasFlagValue(opv) == false) { + value = CSS_FILL_OPACITY_SET; + + fill_opacity = *((css_fixed *) style->bytecode); + advance_bytecode(style, sizeof(fill_opacity)); + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + getFlagValue(opv))) { + return set_fill_opacity(state->computed, value, fill_opacity); + } + + return CSS_OK; +} + +css_error css__set_fill_opacity_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_fill_opacity(style, hint->status, hint->data.fixed); +} + +css_error css__initial_fill_opacity(css_select_state *state) +{ + return set_fill_opacity(state->computed, CSS_FILL_OPACITY_SET, INTTOFIX(1)); +} + +css_error css__copy_fill_opacity( + const css_computed_style *from, + css_computed_style *to) +{ + css_fixed fill_opacity = 0; + uint8_t type = get_fill_opacity(from, &fill_opacity); + + if (from == to) { + return CSS_OK; + } + + return set_fill_opacity(to, type, fill_opacity); +} + +css_error css__compose_fill_opacity(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + css_fixed fill_opacity = 0; + uint8_t type = get_fill_opacity(child, &fill_opacity); + + return css__copy_fill_opacity( + type == CSS_FILL_OPACITY_INHERIT ? parent : child, + result); +} + diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h index be31d0b..fba5be8 100644 --- a/src/select/properties/properties.h +++ b/src/select/properties/properties.h @@ -72,6 +72,7 @@ PROPERTY_FUNCS(direction); PROPERTY_FUNCS(display); PROPERTY_FUNCS(elevation); PROPERTY_FUNCS(empty_cells); +PROPERTY_FUNCS(fill_opacity); PROPERTY_FUNCS(flex_basis); PROPERTY_FUNCS(flex_direction); PROPERTY_FUNCS(flex_grow); diff --git a/src/select/select_config.py b/src/select/select_config.py index fd9e765..5feed6c 100644 --- a/src/select/select_config.py +++ b/src/select/select_config.py @@ -95,6 +95,7 @@ style = { ('min_height', 2, 'length', 'CSS_MIN_HEIGHT_SET'), ('min_width', 2, 'length', 'CSS_MIN_WIDTH_SET'), ('opacity', 1, 'fixed', 'CSS_OPACITY_SET'), + ('fill_opacity', 1, 'fixed', 'CSS_FILL_OPACITY_SET'), ('order', 1, 'integer', 'CSS_ORDER_SET'), ('padding_top', 1, 'length', 'CSS_PADDING_SET'), ('padding_right', 1, 'length', 'CSS_PADDING_SET'), diff --git a/test/data/parse2/INDEX b/test/data/parse2/INDEX index e4a369c..95534f6 100644 --- a/test/data/parse2/INDEX +++ b/test/data/parse2/INDEX @@ -24,3 +24,4 @@ multicol.dat Multi-column layout property tests flexbox.dat Flexbox properties and shorthands tests units.dat Length unit tests dodgy-media-block.dat Media block with incomplete ruleset +svg.dat SVG property tests diff --git a/test/data/parse2/svg.dat b/test/data/parse2/svg.dat new file mode 100644 index 0000000..19839c7 --- /dev/null +++ b/test/data/parse2/svg.dat @@ -0,0 +1,39 @@ +#data +* { fill-opacity: inherit; } +#errors +#expected +| * +| fill-opacity: inherit +#reset + +#data +* { fill-opacity: revert; } +#errors +#expected +| * +| fill-opacity: revert +#reset + +#data +* { fill-opacity: 0.867; } +#errors +#expected +| * +| fill-opacity: 0.867 +#reset + +#data +* { fill-opacity: -0.5; } +#errors +#expected +| * +| fill-opacity: 0 +#reset + +#data +* { fill-opacity: 5; } +#errors +#expected +| * +| fill-opacity: 1 +#reset diff --git a/test/data/select/defaulting.dat b/test/data/select/defaulting.dat index 4242e30..cce46ac 100644 --- a/test/data/select/defaulting.dat +++ b/test/data/select/defaulting.dat @@ -50,6 +50,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -161,6 +162,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -273,6 +275,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -386,6 +389,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -495,6 +499,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -608,6 +613,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -720,6 +726,7 @@ cursor: auto direction: ltr display: table-cell empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -832,6 +839,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -944,6 +952,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1053,6 +1062,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1165,6 +1175,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1279,6 +1290,7 @@ cursor: auto direction: ltr display: inline-block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1393,6 +1405,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat index 997e88e..f620d5f 100644 --- a/test/data/select/tests1.dat +++ b/test/data/select/tests1.dat @@ -52,6 +52,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -163,6 +164,7 @@ cursor: auto direction: ltr display: inline-grid empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -277,6 +279,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -395,6 +398,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -514,6 +518,7 @@ cursor: auto direction: ltr display: table-cell empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -633,6 +638,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -752,6 +758,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -861,6 +868,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -971,6 +979,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1081,6 +1090,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1190,6 +1200,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1304,6 +1315,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1418,6 +1430,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1533,6 +1546,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1651,6 +1665,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1768,6 +1783,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -1891,6 +1907,7 @@ cursor: auto direction: ltr display: table-row empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -2014,6 +2031,7 @@ cursor: auto direction: ltr display: table-cell empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -2137,6 +2155,7 @@ cursor: auto direction: ltr display: table-cell empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -2264,6 +2283,7 @@ cursor: auto direction: ltr display: table-cell empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -2390,6 +2410,7 @@ cursor: auto direction: ltr display: table-cell empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -2514,6 +2535,7 @@ cursor: auto direction: ltr display: table-cell empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -2637,6 +2659,7 @@ cursor: auto direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -2760,6 +2783,7 @@ cursor: auto direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -2883,6 +2907,7 @@ cursor: auto direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3006,6 +3031,7 @@ cursor: crosshair direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3129,6 +3155,7 @@ cursor: default direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3252,6 +3279,7 @@ cursor: pointer direction: ltr display: table empty-cells: hide +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3375,6 +3403,7 @@ cursor: move direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3498,6 +3527,7 @@ cursor: e-resize direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3621,6 +3651,7 @@ cursor: ne-resize direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3744,6 +3775,7 @@ cursor: nw-resize direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3867,6 +3899,7 @@ cursor: n-resize direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -3990,6 +4023,7 @@ cursor: se-resize direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -4113,6 +4147,7 @@ cursor: sw-resize direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -4236,6 +4271,7 @@ cursor: s-resize direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -4359,6 +4395,7 @@ cursor: w-resize direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -4482,6 +4519,7 @@ cursor: text direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -4605,6 +4643,7 @@ cursor: wait direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -4728,6 +4767,7 @@ cursor: help direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -4851,6 +4891,7 @@ cursor: progress direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -4974,6 +5015,7 @@ cursor: url('sonic-team.png') pointer direction: ltr display: table empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5090,6 +5132,7 @@ cursor: auto direction: ltr display: none empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5206,6 +5249,7 @@ cursor: auto direction: ltr display: none empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5322,6 +5366,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5435,6 +5480,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5549,6 +5595,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5663,6 +5710,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5777,6 +5825,7 @@ cursor: auto direction: ltr display: block empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5887,6 +5936,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -5998,6 +6048,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6108,6 +6159,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6218,6 +6270,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6328,6 +6381,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6438,6 +6492,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6548,6 +6603,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6660,6 +6716,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6770,6 +6827,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6880,6 +6938,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -6991,6 +7050,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -7101,6 +7161,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 10px flex-direction: row flex-grow: 2.000 @@ -7211,6 +7272,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 1.000 @@ -7321,6 +7383,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -7431,6 +7494,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 0px flex-direction: row flex-grow: 0.000 @@ -7541,6 +7605,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 0px flex-direction: row flex-grow: 0.000 @@ -7651,6 +7716,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 0px flex-direction: row flex-grow: 0.000 @@ -7761,6 +7827,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 0px flex-direction: row flex-grow: 3.000 @@ -7870,6 +7937,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 3px flex-direction: row flex-grow: 0.000 @@ -7979,6 +8047,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 3em flex-direction: row flex-grow: 2.000 @@ -8088,6 +8157,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 0px flex-direction: row flex-grow: 20.000 @@ -8199,6 +8269,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 0px flex-direction: row flex-grow: 3.000 @@ -8310,6 +8381,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 3px flex-direction: row flex-grow: 3.000 @@ -8419,6 +8491,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 0px flex-direction: row flex-grow: 0.000 @@ -8530,6 +8603,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -8641,6 +8715,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 3% flex-direction: row flex-grow: 3.000 @@ -8752,6 +8827,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 3% flex-direction: row flex-grow: 3.000 @@ -8861,6 +8937,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -8970,6 +9047,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -9079,6 +9157,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -9188,6 +9267,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -9297,6 +9377,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: column flex-grow: 0.000 @@ -9406,6 +9487,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row-reverse flex-grow: 0.000 @@ -9515,6 +9597,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: column-reverse flex-grow: 0.000 @@ -9624,6 +9707,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: column-reverse flex-grow: 0.000 @@ -9735,6 +9819,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: column flex-grow: 0.000 @@ -9846,6 +9931,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row-reverse flex-grow: 0.000 @@ -9955,6 +10041,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 4.500em flex-direction: row flex-grow: 2.370 @@ -10064,6 +10151,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -10173,6 +10261,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -10282,6 +10371,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -10391,6 +10481,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -10500,6 +10591,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -10609,6 +10701,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -10720,6 +10813,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -10831,6 +10925,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -10940,6 +11035,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -11049,6 +11145,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -11158,6 +11255,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -11269,6 +11367,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -11378,6 +11477,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 4.500em flex-direction: column flex-grow: 2.300 @@ -11489,6 +11589,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: 4.500em flex-direction: column flex-grow: 2.300 @@ -11598,6 +11699,7 @@ cursor: auto direction: ltr display: flex empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -11707,6 +11809,7 @@ cursor: auto direction: ltr display: inline-flex empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -11816,6 +11919,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -11925,6 +12029,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12034,6 +12139,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12143,6 +12249,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12252,6 +12359,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12361,6 +12469,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12470,6 +12579,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12579,6 +12689,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12688,6 +12799,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12797,6 +12909,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -12906,6 +13019,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13015,6 +13129,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13124,6 +13239,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13233,6 +13349,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13342,6 +13459,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13451,6 +13569,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13560,6 +13679,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13669,6 +13789,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13778,6 +13899,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13887,6 +14009,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -13996,6 +14119,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -14124,6 +14248,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -14233,6 +14358,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 @@ -14342,6 +14468,7 @@ cursor: auto direction: ltr display: inline empty-cells: show +fill-opacity: 1.000 flex-basis: auto flex-direction: row flex-grow: 0.000 diff --git a/test/dump.h b/test/dump.h index f585788..f52c9cc 100644 --- a/test/dump.h +++ b/test/dump.h @@ -491,6 +491,7 @@ static const char *opcode_names[] = { "flex-wrap", "justify-content", "order", + "fill-opacity", }; static void dump_css_fixed(css_fixed f, char **ptr) @@ -1819,6 +1820,17 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth) break; } break; + case CSS_PROP_FILL_OPACITY: + switch (value) { + case FILL_OPACITY_SET: + { + css_fixed val = *((css_fixed *) bytecode); + ADVANCE(sizeof(val)); + dump_number(val, ptr); + } + break; + } + break; case CSS_PROP_FLEX_BASIS: switch (value) { case FLEX_BASIS_AUTO: diff --git a/test/dump_computed.h b/test/dump_computed.h index 2ce7849..55d9f85 100644 --- a/test/dump_computed.h +++ b/test/dump_computed.h @@ -1635,6 +1635,30 @@ static void dump_computed_style(const css_computed_style *style, char *buf, ptr += wrote; *len -= wrote; + /* fill-opacity */ + val = css_computed_fill_opacity(style, &len1); + switch (val) { + case CSS_FILL_OPACITY_INHERIT: + wrote = snprintf(ptr, *len, "fill-opacity: inherit\n"); + break; + case CSS_FILL_OPACITY_SET: + wrote = snprintf(ptr, *len, "fill-opacity: "); + ptr += wrote; + *len -= wrote; + + wrote = dump_css_fixed(len1, ptr, *len); + ptr += wrote; + *len -= wrote; + + wrote = snprintf(ptr, *len, "\n"); + break; + default: + wrote = 0; + break; + } + ptr += wrote; + *len -= wrote; + /* flex-basis */ val = css_computed_flex_basis(style, &len1, &unit1); switch (val) { -- cgit v1.2.3