summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Orlitzky <michael@orlitzky.com>2023-09-18 15:04:24 -0400
committerJohn-Mark Bell <jmb@netsurf-browser.org>2023-10-01 10:47:44 +0100
commit76ccb5b60d67b5ff96d48bfe12aa04787c5b1f99 (patch)
treeae7fad2975d23e4c0c307117bd2fb0617e244802
parentd6e9f636d693fb129b373862d69ae85c861049f0 (diff)
downloadlibcss-76ccb5b60d67b5ff96d48bfe12aa04787c5b1f99.tar.gz
libcss-76ccb5b60d67b5ff96d48bfe12aa04787c5b1f99.tar.bz2
Add support for SVG stroke-opacity property
https://www.w3.org/TR/SVGTiny12/painting.html#StrokeOpacityProperty This property is unique to SVG documents, but is otherwise analogous to the usual CSS "opacity" property (and the recently-added SVG fill-opacity property).
-rw-r--r--docs/Bytecode11
-rw-r--r--include/libcss/computed.h4
-rw-r--r--include/libcss/properties.h6
-rw-r--r--src/bytecode/opcodes.h4
-rw-r--r--src/parse/important.c5
-rw-r--r--src/parse/properties/Makefile1
-rw-r--r--src/parse/properties/properties.c2
-rw-r--r--src/parse/properties/properties.h4
-rw-r--r--src/parse/properties/stroke_opacity.c82
-rw-r--r--src/parse/propstrings.c1
-rw-r--r--src/parse/propstrings.h8
-rw-r--r--src/select/autogenerated_computed.h14
-rw-r--r--src/select/autogenerated_propget.h80
-rw-r--r--src/select/autogenerated_propset.h71
-rw-r--r--src/select/computed.c6
-rw-r--r--src/select/dispatch.c4
-rw-r--r--src/select/properties/Makefile1
-rw-r--r--src/select/properties/properties.h1
-rw-r--r--src/select/properties/stroke_opacity.c73
-rw-r--r--src/select/select_config.py1
-rw-r--r--test/data/parse2/svg.dat40
-rw-r--r--test/data/select/defaulting.dat13
-rw-r--r--test/data/select/tests1.dat127
-rw-r--r--test/dump.h12
-rw-r--r--test/dump_computed.h24
25 files changed, 534 insertions, 61 deletions
diff --git a/docs/Bytecode b/docs/Bytecode
index 65926a9..272fd07 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -1392,4 +1392,13 @@ Opcodes
bit 7 clear => Reserved for future expansion
bits 0-6: MBZ
-7d-3ff - Reserved for future expansion.
+7d - stroke-opacity
+ <value> (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
+
+7e-3ff - Reserved for future expansion.
diff --git a/include/libcss/computed.h b/include/libcss/computed.h
index c3aa922..5d9cc7e 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -342,6 +342,10 @@ uint8_t css_computed_fill_opacity(
const css_computed_style *style,
css_fixed *fill_opacity);
+uint8_t css_computed_stroke_opacity(
+ const css_computed_style *style,
+ css_fixed *stroke_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 07a71aa..cb1f0ff 100644
--- a/include/libcss/properties.h
+++ b/include/libcss/properties.h
@@ -139,6 +139,7 @@ enum css_properties_e {
CSS_PROP_JUSTIFY_CONTENT = 0x07a,
CSS_PROP_ORDER = 0x07b,
CSS_PROP_FILL_OPACITY = 0x07c,
+ CSS_PROP_STROKE_OPACITY = 0x07d,
CSS_N_PROPERTIES
};
@@ -786,6 +787,11 @@ enum css_right_e {
CSS_RIGHT_AUTO = 0x2
};
+enum css_stroke_opacity_e {
+ CSS_STROKE_OPACITY_INHERIT = 0x0,
+ CSS_STROKE_OPACITY_SET = 0x1
+};
+
enum css_table_layout_e {
CSS_TABLE_LAYOUT_INHERIT = 0x0,
CSS_TABLE_LAYOUT_AUTO = 0x1,
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index df062af..7a1377b 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -726,6 +726,10 @@ enum op_stress {
STRESS_SET = 0x0080
};
+enum op_stroke_opacity {
+ STROKE_OPACITY_SET = 0x0080
+};
+
enum op_table_layout {
TABLE_LAYOUT_AUTO = 0x0000,
TABLE_LAYOUT_FIXED = 0x0001
diff --git a/src/parse/important.c b/src/parse/important.c
index 6e2590e..02aafc4 100644
--- a/src/parse/important.c
+++ b/src/parse/important.c
@@ -351,6 +351,11 @@ void css__make_style_important(css_style *style)
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/properties/Makefile b/src/parse/properties/Makefile
index fc7ac76..df84d49 100644
--- a/src/parse/properties/Makefile
+++ b/src/parse/properties/Makefile
@@ -62,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/properties.c b/src/parse/properties/properties.c
index c1187ca..2cc849c 100644
--- a/src/parse/properties/properties.c
+++ b/src/parse/properties/properties.c
@@ -141,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,
@@ -263,6 +264,7 @@ const uint32_t property_unit_mask[CSS_N_PROPERTIES] = {
[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.h b/src/parse/properties/properties.h
index 25ef60e..17b7f41 100644
--- a/src/parse/properties/properties.h
+++ b/src/parse/properties/properties.h
@@ -409,6 +409,9 @@ css_error css__parse_speech_rate(css_language *c,
css_error css__parse_stress(css_language *c,
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, int32_t *ctx,
css_style *result);
@@ -550,6 +553,7 @@ extern const uint32_t property_unit_mask[CSS_N_PROPERTIES];
#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/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/propstrings.c b/src/parse/propstrings.c
index 62c149a..c57bc1b 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -215,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"),
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index 2725df2..8491e72 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -64,10 +64,10 @@ enum {
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,
+ 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,
diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h
index e5d05c7..40005c1 100644
--- a/src/select/autogenerated_computed.h
+++ b/src/select/autogenerated_computed.h
@@ -96,6 +96,7 @@ struct css_computed_style_i {
* page_break_inside 2
* position 3
* right 2 + 5 4
+ * stroke_opacity 1 4
* table_layout 2
* text_align 4
* text_decoration 5
@@ -141,9 +142,9 @@ struct css_computed_style_i {
* quotes 1 sizeof(ptr)
*
* --- --- ---
- * 463 bits 232 + 8sizeof(ptr) bytes
+ * 464 bits 236 + 8sizeof(ptr) bytes
* ===================
- * 290 + 8sizeof(ptr) bytes
+ * 294 + 8sizeof(ptr) bytes
*
* Bit allocations:
*
@@ -193,13 +194,13 @@ struct css_computed_style_i {
* 12 bbbbbbbbbbbaaaaaaaaaaavvvvvvvvvw
* border_spacing; background_position; vertical_align; widows
*
- * 13 bbbbpppaaagggooovvvjjjffflllcccq
+ * 13 bbbbpppaaagggooovvvjjjffflllcccs
* border_bottom_style; position; page_break_before; page_break_after;
* overflow_y; overflow_x; justify_content; font_family; flex_direction; clear;
- * quotes
+ * stroke_opacity
*
- * 14 bbaaorplfeicuCk.................
- * background_color; background_attachment; orphans; order; opacity;
+ * 14 bbaaqorplfeicuCk................
+ * background_color; background_attachment; quotes; orphans; order; opacity;
* list_style_image; flex_shrink; flex_grow; fill_opacity; counter_reset;
* counter_increment; color; background_image
*/
@@ -258,6 +259,7 @@ struct css_computed_style_i {
css_fixed padding_right;
css_fixed padding_top;
css_fixed right;
+ css_fixed stroke_opacity;
css_fixed text_indent;
css_fixed top;
css_fixed vertical_align;
diff --git a/src/select/autogenerated_propget.h b/src/select/autogenerated_propget.h
index 206c7ee..d1f7ffb 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 17
-#define BACKGROUND_IMAGE_MASK 0x20000
+#define BACKGROUND_IMAGE_SHIFT 16
+#define BACKGROUND_IMAGE_MASK 0x10000
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 18
-#define COLOR_MASK 0x40000
+#define COLOR_SHIFT 17
+#define COLOR_MASK 0x20000
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 19
-#define COUNTER_INCREMENT_MASK 0x80000
+#define COUNTER_INCREMENT_SHIFT 18
+#define COUNTER_INCREMENT_MASK 0x40000
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 20
-#define COUNTER_RESET_MASK 0x100000
+#define COUNTER_RESET_SHIFT 19
+#define COUNTER_RESET_MASK 0x80000
static inline uint8_t get_counter_reset_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[COUNTER_RESET_INDEX];
@@ -1329,8 +1329,8 @@ static inline uint8_t get_empty_cells(const css_computed_style *style)
#undef EMPTY_CELLS_MASK
#define FILL_OPACITY_INDEX 14
-#define FILL_OPACITY_SHIFT 21
-#define FILL_OPACITY_MASK 0x200000
+#define FILL_OPACITY_SHIFT 20
+#define FILL_OPACITY_MASK 0x100000
static inline uint8_t get_fill_opacity_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FILL_OPACITY_INDEX];
@@ -1416,8 +1416,8 @@ static inline uint8_t get_flex_direction(const css_computed_style *style)
#undef FLEX_DIRECTION_MASK
#define FLEX_GROW_INDEX 14
-#define FLEX_GROW_SHIFT 22
-#define FLEX_GROW_MASK 0x400000
+#define FLEX_GROW_SHIFT 21
+#define FLEX_GROW_MASK 0x200000
static inline uint8_t get_flex_grow_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FLEX_GROW_INDEX];
@@ -1446,8 +1446,8 @@ static inline uint8_t get_flex_grow(const css_computed_style *style, css_fixed
#undef FLEX_GROW_MASK
#define FLEX_SHRINK_INDEX 14
-#define FLEX_SHRINK_SHIFT 23
-#define FLEX_SHRINK_MASK 0x800000
+#define FLEX_SHRINK_SHIFT 22
+#define FLEX_SHRINK_MASK 0x400000
static inline uint8_t get_flex_shrink_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FLEX_SHRINK_INDEX];
@@ -1820,8 +1820,8 @@ static inline uint8_t get_line_height(
#undef LINE_HEIGHT_MASK
#define LIST_STYLE_IMAGE_INDEX 14
-#define LIST_STYLE_IMAGE_SHIFT 24
-#define LIST_STYLE_IMAGE_MASK 0x1000000
+#define LIST_STYLE_IMAGE_SHIFT 23
+#define LIST_STYLE_IMAGE_MASK 0x800000
static inline uint8_t get_list_style_image_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[LIST_STYLE_IMAGE_INDEX];
@@ -2149,8 +2149,8 @@ static inline uint8_t get_min_width(const css_computed_style *style, css_fixed
#undef MIN_WIDTH_MASK
#define OPACITY_INDEX 14
-#define OPACITY_SHIFT 25
-#define OPACITY_MASK 0x2000000
+#define OPACITY_SHIFT 24
+#define OPACITY_MASK 0x1000000
static inline uint8_t get_opacity_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[OPACITY_INDEX];
@@ -2179,8 +2179,8 @@ static inline uint8_t get_opacity(const css_computed_style *style, css_fixed
#undef OPACITY_MASK
#define ORDER_INDEX 14
-#define ORDER_SHIFT 26
-#define ORDER_MASK 0x4000000
+#define ORDER_SHIFT 25
+#define ORDER_MASK 0x2000000
static inline uint8_t get_order_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[ORDER_INDEX];
@@ -2209,8 +2209,8 @@ static inline uint8_t get_order(const css_computed_style *style, int32_t
#undef ORDER_MASK
#define ORPHANS_INDEX 14
-#define ORPHANS_SHIFT 27
-#define ORPHANS_MASK 0x8000000
+#define ORPHANS_SHIFT 26
+#define ORPHANS_MASK 0x4000000
static inline uint8_t get_orphans_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[ORPHANS_INDEX];
@@ -2605,9 +2605,9 @@ static inline uint8_t get_position(const css_computed_style *style)
#undef POSITION_SHIFT
#undef POSITION_MASK
-#define QUOTES_INDEX 13
-#define QUOTES_SHIFT 0
-#define QUOTES_MASK 0x1
+#define QUOTES_INDEX 14
+#define QUOTES_SHIFT 27
+#define QUOTES_MASK 0x8000000
static inline uint8_t get_quotes_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[QUOTES_INDEX];
@@ -2664,6 +2664,36 @@ static inline uint8_t get_right(const css_computed_style *style, css_fixed
#undef RIGHT_SHIFT
#undef RIGHT_MASK
+#define STROKE_OPACITY_INDEX 13
+#define STROKE_OPACITY_SHIFT 0
+#define STROKE_OPACITY_MASK 0x1
+static inline uint8_t get_stroke_opacity_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[STROKE_OPACITY_INDEX];
+ bits &= STROKE_OPACITY_MASK;
+ bits >>= STROKE_OPACITY_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
+static inline uint8_t get_stroke_opacity(const css_computed_style *style,
+ css_fixed *fixed)
+{
+ uint32_t bits = style->i.bits[STROKE_OPACITY_INDEX];
+ bits &= STROKE_OPACITY_MASK;
+ bits >>= STROKE_OPACITY_SHIFT;
+
+ /* 1bit: t : type */
+ if ((bits & 0x1) == CSS_STROKE_OPACITY_SET) {
+ *fixed = style->i.stroke_opacity;
+ }
+
+ return (bits & 0x1);
+}
+#undef STROKE_OPACITY_INDEX
+#undef STROKE_OPACITY_SHIFT
+#undef STROKE_OPACITY_MASK
+
#define TABLE_LAYOUT_INDEX 10
#define TABLE_LAYOUT_SHIFT 10
#define TABLE_LAYOUT_MASK 0xc00
diff --git a/src/select/autogenerated_propset.h b/src/select/autogenerated_propset.h
index 850545c..198bc1e 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 17
-#define BACKGROUND_IMAGE_MASK 0x20000
+#define BACKGROUND_IMAGE_SHIFT 16
+#define BACKGROUND_IMAGE_MASK 0x10000
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 18
-#define COLOR_MASK 0x40000
+#define COLOR_SHIFT 17
+#define COLOR_MASK 0x20000
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 19
-#define COUNTER_INCREMENT_MASK 0x80000
+#define COUNTER_INCREMENT_SHIFT 18
+#define COUNTER_INCREMENT_MASK 0x40000
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 20
-#define COUNTER_RESET_MASK 0x100000
+#define COUNTER_RESET_SHIFT 19
+#define COUNTER_RESET_MASK 0x80000
static inline css_error set_counter_reset(css_computed_style *style, uint8_t
type, css_computed_counter *counter_arr)
@@ -1064,8 +1064,8 @@ static inline css_error set_empty_cells(css_computed_style *style, uint8_t type)
#undef EMPTY_CELLS_MASK
#define FILL_OPACITY_INDEX 14
-#define FILL_OPACITY_SHIFT 21
-#define FILL_OPACITY_MASK 0x200000
+#define FILL_OPACITY_SHIFT 20
+#define FILL_OPACITY_MASK 0x100000
static inline css_error set_fill_opacity(css_computed_style *style, uint8_t
type, css_fixed fixed)
@@ -1125,8 +1125,8 @@ static inline css_error set_flex_direction(css_computed_style *style, uint8_t
#undef FLEX_DIRECTION_MASK
#define FLEX_GROW_INDEX 14
-#define FLEX_GROW_SHIFT 22
-#define FLEX_GROW_MASK 0x400000
+#define FLEX_GROW_SHIFT 21
+#define FLEX_GROW_MASK 0x200000
static inline css_error set_flex_grow(css_computed_style *style, uint8_t type,
css_fixed fixed)
@@ -1146,8 +1146,8 @@ static inline css_error set_flex_grow(css_computed_style *style, uint8_t type,
#undef FLEX_GROW_MASK
#define FLEX_SHRINK_INDEX 14
-#define FLEX_SHRINK_SHIFT 23
-#define FLEX_SHRINK_MASK 0x800000
+#define FLEX_SHRINK_SHIFT 22
+#define FLEX_SHRINK_MASK 0x400000
static inline css_error set_flex_shrink(css_computed_style *style, uint8_t
type, css_fixed fixed)
@@ -1417,8 +1417,8 @@ static inline css_error set_line_height(css_computed_style *style, uint8_t
#undef LINE_HEIGHT_MASK
#define LIST_STYLE_IMAGE_INDEX 14
-#define LIST_STYLE_IMAGE_SHIFT 24
-#define LIST_STYLE_IMAGE_MASK 0x1000000
+#define LIST_STYLE_IMAGE_SHIFT 23
+#define LIST_STYLE_IMAGE_MASK 0x800000
static inline css_error set_list_style_image(css_computed_style *style, uint8_t
type, lwc_string *string)
@@ -1653,8 +1653,8 @@ static inline css_error set_min_width(css_computed_style *style, uint8_t type,
#undef MIN_WIDTH_MASK
#define OPACITY_INDEX 14
-#define OPACITY_SHIFT 25
-#define OPACITY_MASK 0x2000000
+#define OPACITY_SHIFT 24
+#define OPACITY_MASK 0x1000000
static inline css_error set_opacity(css_computed_style *style, uint8_t type,
css_fixed fixed)
@@ -1674,8 +1674,8 @@ static inline css_error set_opacity(css_computed_style *style, uint8_t type,
#undef OPACITY_MASK
#define ORDER_INDEX 14
-#define ORDER_SHIFT 26
-#define ORDER_MASK 0x4000000
+#define ORDER_SHIFT 25
+#define ORDER_MASK 0x2000000
static inline css_error set_order(css_computed_style *style, uint8_t type,
int32_t integer)
@@ -1694,8 +1694,8 @@ static inline css_error set_order(css_computed_style *style, uint8_t type,
#undef ORDER_MASK
#define ORPHANS_INDEX 14
-#define ORPHANS_SHIFT 27
-#define ORPHANS_MASK 0x8000000
+#define ORPHANS_SHIFT 26
+#define ORPHANS_MASK 0x4000000
static inline css_error set_orphans(css_computed_style *style, uint8_t type,
int32_t integer)
@@ -1970,9 +1970,9 @@ static inline css_error set_position(css_computed_style *style, uint8_t type)
#undef POSITION_SHIFT
#undef POSITION_MASK
-#define QUOTES_INDEX 13
-#define QUOTES_SHIFT 0
-#define QUOTES_MASK 0x1
+#define QUOTES_INDEX 14
+#define QUOTES_SHIFT 27
+#define QUOTES_MASK 0x8000000
static inline css_error set_quotes(css_computed_style *style, uint8_t type,
lwc_string **string_arr)
@@ -2027,6 +2027,27 @@ static inline css_error set_right(css_computed_style *style, uint8_t type,
#undef RIGHT_SHIFT
#undef RIGHT_MASK
+#define STROKE_OPACITY_INDEX 13
+#define STROKE_OPACITY_SHIFT 0
+#define STROKE_OPACITY_MASK 0x1
+
+static inline css_error set_stroke_opacity(css_computed_style *style, uint8_t
+ type, css_fixed fixed)
+{
+ uint32_t *bits = &style->i.bits[STROKE_OPACITY_INDEX];
+
+ /* 1bit: t : type */
+ *bits = (*bits & ~STROKE_OPACITY_MASK) | (((uint32_t)type & 0x1) <<
+ STROKE_OPACITY_SHIFT);
+
+ style->i.stroke_opacity = fixed;
+
+ return CSS_OK;
+}
+#undef STROKE_OPACITY_INDEX
+#undef STROKE_OPACITY_SHIFT
+#undef STROKE_OPACITY_MASK
+
#define TABLE_LAYOUT_INDEX 10
#define TABLE_LAYOUT_SHIFT 10
#define TABLE_LAYOUT_MASK 0xc00
diff --git a/src/select/computed.c b/src/select/computed.c
index a0c92bb..78f3b80 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -816,6 +816,12 @@ uint8_t css_computed_fill_opacity(const css_computed_style *style,
return get_fill_opacity(style, fill_opacity);
}
+uint8_t css_computed_stroke_opacity(const css_computed_style *style,
+ css_fixed *stroke_opacity)
+{
+ return get_stroke_opacity(style, stroke_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 c8efa44..74bc6ed 100644
--- a/src/select/dispatch.c
+++ b/src/select/dispatch.c
@@ -518,5 +518,9 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
{
PROPERTY_FUNCS(fill_opacity),
0,
+ },
+ {
+ PROPERTY_FUNCS(stroke_opacity),
+ 0,
}
};
diff --git a/src/select/properties/Makefile b/src/select/properties/Makefile
index 2e10f4a..eee6cc3 100644
--- a/src/select/properties/Makefile
+++ b/src/select/properties/Makefile
@@ -108,6 +108,7 @@ speak_header.c \
speak_numeral.c \
speak_punctuation.c \
stress.c \
+stroke_opacity.c \
table_layout.c \
text_align.c \
text_decoration.c \
diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h
index fba5be8..cb0b213 100644
--- a/src/select/properties/properties.h
+++ b/src/select/properties/properties.h
@@ -130,6 +130,7 @@ PROPERTY_FUNCS(speak_punctuation);
PROPERTY_FUNCS(speak);
PROPERTY_FUNCS(speech_rate);
PROPERTY_FUNCS(stress);
+PROPERTY_FUNCS(stroke_opacity);
PROPERTY_FUNCS(table_layout);
PROPERTY_FUNCS(text_align);
PROPERTY_FUNCS(text_decoration);
diff --git a/src/select/properties/stroke_opacity.c b/src/select/properties/stroke_opacity.c
new file mode 100644
index 0000000..c27e127
--- /dev/null
+++ b/src/select/properties/stroke_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_stroke_opacity(uint32_t opv, css_style *style,
+ css_select_state *state)
+{
+ uint16_t value = CSS_STROKE_OPACITY_INHERIT;
+ css_fixed stroke_opacity = 0;
+
+ if (hasFlagValue(opv) == false) {
+ value = CSS_STROKE_OPACITY_SET;
+
+ stroke_opacity = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(stroke_opacity));
+ }
+
+ if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
+ getFlagValue(opv))) {
+ return set_stroke_opacity(state->computed, value, stroke_opacity);
+ }
+
+ return CSS_OK;
+}
+
+css_error css__set_stroke_opacity_from_hint(const css_hint *hint,
+ css_computed_style *style)
+{
+ return set_stroke_opacity(style, hint->status, hint->data.fixed);
+}
+
+css_error css__initial_stroke_opacity(css_select_state *state)
+{
+ return set_stroke_opacity(state->computed, CSS_STROKE_OPACITY_SET, INTTOFIX(1));
+}
+
+css_error css__copy_stroke_opacity(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed stroke_opacity = 0;
+ uint8_t type = get_stroke_opacity(from, &stroke_opacity);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_stroke_opacity(to, type, stroke_opacity);
+}
+
+css_error css__compose_stroke_opacity(const css_computed_style *parent,
+ const css_computed_style *child,
+ css_computed_style *result)
+{
+ css_fixed stroke_opacity = 0;
+ uint8_t type = get_stroke_opacity(child, &stroke_opacity);
+
+ return css__copy_stroke_opacity(
+ type == CSS_STROKE_OPACITY_INHERIT ? parent : child,
+ result);
+}
+
diff --git a/src/select/select_config.py b/src/select/select_config.py
index 5feed6c..1cfe05c 100644
--- a/src/select/select_config.py
+++ b/src/select/select_config.py
@@ -96,6 +96,7 @@ style = {
('min_width', 2, 'length', 'CSS_MIN_WIDTH_SET'),
('opacity', 1, 'fixed', 'CSS_OPACITY_SET'),
('fill_opacity', 1, 'fixed', 'CSS_FILL_OPACITY_SET'),
+ ('stroke_opacity', 1, 'fixed', 'CSS_STROKE_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/svg.dat b/test/data/parse2/svg.dat
index 19839c7..e5ee2a3 100644
--- a/test/data/parse2/svg.dat
+++ b/test/data/parse2/svg.dat
@@ -37,3 +37,43 @@
| *
| fill-opacity: 1
#reset
+
+#data
+* { stroke-opacity: inherit; }
+#errors
+#expected
+| *
+| stroke-opacity: inherit
+#reset
+
+#data
+* { stroke-opacity: revert; }
+#errors
+#expected
+| *
+| stroke-opacity: revert
+#reset
+
+#data
+* { stroke-opacity: 0.00000; }
+#errors
+#expected
+| *
+| stroke-opacity: 0
+#reset
+
+#data
+* { stroke-opacity: -0.5; }
+#errors
+#expected
+| *
+| stroke-opacity: 0
+#reset
+
+#data
+* { stroke-opacity: 5; }
+#errors
+#expected
+| *
+| stroke-opacity: 1
+#reset
diff --git a/test/data/select/defaulting.dat b/test/data/select/defaulting.dat
index cce46ac..9548ae8 100644
--- a/test/data/select/defaulting.dat
+++ b/test/data/select/defaulting.dat
@@ -92,6 +92,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -204,6 +205,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -317,6 +319,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -431,6 +434,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -541,6 +545,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -655,6 +660,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -768,6 +774,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -881,6 +888,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -994,6 +1002,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1104,6 +1113,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1217,6 +1227,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1332,6 +1343,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1447,6 +1459,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index f620d5f..9240ed6 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -94,6 +94,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -206,6 +207,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -321,6 +323,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -440,6 +443,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -560,6 +564,7 @@ padding-left: 0px
position: absolute
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -680,6 +685,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -800,6 +806,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -910,6 +917,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1021,6 +1029,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1132,6 +1141,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1242,6 +1252,7 @@ padding-left: 0px
position: static
quotes: "a" "b"
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1357,6 +1368,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1472,6 +1484,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1588,6 +1601,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1707,6 +1721,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1825,6 +1840,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -1949,6 +1965,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2073,6 +2090,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2197,6 +2215,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2325,6 +2344,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2452,6 +2472,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2577,6 +2598,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2701,6 +2723,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2825,6 +2848,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -2949,6 +2973,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3073,6 +3098,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3197,6 +3223,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3321,6 +3348,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3445,6 +3473,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3569,6 +3598,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3693,6 +3723,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3817,6 +3848,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -3941,6 +3973,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4065,6 +4098,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4189,6 +4223,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4313,6 +4348,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4437,6 +4473,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4561,6 +4598,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4685,6 +4723,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4809,6 +4848,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -4933,6 +4973,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5057,6 +5098,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5174,6 +5216,7 @@ padding-left: 0px
position: absolute
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5291,6 +5334,7 @@ padding-left: 0px
position: absolute
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5408,6 +5452,7 @@ padding-left: 0px
position: absolute
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5522,6 +5567,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5637,6 +5683,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5752,6 +5799,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5867,6 +5915,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -5978,6 +6027,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6090,6 +6140,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6201,6 +6252,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6312,6 +6364,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6423,6 +6476,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6534,6 +6588,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6645,6 +6700,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6758,6 +6814,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6869,6 +6926,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -6980,6 +7038,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7092,6 +7151,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7203,6 +7263,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7314,6 +7375,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7425,6 +7487,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7536,6 +7599,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7647,6 +7711,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7758,6 +7823,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7869,6 +7935,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -7979,6 +8046,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8089,6 +8157,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8199,6 +8268,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8311,6 +8381,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8423,6 +8494,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8533,6 +8605,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8645,6 +8718,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8757,6 +8831,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8869,6 +8944,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -8979,6 +9055,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9089,6 +9166,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9199,6 +9277,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9309,6 +9388,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9419,6 +9499,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9529,6 +9610,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9639,6 +9721,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9749,6 +9832,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9861,6 +9945,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -9973,6 +10058,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10083,6 +10169,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10193,6 +10280,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10303,6 +10391,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10413,6 +10502,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10523,6 +10613,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10633,6 +10724,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10743,6 +10835,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10855,6 +10948,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -10967,6 +11061,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11077,6 +11172,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11187,6 +11283,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11297,6 +11394,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11409,6 +11507,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11519,6 +11618,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11631,6 +11731,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11741,6 +11842,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11851,6 +11953,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -11961,6 +12064,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12071,6 +12175,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12181,6 +12286,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12291,6 +12397,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12401,6 +12508,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12511,6 +12619,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12621,6 +12730,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12731,6 +12841,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12841,6 +12952,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -12951,6 +13063,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13061,6 +13174,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13171,6 +13285,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13281,6 +13396,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13391,6 +13507,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13501,6 +13618,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13611,6 +13729,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13721,6 +13840,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13831,6 +13951,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -13941,6 +14062,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -14051,6 +14173,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -14161,6 +14284,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -14290,6 +14414,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -14400,6 +14525,7 @@ padding-left: 0px
position: static
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
@@ -14510,6 +14636,7 @@ padding-left: 0px
position: sticky
quotes: none
right: auto
+stroke-opacity: 1.000
table-layout: auto
text-align: default
text-decoration: none
diff --git a/test/dump.h b/test/dump.h
index f52c9cc..09a35b0 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -492,6 +492,7 @@ static const char *opcode_names[] = {
"justify-content",
"order",
"fill-opacity",
+ "stroke-opacity",
};
static void dump_css_fixed(css_fixed f, char **ptr)
@@ -1831,6 +1832,17 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
}
break;
+ case CSS_PROP_STROKE_OPACITY:
+ switch (value) {
+ case STROKE_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 55d9f85..f769075 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -2820,6 +2820,30 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
ptr += wrote;
*len -= wrote;
+ /* stroke-opacity */
+ val = css_computed_stroke_opacity(style, &len1);
+ switch (val) {
+ case CSS_STROKE_OPACITY_INHERIT:
+ wrote = snprintf(ptr, *len, "stroke-opacity: inherit\n");
+ break;
+ case CSS_STROKE_OPACITY_SET:
+ wrote = snprintf(ptr, *len, "stroke-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;
+
/* table-layout */
val = css_computed_table_layout(style);
switch (val) {