summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rwxr-xr-xbuild/mkprops.pl6
-rw-r--r--docs/Bytecode20
-rw-r--r--include/libcss/computed.h31
-rw-r--r--include/libcss/fpmath.h5
-rw-r--r--include/libcss/properties.h12
-rw-r--r--include/libcss/types.h4
-rw-r--r--src/bytecode/bytecode.h20
-rw-r--r--src/bytecode/opcodes.h48
-rw-r--r--src/parse/font_face.c20
-rw-r--r--src/parse/font_face.h2
-rw-r--r--src/parse/important.c19
-rw-r--r--src/parse/important.h2
-rw-r--r--src/parse/language.c54
-rw-r--r--src/parse/language.h2
-rw-r--r--src/parse/mq.c24
-rw-r--r--src/parse/mq.h2
-rw-r--r--src/parse/properties/Makefile2
-rw-r--r--src/parse/properties/azimuth.c4
-rw-r--r--src/parse/properties/background.c4
-rw-r--r--src/parse/properties/background_position.c4
-rw-r--r--src/parse/properties/border.c4
-rw-r--r--src/parse/properties/border_color.c4
-rw-r--r--src/parse/properties/border_spacing.c4
-rw-r--r--src/parse/properties/border_style.c4
-rw-r--r--src/parse/properties/border_width.c4
-rw-r--r--src/parse/properties/clip.c4
-rw-r--r--src/parse/properties/column_rule.c4
-rw-r--r--src/parse/properties/columns.c4
-rw-r--r--src/parse/properties/content.c8
-rw-r--r--src/parse/properties/css_property_parser_gen.c58
-rw-r--r--src/parse/properties/cue.c4
-rw-r--r--src/parse/properties/cursor.c4
-rw-r--r--src/parse/properties/elevation.c4
-rw-r--r--src/parse/properties/fill_opacity.c82
-rw-r--r--src/parse/properties/flex.c4
-rw-r--r--src/parse/properties/flex_flow.c4
-rw-r--r--src/parse/properties/font.c5
-rw-r--r--src/parse/properties/font_family.c4
-rw-r--r--src/parse/properties/font_weight.c4
-rw-r--r--src/parse/properties/list_style.c4
-rw-r--r--src/parse/properties/list_style_type.c4
-rw-r--r--src/parse/properties/margin.c4
-rw-r--r--src/parse/properties/opacity.c4
-rw-r--r--src/parse/properties/outline.c4
-rw-r--r--src/parse/properties/overflow.c4
-rw-r--r--src/parse/properties/padding.c4
-rw-r--r--src/parse/properties/pause.c4
-rw-r--r--src/parse/properties/play_during.c4
-rw-r--r--src/parse/properties/properties.c4
-rw-r--r--src/parse/properties/properties.gen78
-rw-r--r--src/parse/properties/properties.h300
-rw-r--r--src/parse/properties/quotes.c4
-rw-r--r--src/parse/properties/stroke_opacity.c82
-rw-r--r--src/parse/properties/text_decoration.c6
-rw-r--r--src/parse/properties/utils.c393
-rw-r--r--src/parse/properties/utils.h48
-rw-r--r--src/parse/properties/voice_family.c4
-rw-r--r--src/parse/propstrings.c3
-rw-r--r--src/parse/propstrings.h35
-rw-r--r--src/select/Makefile3
-rw-r--r--src/select/assets.py41
-rw-r--r--src/select/autogenerated_computed.h36
-rw-r--r--src/select/autogenerated_destroy.inc116
-rw-r--r--src/select/autogenerated_propget.h1165
-rw-r--r--src/select/autogenerated_propset.h529
-rw-r--r--src/select/calc.c285
-rw-r--r--src/select/calc.h92
-rw-r--r--src/select/computed.c129
-rw-r--r--src/select/computed.h3
-rw-r--r--src/select/dispatch.c8
-rw-r--r--src/select/overrides.py32
-rw-r--r--src/select/properties/Makefile2
-rw-r--r--src/select/properties/column_count.c7
-rw-r--r--src/select/properties/fill_opacity.c73
-rw-r--r--src/select/properties/flex_basis.c7
-rw-r--r--src/select/properties/flex_grow.c17
-rw-r--r--src/select/properties/flex_shrink.c17
-rw-r--r--src/select/properties/font_size.c7
-rw-r--r--src/select/properties/helpers.c110
-rw-r--r--src/select/properties/helpers.h5
-rw-r--r--src/select/properties/line_height.c7
-rw-r--r--src/select/properties/opacity.c2
-rw-r--r--src/select/properties/order.c17
-rw-r--r--src/select/properties/pitch.c7
-rw-r--r--src/select/properties/properties.h2
-rw-r--r--src/select/properties/speech_rate.c7
-rw-r--r--src/select/properties/stroke_opacity.c73
-rw-r--r--src/select/properties/vertical_align.c7
-rw-r--r--src/select/properties/volume.c7
-rw-r--r--src/select/properties/width.c10
-rw-r--r--src/select/properties/z_index.c7
-rw-r--r--src/select/select.c24
-rw-r--r--src/select/select_config.py4
-rw-r--r--src/select/select_generator.py298
-rw-r--r--src/select/unit.c13
-rw-r--r--src/select/unit.h11
-rw-r--r--src/stylesheet.h6
-rw-r--r--test/INDEX1
-rw-r--r--test/Makefile2
-rw-r--r--test/data/parse2/INDEX2
-rw-r--r--test/data/parse2/calc.dat195
-rw-r--r--test/data/parse2/svg.dat79
-rw-r--r--test/data/select/INDEX1
-rw-r--r--test/data/select/calc.dat112
-rw-r--r--test/data/select/defaulting.dat26
-rw-r--r--test/data/select/tests1.dat254
-rw-r--r--test/data/select2/INDEX5
-rw-r--r--test/data/select2/calc.dat223
-rw-r--r--test/dump.h85
-rw-r--r--test/dump_computed.h72
-rw-r--r--test/select.c3
-rw-r--r--test/select2.c4
113 files changed, 4689 insertions, 1054 deletions
diff --git a/Makefile b/Makefile
index 86d6641..43e9a80 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@
# Component settings
COMPONENT := css
-COMPONENT_VERSION := 0.9.1
+COMPONENT_VERSION := 0.9.2
# Default to a static library
COMPONENT_TYPE ?= lib-static
diff --git a/build/mkprops.pl b/build/mkprops.pl
index 33fb0f8..6e38007 100755
--- a/build/mkprops.pl
+++ b/build/mkprops.pl
@@ -24,7 +24,7 @@ EOF
foreach my $prop (@PROPS) {
print <<EOF
static css_error parse_$prop(css_css21 *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style **result);
EOF
}
@@ -35,7 +35,7 @@ print <<EOF
* Type of property handler function
*/
typedef css_error (*css_prop_handler)(css_css21 *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style **result);
/**
@@ -56,7 +56,7 @@ foreach my $prop (@PROPS) {
print <<EOF
css_error parse_$prop(css_css21 *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style **result)
{
UNUSED(c);
diff --git a/docs/Bytecode b/docs/Bytecode
index 67450cd..272fd07 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -1383,4 +1383,22 @@ Opcodes
bit 7 clear => Reserved for future expansion
bits 0-6: MBZ
-7c-3ff - Reserved for future expansion.
+7c - fill-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
+
+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 30e369b..c048e64 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -279,8 +279,29 @@ uint8_t css_computed_max_width(
const css_computed_style *style,
css_fixed *length, css_unit *unit);
-uint8_t css_computed_width(
+/**
+ * Get the width property value in device pixels.
+ *
+ * \note If available_px is set to a negative number (invalid) then,
+ * if the computation would have required a valid available
+ * width, it will return CSS_WIDTH_AUTO.
+ *
+ * This will resolve `calc()` expressions to used values.
+ *
+ * \param[in] style A computed style.
+ * \param[in] unit_ctx Unit conversion context.
+ * \param[in] available_px The available width in pixels.
+ * \param[out] px_out Returns width in pixels if and only if the
+ * call returns CSS_WIDTH_SET.
+ * \return CSS_WIDTH_SET or CSS_WIDTH_AUTO.
+ */
+uint8_t css_computed_width_px(
const css_computed_style *style,
+ const css_unit_ctx *unit_ctx,
+ int available_px,
+ int *px_out);
+
+uint8_t css_computed_width(const css_computed_style *style,
css_fixed *length, css_unit *unit);
uint8_t css_computed_empty_cells(
@@ -338,6 +359,14 @@ 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_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/fpmath.h b/include/libcss/fpmath.h
index d7cac4d..a080fc1 100644
--- a/include/libcss/fpmath.h
+++ b/include/libcss/fpmath.h
@@ -130,6 +130,8 @@ css_float_to_fixed(const float a) {
/* truncate a fixed point value */
#define TRUNCATEFIX(a) (a & ~((1 << CSS_RADIX_POINT)- 1 ))
+/* get fractional component of a fixed point value */
+#define FIXFRAC(a) (a & ((1 << CSS_RADIX_POINT)- 1 ))
/* Useful values */
#define F_PI_2 0x00000648 /* 1.5708 (PI/2) */
@@ -153,6 +155,9 @@ css_float_to_fixed(const float a) {
#define F_300 0x0004b000 /* 300 */
#define F_400 0x00064000 /* 400 */
+/* Fixed point percentage `p` of integer `i`, to an integer */
+#define FPCT_OF_INT_TOINT(p, i) (FIXTOINT(FDIV((p * i), F_100)))
+
#ifdef __cplusplus
}
#endif
diff --git a/include/libcss/properties.h b/include/libcss/properties.h
index af0a1f5..cb1f0ff 100644
--- a/include/libcss/properties.h
+++ b/include/libcss/properties.h
@@ -138,6 +138,8 @@ enum css_properties_e {
CSS_PROP_FLEX_WRAP = 0x079,
CSS_PROP_JUSTIFY_CONTENT = 0x07a,
CSS_PROP_ORDER = 0x07b,
+ CSS_PROP_FILL_OPACITY = 0x07c,
+ CSS_PROP_STROKE_OPACITY = 0x07d,
CSS_N_PROPERTIES
};
@@ -451,6 +453,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,
@@ -780,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/include/libcss/types.h b/include/libcss/types.h
index 3fb28d3..c0b19da 100644
--- a/include/libcss/types.h
+++ b/include/libcss/types.h
@@ -109,7 +109,9 @@ typedef enum css_unit {
CSS_UNIT_S = 0x1a,
CSS_UNIT_HZ = 0x1b,
- CSS_UNIT_KHZ = 0x1c
+ CSS_UNIT_KHZ = 0x1c,
+
+ CSS_UNIT_CALC = 0x1d /**< Un-resolved calc() */
} css_unit;
/**
diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index ccfdcac..d799194 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -14,6 +14,8 @@
#include <libcss/types.h>
#include <libcss/properties.h>
+#include "bytecode/opcodes.h"
+
typedef uint32_t css_code_t;
typedef enum css_properties_e opcode_t;
@@ -34,6 +36,15 @@ enum flag {
FLAG_UNSET = (FLAG_VALUE_UNSET << 1),
};
+enum calc_opcodes {
+ CALC_PUSH_NUMBER = 'N',
+ CALC_PUSH_VALUE = 'V',
+ CALC_ADD = '+',
+ CALC_SUBTRACT = '-',
+ CALC_MULTIPLY = '*',
+ CALC_DIVIDE = '/',
+ CALC_FINISH = '=',
+};
typedef enum unit {
UNIT_LENGTH = (1u << 8),
@@ -76,6 +87,10 @@ typedef enum unit {
UNIT_DPI = (1 << 13) + 0,
UNIT_DPCM = (1 << 13) + 1,
UNIT_DPPX = (1 << 13) + 2,
+
+ /* These are special only to the CALC bytecodes */
+ UNIT_CALC_ANY = (1 << 20),
+ UNIT_CALC_NUMBER = (1 << 20) + 1,
} unit;
typedef uint32_t colour;
@@ -124,6 +139,11 @@ static inline bool isInherit(css_code_t OPV)
return getFlagValue(OPV) == FLAG_VALUE_INHERIT;
}
+static inline bool isCalc(css_code_t OPV)
+{
+ return getValue(OPV) == VALUE_IS_CALC;
+}
+
#endif
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index 8bc05b4..44ab23d 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -10,6 +10,8 @@
#include <inttypes.h>
+#define VALUE_IS_CALC 0x007f
+
enum op_align_content {
ALIGN_CONTENT_STRETCH = 0x0000,
ALIGN_CONTENT_FLEX_START = 0x0001,
@@ -119,6 +121,7 @@ enum op_border_style {
};
enum op_border_width {
+ BORDER_WIDTH_CALC = VALUE_IS_CALC,
BORDER_WIDTH_SET = 0x0080,
BORDER_WIDTH_THIN = 0x0000,
BORDER_WIDTH_MEDIUM = 0x0001,
@@ -126,6 +129,7 @@ enum op_border_width {
};
enum op_bottom {
+ BOTTOM_CALC = VALUE_IS_CALC,
BOTTOM_SET = 0x0080,
BOTTOM_AUTO = 0x0000
};
@@ -198,6 +202,7 @@ enum op_color {
enum op_column_count {
COLUMN_COUNT_AUTO = 0x0000,
+ COLUMN_COUNT_CALC = VALUE_IS_CALC,
COLUMN_COUNT_SET = 0x0080
};
@@ -208,6 +213,7 @@ enum op_column_fill {
enum op_column_gap {
COLUMN_GAP_NORMAL = 0x0000,
+ COLUMN_GAP_CALC = VALUE_IS_CALC,
COLUMN_GAP_SET = 0x0080
};
@@ -231,6 +237,7 @@ enum op_column_rule_style {
};
enum op_column_rule_width {
+ COLUMN_RULE_WIDTH_CALC = BORDER_WIDTH_CALC,
COLUMN_RULE_WIDTH_SET = BORDER_WIDTH_SET,
COLUMN_RULE_WIDTH_THIN = BORDER_WIDTH_THIN,
COLUMN_RULE_WIDTH_MEDIUM = BORDER_WIDTH_MEDIUM,
@@ -244,6 +251,7 @@ enum op_column_span {
enum op_column_width {
COLUMN_WIDTH_AUTO = 0x0000,
+ COLUMN_WIDTH_CALC = VALUE_IS_CALC,
COLUMN_WIDTH_SET = 0x0080
};
@@ -351,9 +359,15 @@ 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,
+ FLEX_BASIS_CALC = VALUE_IS_CALC,
FLEX_BASIS_SET = 0x0080
};
@@ -365,10 +379,12 @@ enum op_flex_direction {
};
enum op_flex_grow {
+ FLEX_GROW_CALC = VALUE_IS_CALC,
FLEX_GROW_SET = 0x0080
};
enum op_flex_shrink {
+ FLEX_SHRINK_CALC = VALUE_IS_CALC,
FLEX_SHRINK_SET = 0x0080
};
@@ -398,6 +414,7 @@ enum op_font_family {
};
enum op_font_size {
+ FONT_SIZE_CALC = VALUE_IS_CALC,
FONT_SIZE_DIMENSION = 0x0080,
FONT_SIZE_XX_SMALL = 0x0000,
@@ -439,6 +456,7 @@ enum op_font_weight {
};
enum op_height {
+ HEIGHT_CALC = VALUE_IS_CALC,
HEIGHT_SET = 0x0080,
HEIGHT_AUTO = 0x0000
};
@@ -453,16 +471,19 @@ enum op_justify_content {
};
enum op_left {
+ LEFT_CALC = BOTTOM_CALC,
LEFT_SET = BOTTOM_SET,
LEFT_AUTO = BOTTOM_AUTO
};
enum op_letter_spacing {
+ LETTER_SPACING_CALC = VALUE_IS_CALC,
LETTER_SPACING_SET = 0x0080,
LETTER_SPACING_NORMAL = 0x0000
};
enum op_line_height {
+ LINE_HEIGHT_CALC = VALUE_IS_CALC,
LINE_HEIGHT_NUMBER = 0x0080,
LINE_HEIGHT_DIMENSION = 0x0081,
LINE_HEIGHT_NORMAL = 0x0000
@@ -534,26 +555,31 @@ enum op_list_style_type {
};
enum op_margin {
+ MARGIN_CALC = VALUE_IS_CALC,
MARGIN_SET = 0x0080,
MARGIN_AUTO = 0x0000
};
enum op_max_height {
+ MAX_HEIGHT_CALC = VALUE_IS_CALC,
MAX_HEIGHT_SET = 0x0080,
MAX_HEIGHT_NONE = 0x0000
};
enum op_max_width {
+ MAX_WIDTH_CALC = VALUE_IS_CALC,
MAX_WIDTH_SET = 0x0080,
MAX_WIDTH_NONE = 0x0000
};
enum op_min_height {
+ MIN_HEIGHT_CALC = VALUE_IS_CALC,
MIN_HEIGHT_SET = 0x0080,
MIN_HEIGHT_AUTO = 0x0000
};
enum op_min_width {
+ MIN_WIDTH_CALC = VALUE_IS_CALC,
MIN_WIDTH_SET = 0x0080,
MIN_WIDTH_AUTO = 0x0000
};
@@ -563,10 +589,12 @@ enum op_opacity {
};
enum op_order {
+ ORDER_CALC = VALUE_IS_CALC,
ORDER_SET = 0x0080
};
enum op_orphans {
+ ORPHANS_CALC = VALUE_IS_CALC,
ORPHANS_SET = 0x0080
};
@@ -605,6 +633,7 @@ enum op_overflow {
};
enum op_padding {
+ PADDING_CALC = VALUE_IS_CALC,
PADDING_SET = 0x0080
};
@@ -630,18 +659,22 @@ enum op_page_break_inside {
};
enum op_pause_after {
+ PAUSE_AFTER_CALC = VALUE_IS_CALC,
PAUSE_AFTER_SET = 0x0080
};
enum op_pause_before {
+ PAUSE_BEFORE_CALC = VALUE_IS_CALC,
PAUSE_BEFORE_SET = 0x0080
};
enum op_pitch_range {
+ PITCH_RANGE_CALC = VALUE_IS_CALC,
PITCH_RANGE_SET = 0x0080
};
enum op_pitch {
+ PITCH_CALC = VALUE_IS_CALC,
PITCH_FREQUENCY = 0x0080,
PITCH_X_LOW = 0x0000,
@@ -676,6 +709,7 @@ enum op_quotes {
};
enum op_richness {
+ RICHNESS_CALC = VALUE_IS_CALC,
RICHNESS_SET = 0x0080
};
@@ -706,6 +740,7 @@ enum op_speak {
};
enum op_speech_rate {
+ SPEECH_RATE_CALC = VALUE_IS_CALC,
SPEECH_RATE_SET = 0x0080,
SPEECH_RATE_X_SLOW = 0x0000,
@@ -718,9 +753,14 @@ enum op_speech_rate {
};
enum op_stress {
+ STRESS_CALC = VALUE_IS_CALC,
STRESS_SET = 0x0080
};
+enum op_stroke_opacity {
+ STROKE_OPACITY_SET = 0x0080
+};
+
enum op_table_layout {
TABLE_LAYOUT_AUTO = 0x0000,
TABLE_LAYOUT_FIXED = 0x0001
@@ -746,6 +786,7 @@ enum op_text_decoration {
};
enum op_text_indent {
+ TEXT_INDENT_CALC = VALUE_IS_CALC,
TEXT_INDENT_SET = 0x0080
};
@@ -757,6 +798,7 @@ enum op_text_transform {
};
enum op_top {
+ TOP_CALC = BOTTOM_CALC,
TOP_SET = BOTTOM_SET,
TOP_AUTO = BOTTOM_AUTO
};
@@ -768,6 +810,7 @@ enum op_unicode_bidi {
};
enum op_vertical_align {
+ VERTICAL_ALIGN_CALC = VALUE_IS_CALC,
VERTICAL_ALIGN_SET = 0x0080,
VERTICAL_ALIGN_BASELINE = 0x0000,
@@ -798,6 +841,7 @@ enum op_voice_family {
};
enum op_volume {
+ VOLUME_CALC = VALUE_IS_CALC,
VOLUME_NUMBER = 0x0080,
VOLUME_DIMENSION = 0x0081,
@@ -818,16 +862,19 @@ enum op_white_space {
};
enum op_widows {
+ WIDOWS_CALC = VALUE_IS_CALC,
WIDOWS_SET = 0x0080
};
enum op_width {
+ WIDTH_CALC = VALUE_IS_CALC,
WIDTH_SET = 0x0080,
WIDTH_AUTO = 0x0000
};
enum op_word_spacing {
+ WORD_SPACING_CALC = VALUE_IS_CALC,
WORD_SPACING_SET = 0x0080,
WORD_SPACING_NORMAL = 0x0000
@@ -840,6 +887,7 @@ enum op_writing_mode {
};
enum op_z_index {
+ Z_INDEX_CALC = VALUE_IS_CALC,
Z_INDEX_SET = 0x0080,
Z_INDEX_AUTO = 0x0000
diff --git a/src/parse/font_face.c b/src/parse/font_face.c
index f17d50e..055a118 100644
--- a/src/parse/font_face.c
+++ b/src/parse/font_face.c
@@ -41,7 +41,7 @@ static bool font_rule_font_family_reserved(css_language *c,
}
static css_error font_face_parse_font_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face *font_face)
{
css_error error;
@@ -60,7 +60,7 @@ static css_error font_face_parse_font_family(css_language *c,
}
static css_error font_face_src_parse_format(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face_format *format)
{
bool match;
@@ -120,7 +120,7 @@ static css_error font_face_src_parse_format(css_language *c,
}
static css_error font_face_src_parse_spec_or_name(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
lwc_string **location,
css_font_face_location_type *location_type,
css_font_face_format *format)
@@ -194,10 +194,10 @@ static css_error font_face_src_parse_spec_or_name(css_language *c,
}
static css_error font_face_parse_src(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face *font_face)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
css_font_face_src *srcs = NULL, *new_srcs = NULL;
@@ -258,10 +258,10 @@ cleanup:
}
static css_error font_face_parse_font_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face *font_face)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
enum css_font_style_e style = 0;
@@ -299,10 +299,10 @@ static css_error font_face_parse_font_style(css_language *c,
}
static css_error font_face_parse_font_weight(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_font_face *font_face)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
enum css_font_weight_e weight = 0;
@@ -374,7 +374,7 @@ static css_error font_face_parse_font_weight(css_language *c,
*/
css_error css__parse_font_descriptor(css_language *c,
const css_token *descriptor, const parserutils_vector *vector,
- int *ctx, css_rule_font_face *rule)
+ int32_t *ctx, css_rule_font_face *rule)
{
css_font_face *font_face = rule->font_face;
css_error error;
diff --git a/src/parse/font_face.h b/src/parse/font_face.h
index 435380e..dc00ef1 100644
--- a/src/parse/font_face.h
+++ b/src/parse/font_face.h
@@ -17,6 +17,6 @@
css_error css__parse_font_descriptor(css_language *c,
const css_token *descriptor, const parserutils_vector *vector,
- int *ctx, struct css_rule_font_face *rule);
+ int32_t *ctx, struct css_rule_font_face *rule);
#endif
diff --git a/src/parse/important.c b/src/parse/important.c
index 1066d90..950fc6a 100644
--- a/src/parse/important.c
+++ b/src/parse/important.c
@@ -25,10 +25,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_important(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint8_t *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
bool match = false;
const css_token *token;
@@ -87,7 +87,10 @@ void css__make_style_important(css_style *style)
offset++;
/* Advance past any property-specific data */
- if (hasFlagValue(opv) == false) {
+ if (hasFlagValue(opv) == false && value == VALUE_IS_CALC) {
+ /* All VALUE_IS_CALC have the form OPV UNIT STRIDX */
+ offset += 2;
+ } else if (hasFlagValue(opv) == false) {
switch (op) {
case CSS_PROP_AZIMUTH:
if ((value & ~AZIMUTH_BEHIND) == AZIMUTH_ANGLE)
@@ -346,6 +349,16 @@ void css__make_style_important(css_style *style)
offset++; /* value */
break;
+ case CSS_PROP_FILL_OPACITY:
+ if (value == FILL_OPACITY_SET)
+ offset++; /* value */
+ break;
+
+ case CSS_PROP_STROKE_OPACITY:
+ if (value == STROKE_OPACITY_SET)
+ offset++; /* value */
+ break;
+
case CSS_PROP_ORDER:
if (value == ORDER_SET)
offset++; /* value */
diff --git a/src/parse/important.h b/src/parse/important.h
index ba5e118..e939c4b 100644
--- a/src/parse/important.h
+++ b/src/parse/important.h
@@ -12,7 +12,7 @@
#include "parse/language.h"
css_error css__parse_important(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint8_t *result);
void css__make_style_important(css_style *style);
diff --git a/src/parse/language.c b/src/parse/language.c
index c2d02d7..936ab3d 100644
--- a/src/parse/language.c
+++ b/src/parse/language.c
@@ -63,37 +63,37 @@ static css_error lookupNamespace(css_language *c,
/* Selector list parsing */
static css_error parseClass(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector_detail *specific);
static css_error parseAttrib(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector_detail *specific);
static css_error parseNth(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector_detail_value *value);
static css_error parsePseudo(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool in_not, css_selector_detail *specific);
static css_error parseSpecific(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool in_not, css_selector_detail *specific);
static css_error parseAppendSpecific(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **parent);
static css_error parseSelectorSpecifics(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **parent);
static css_error parseTypeSelector(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_qname *qname);
static css_error parseSimpleSelector(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **result);
static css_error parseCombinator(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_combinator *result);
static css_error parseSelector(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **result);
static css_error parseSelectorList(css_language *c,
const parserutils_vector *vector, css_rule *rule);
@@ -101,7 +101,7 @@ static css_error parseSelectorList(css_language *c,
/* Declaration parsing */
static css_error parseProperty(css_language *c,
const css_token *property, const parserutils_vector *vector,
- int *ctx, css_rule *rule);
+ int32_t *ctx, css_rule *rule);
/**
* Create a CSS language parser
@@ -790,7 +790,7 @@ css_error handleDeclaration(css_language *c, const parserutils_vector *vector)
{
css_error error;
const css_token *token, *ident;
- int ctx = 0;
+ int32_t ctx = 0;
context_entry *entry;
css_rule *rule;
@@ -945,7 +945,7 @@ css_error lookupNamespace(css_language *c, lwc_string *prefix, lwc_string **uri)
******************************************************************************/
css_error parseClass(css_language *c, const parserutils_vector *vector,
- int *ctx, css_selector_detail *specific)
+ int32_t *ctx, css_selector_detail *specific)
{
css_qname qname;
css_selector_detail_value detail_value;
@@ -976,7 +976,7 @@ css_error parseClass(css_language *c, const parserutils_vector *vector,
}
css_error parseAttrib(css_language *c, const parserutils_vector *vector,
- int *ctx, css_selector_detail *specific)
+ int32_t *ctx, css_selector_detail *specific)
{
css_qname qname;
css_selector_detail_value detail_value;
@@ -1078,7 +1078,7 @@ css_error parseAttrib(css_language *c, const parserutils_vector *vector,
}
css_error parseNth(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector_detail_value *value)
{
const css_token *token;
@@ -1279,7 +1279,7 @@ css_error parseNth(css_language *c,
}
css_error parsePseudo(css_language *c, const parserutils_vector *vector,
- int *ctx, bool in_not, css_selector_detail *specific)
+ int32_t *ctx, bool in_not, css_selector_detail *specific)
{
static const struct
{
@@ -1459,7 +1459,7 @@ css_error parsePseudo(css_language *c, const parserutils_vector *vector,
}
css_error parseSpecific(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool in_not, css_selector_detail *specific)
{
css_error error;
@@ -1514,7 +1514,7 @@ css_error parseSpecific(css_language *c,
}
css_error parseAppendSpecific(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **parent)
{
css_error error;
@@ -1529,7 +1529,7 @@ css_error parseAppendSpecific(css_language *c,
}
css_error parseSelectorSpecifics(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **parent)
{
css_error error;
@@ -1551,7 +1551,7 @@ css_error parseSelectorSpecifics(css_language *c,
}
css_error parseTypeSelector(css_language *c, const parserutils_vector *vector,
- int *ctx, css_qname *qname)
+ int32_t *ctx, css_qname *qname)
{
const css_token *token;
css_error error;
@@ -1612,10 +1612,10 @@ css_error parseTypeSelector(css_language *c, const parserutils_vector *vector,
}
css_error parseSimpleSelector(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_selector **result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
css_selector *selector;
@@ -1678,7 +1678,7 @@ css_error parseSimpleSelector(css_language *c,
}
css_error parseCombinator(css_language *c, const parserutils_vector *vector,
- int *ctx, css_combinator *result)
+ int32_t *ctx, css_combinator *result)
{
const css_token *token;
css_combinator comb = CSS_COMBINATOR_NONE;
@@ -1719,7 +1719,7 @@ css_error parseCombinator(css_language *c, const parserutils_vector *vector,
}
css_error parseSelector(css_language *c, const parserutils_vector *vector,
- int *ctx, css_selector **result)
+ int32_t *ctx, css_selector **result)
{
css_error error;
const css_token *token = NULL;
@@ -1785,7 +1785,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector,
css_error error;
const css_token *token = NULL;
css_selector *selector = NULL;
- int ctx = 0;
+ int32_t ctx = 0;
/* Strip any leading whitespace (can happen if in nested block) */
consumeWhitespace(vector, &ctx);
@@ -1843,7 +1843,7 @@ css_error parseSelectorList(css_language *c, const parserutils_vector *vector,
******************************************************************************/
css_error parseProperty(css_language *c, const css_token *property,
- const parserutils_vector *vector, int *ctx, css_rule *rule)
+ const parserutils_vector *vector, int32_t *ctx, css_rule *rule)
{
css_error error;
css_prop_handler handler = NULL;
diff --git a/src/parse/language.h b/src/parse/language.h
index 2ab4987..81a096a 100644
--- a/src/parse/language.h
+++ b/src/parse/language.h
@@ -64,7 +64,7 @@ css_error css__language_destroy(css_language *language);
* \param vector The vector to consume from
* \param ctx The vector's context
*/
-static inline void consumeWhitespace(const parserutils_vector *vector, int *ctx)
+static inline void consumeWhitespace(const parserutils_vector *vector, int32_t *ctx)
{
const css_token *token = NULL;
diff --git a/src/parse/mq.c b/src/parse/mq.c
index b5478a1..5031e34 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -79,11 +79,11 @@ void css__mq_query_destroy(css_mq_query *media)
}
static css_error mq_parse_condition(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool permit_or, css_mq_cond **cond);
static css_error mq_parse_ratio(
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
const css_token *numerator, css_fixed *ratio)
{
const css_token *token;
@@ -260,7 +260,7 @@ static css_error mq_parse_range__convert_to_level_4(
}
static css_error mq_parse_range(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
const css_token *name_or_value,
css_mq_feature **feature)
{
@@ -443,7 +443,7 @@ static css_error mq_parse_range(lwc_string **strings,
}
static css_error mq_parse_media_feature(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_feature **feature)
{
const css_token *name_or_value, *token;
@@ -565,7 +565,7 @@ static css_error mq_parse_media_feature(lwc_string **strings,
* CSS Syntax Module Level 3: 8.2
*/
static css_error mq_parse_consume_any_value(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool until, const char until_char)
{
const css_token *token;
@@ -627,7 +627,7 @@ static css_error mq_parse_consume_any_value(lwc_string **strings,
}
static css_error mq_parse_general_enclosed(lwc_string **strings,
- const parserutils_vector *vector, int *ctx)
+ const parserutils_vector *vector, int32_t *ctx)
{
const css_token *token;
css_error error;
@@ -671,7 +671,7 @@ static css_error mq_parse_general_enclosed(lwc_string **strings,
}
static css_error mq_parse_media_in_parens(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_cond_or_feature **cond_or_feature)
{
const css_token *token;
@@ -754,7 +754,7 @@ static css_error mq_parse_media_in_parens(lwc_string **strings,
}
static css_error mq_parse_condition(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool permit_or, css_mq_cond **cond)
{
const css_token *token;
@@ -959,7 +959,7 @@ static css_error mq_parse_type(lwc_string **strings, lwc_string *type,
}
static css_error mq_parse_media_query(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_query **query)
{
const css_token *token;
@@ -984,7 +984,7 @@ static css_error mq_parse_media_query(lwc_string **strings,
lwc_string_caseless_isequal(token->idata,
strings[NOT], &match) == lwc_error_ok &&
match) {
- int old_ctx = *ctx;
+ int32_t old_ctx = *ctx;
parserutils_vector_iterate(vector, ctx);
consumeWhitespace(vector, ctx);
@@ -1100,7 +1100,7 @@ static css_error css__mq_parse__create_not_all(
}
css_error css__mq_parse_media_list(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_query **media)
{
css_mq_query *result = NULL, *last = NULL;
@@ -1162,7 +1162,7 @@ static css_error css_parse_media_query_handle_event(
const parserutils_vector *tokens,
void *pw)
{
- int idx = 0;
+ int32_t idx = 0;
css_error err;
css_mq_query *media;
const css_token *tok;
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 7a51578..ec19419 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -88,7 +88,7 @@ css_error css_parse_media_query(lwc_string **strings,
css_mq_query **media_out);
css_error css__mq_parse_media_list(lwc_string **strings,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_mq_query **media);
void css__mq_query_destroy(css_mq_query *media);
diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile
index 6461dda..df84d49 100644
--- a/src/parse/properties/Makefile
+++ b/src/parse/properties/Makefile
@@ -45,6 +45,7 @@ DIR_SOURCES := \
cue.c \
cursor.c \
elevation.c \
+ fill_opacity.c \
flex.c \
flex_flow.c \
font.c \
@@ -61,6 +62,7 @@ DIR_SOURCES := \
play_during.c \
properties.c \
quotes.c \
+ stroke_opacity.c \
text_decoration.c \
utils.c \
voice_family.c
diff --git a/src/parse/properties/azimuth.c b/src/parse/properties/azimuth.c
index c1ff9ae..a9265d1 100644
--- a/src/parse/properties/azimuth.c
+++ b/src/parse/properties/azimuth.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_azimuth(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c
index e11fcc9..20aeb30 100644
--- a/src/parse/properties/background.c
+++ b/src/parse/properties/background.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_background(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error = CSS_OK;
diff --git a/src/parse/properties/background_position.c b/src/parse/properties/background_position.c
index 534950c..1d87e6a 100644
--- a/src/parse/properties/background_position.c
+++ b/src/parse/properties/background_position.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_background_position(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
diff --git a/src/parse/properties/border.c b/src/parse/properties/border.c
index 26cdbcd..be269ab 100644
--- a/src/parse/properties/border.c
+++ b/src/parse/properties/border.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_TOP);
diff --git a/src/parse/properties/border_color.c b/src/parse/properties/border_color.c
index 41dbc2a..60b401e 100644
--- a/src/parse/properties/border_color.c
+++ b/src/parse/properties/border_color.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
diff --git a/src/parse/properties/border_spacing.c b/src/parse/properties/border_spacing.c
index b931eda..e00fb27 100644
--- a/src/parse/properties/border_spacing.c
+++ b/src/parse/properties/border_spacing.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_spacing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
css_fixed length[2] = { 0 };
diff --git a/src/parse/properties/border_style.c b/src/parse/properties/border_style.c
index 7be1f8d..4d54900 100644
--- a/src/parse/properties/border_style.c
+++ b/src/parse/properties/border_style.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
diff --git a/src/parse/properties/border_width.c b/src/parse/properties/border_width.c
index 90bd4cc..b11ca05 100644
--- a/src/parse/properties/border_width.c
+++ b/src/parse/properties/border_width.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
diff --git a/src/parse/properties/clip.c b/src/parse/properties/clip.c
index 76fa364..4bf653d 100644
--- a/src/parse/properties/clip.c
+++ b/src/parse/properties/clip.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_clip(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
int num_lengths = 0;
diff --git a/src/parse/properties/column_rule.c b/src/parse/properties/column_rule.c
index 146783c..7bfcad5 100644
--- a/src/parse/properties/column_rule.c
+++ b/src/parse/properties/column_rule.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_column_rule(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
diff --git a/src/parse/properties/columns.c b/src/parse/properties/columns.c
index edc7ee6..277a305 100644
--- a/src/parse/properties/columns.c
+++ b/src/parse/properties/columns.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_columns(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error = CSS_OK;
diff --git a/src/parse/properties/content.c b/src/parse/properties/content.c
index 186abcc..7c03c6a 100644
--- a/src/parse/properties/content.c
+++ b/src/parse/properties/content.c
@@ -29,11 +29,11 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_content(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
- css_error error;
+ int32_t orig_ctx = *ctx;
+ css_error error = CSS_INVALID;
const css_token *token;
enum flag_value flag_value;
bool match;
@@ -42,7 +42,7 @@ css_error css__parse_content(css_language *c,
token = parserutils_vector_iterate(vector, ctx);
if (token == NULL) {
*ctx = orig_ctx;
- return CSS_INVALID;
+ return error;
}
flag_value = get_css_flag_value(c, token);
diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c
index 1e8b007..85d8122 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -19,6 +19,12 @@
* list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
*/
+typedef enum {
+ CALC_ANY,
+ CALC_NUMBER,
+ CALC_UNIT,
+} calc_kind;
+
struct keyval {
char *key;
char *val;
@@ -44,7 +50,12 @@ struct keyval *get_keyval(char **pos)
} else {
kvlen = (endpos - *pos);
}
+
nkeyval = calloc(1, sizeof(struct keyval) + kvlen + 1);
+ if (nkeyval == NULL) {
+ /* allocation failed, cannot proceed */
+ return NULL;
+ }
memcpy(nkeyval + 1, *pos, kvlen);
@@ -106,7 +117,7 @@ void output_header(FILE *outputf, const char *descriptor, struct keyval *parser_
" * If the input is invalid, then \\a *ctx remains unchanged.\n"
" */\n"
"css_error css__parse_%s(css_language *c,\n"
- " const parserutils_vector *vector, int *ctx,\n"
+ " const parserutils_vector *vector, int32_t *ctx,\n"
" css_style *result%s)\n"
"{\n",
descriptor,
@@ -120,7 +131,7 @@ void output_header(FILE *outputf, const char *descriptor, struct keyval *parser_
void output_token_type_check(FILE *outputf, bool do_token_check, struct keyval_list *IDENT, struct keyval_list *URI, struct keyval_list *NUMBER)
{
fprintf(outputf,
- " int orig_ctx = *ctx;\n"
+ " int32_t orig_ctx = *ctx;\n"
" css_error error;\n"
" const css_token *token;\n"
" bool match;\n\n"
@@ -311,12 +322,35 @@ void output_color(FILE *outputf, struct keyval *parseid, struct keyval_list *kvl
parseid->val);
}
+void output_calc(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist)
+{
+ struct keyval *ckv = kvlist->item[0];
+ const char *kind;
+
+ if (strcmp(ckv->key, "NUMBER") == 0)
+ kind = "UNIT_CALC_NUMBER";
+ else if (strcmp(ckv->key, "ANY") == 0)
+ kind = "UNIT_CALC_ANY";
+ else
+ kind = ckv->key;
+
+ fprintf(outputf,
+ "if ((token->type == CSS_TOKEN_FUNCTION) && "
+ "(lwc_string_caseless_isequal(token->idata, c->strings[CALC], &match) == lwc_error_ok && match))"
+ " {\n"
+ "\t\terror = css__parse_calc(c, vector, ctx, result, buildOPV(%s, 0, %s), %s);\n"
+ "\t} else ",
+ parseid->val,
+ ckv->val,
+ kind
+ );
+}
+
void output_length_unit(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist)
{
struct keyval *ckv = kvlist->item[0];
int ident_count;
-
fprintf(outputf,
"{\n"
"\t\tcss_fixed length = 0;\n"
@@ -523,6 +557,7 @@ int main(int argc, char **argv)
struct keyval_list WRAP;
struct keyval_list NUMBER;
struct keyval_list COLOR;
+ struct keyval_list CALC;
if (argc < 2) {
@@ -555,6 +590,7 @@ int main(int argc, char **argv)
COLOR.count = 0;
LENGTH_UNIT.count = 0;
IDENT_LIST.count = 0;
+ CALC.count = 0;
curlist = &base;
@@ -570,7 +606,7 @@ int main(int argc, char **argv)
if (strcmp(rkv->key, "WRAP") == 0) {
WRAP.item[WRAP.count++] = rkv;
only_ident = false;
- } else if (strcmp(rkv->key, "NUMBER") == 0) {
+ } else if (curlist == &base && strcmp(rkv->key, "NUMBER") == 0) {
if (rkv->val[0] == '(') {
curlist = &NUMBER;
} else if (rkv->val[0] == ')') {
@@ -607,6 +643,14 @@ int main(int argc, char **argv)
}
only_ident = false;
do_token_check = false;
+ } else if (strcmp(rkv->key, "CALC") == 0) {
+ if (rkv->val[0] == '(') {
+ curlist = &CALC;
+ } else if (rkv->val[0] == ')') {
+ curlist = &base;
+ }
+ only_ident = false;
+ do_token_check = false;
} else if (strcmp(rkv->key, "COLOR") == 0) {
COLOR.item[COLOR.count++] = rkv;
do_token_check = false;
@@ -630,7 +674,7 @@ int main(int argc, char **argv)
/* header */
-output_header(outputf, descriptor, base.item[0], is_generic);
+ output_header(outputf, descriptor, base.item[0], is_generic);
if (WRAP.count > 0) {
output_wrap(outputf, base.item[0], &WRAP);
@@ -644,6 +688,10 @@ output_header(outputf, descriptor, base.item[0], is_generic);
if (URI.count > 0)
output_uri(outputf, base.item[0], &URI);
+ if (CALC.count > 0) {
+ output_calc(outputf, base.item[0], &CALC);
+ }
+
if (NUMBER.count > 0)
output_number(outputf, base.item[0], &NUMBER);
diff --git a/src/parse/properties/cue.c b/src/parse/properties/cue.c
index 98844bd..db64412 100644
--- a/src/parse/properties/cue.c
+++ b/src/parse/properties/cue.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_cue(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *first_token;
const css_token *token;
diff --git a/src/parse/properties/cursor.c b/src/parse/properties/cursor.c
index ad2200c..b61d9a9 100644
--- a/src/parse/properties/cursor.c
+++ b/src/parse/properties/cursor.c
@@ -27,10 +27,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_cursor(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_OK;
const css_token *token;
enum flag_value flag_value;
diff --git a/src/parse/properties/elevation.c b/src/parse/properties/elevation.c
index 7fe5bf2..b456799 100644
--- a/src/parse/properties/elevation.c
+++ b/src/parse/properties/elevation.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_elevation(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
diff --git a/src/parse/properties/fill_opacity.c b/src/parse/properties/fill_opacity.c
new file mode 100644
index 0000000..caed86f
--- /dev/null
+++ b/src/parse/properties/fill_opacity.c
@@ -0,0 +1,82 @@
+/*
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+#include <assert.h>
+#include <string.h>
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "parse/properties/properties.h"
+#include "parse/properties/utils.h"
+
+/**
+ * Parse fill-opacity
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result resulting style
+ * \return CSS_OK on success,
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
+ *
+ * Post condition: \a *ctx is updated with the next token to process
+ * If the input is invalid, then \a *ctx remains unchanged.
+ */
+css_error css__parse_fill_opacity(css_language *c,
+ const parserutils_vector *vector, int32_t *ctx,
+ css_style *result)
+{
+ int32_t orig_ctx = *ctx;
+ css_error error;
+ const css_token *token;
+ enum flag_value flag_value;
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_FILL_OPACITY);
+
+ } else if (token->type == CSS_TOKEN_NUMBER) {
+ css_fixed num = 0;
+ size_t consumed = 0;
+
+ num = css__number_from_lwc_string(token->idata, false, &consumed);
+ /* Invalid if there are trailing characters */
+ if (consumed != lwc_string_length(token->idata)) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ /* Clamp to range [0,1] */
+ if (num < 0)
+ num = 0;
+ if (num > INTTOFIX(1))
+ num = INTTOFIX(1);
+
+ error = css__stylesheet_style_appendOPV(result, CSS_PROP_FILL_OPACITY, 0, FILL_OPACITY_SET);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
+
+ error = css__stylesheet_style_append(result, num);
+ } else {
+ error = CSS_INVALID;
+ }
+
+ if (error != CSS_OK)
+ *ctx = orig_ctx;
+
+ return error;
+}
+
diff --git a/src/parse/properties/flex.c b/src/parse/properties/flex.c
index d8f3848..a29309b 100644
--- a/src/parse/properties/flex.c
+++ b/src/parse/properties/flex.c
@@ -29,10 +29,10 @@
*/
css_error css__parse_flex(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
diff --git a/src/parse/properties/flex_flow.c b/src/parse/properties/flex_flow.c
index 2d9c60a..a5e2926 100644
--- a/src/parse/properties/flex_flow.c
+++ b/src/parse/properties/flex_flow.c
@@ -29,10 +29,10 @@
*/
css_error css__parse_flex_flow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 7ce9701..2d95cd8 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -45,6 +45,7 @@ static inline uint32_t css__to_parse_unit(css_unit u)
case CSS_UNIT_S: return UNIT_S;
case CSS_UNIT_HZ: return UNIT_HZ;
case CSS_UNIT_KHZ: return UNIT_KHZ;
+ case CSS_UNIT_CALC: assert(0);
}
return 0;
@@ -224,12 +225,12 @@ static css_error parse_system_font(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_font(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
const css_token *token;
css_error error;
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
css_system_font system_font;
diff --git a/src/parse/properties/font_family.c b/src/parse/properties/font_family.c
index b309f45..2f8782e 100644
--- a/src/parse/properties/font_family.c
+++ b/src/parse/properties/font_family.c
@@ -99,10 +99,10 @@ static css_code_t font_family_value(css_language *c, const css_token *token, boo
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_font_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
bool match;
diff --git a/src/parse/properties/font_weight.c b/src/parse/properties/font_weight.c
index abe0b78..77ec9a1 100644
--- a/src/parse/properties/font_weight.c
+++ b/src/parse/properties/font_weight.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_font_weight(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
diff --git a/src/parse/properties/list_style.c b/src/parse/properties/list_style.c
index e6e8eae..1cb373a 100644
--- a/src/parse/properties/list_style.c
+++ b/src/parse/properties/list_style.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_list_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
diff --git a/src/parse/properties/list_style_type.c b/src/parse/properties/list_style_type.c
index fe66bcb..eb7f363 100644
--- a/src/parse/properties/list_style_type.c
+++ b/src/parse/properties/list_style_type.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_list_style_type(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *ident;
uint8_t flags = 0;
diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c
index 63adddc..1ee56f7 100644
--- a/src/parse/properties/margin.c
+++ b/src/parse/properties/margin.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_margin(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
uint16_t side_val[4];
diff --git a/src/parse/properties/opacity.c b/src/parse/properties/opacity.c
index 5d7b176..22acd76 100644
--- a/src/parse/properties/opacity.c
+++ b/src/parse/properties/opacity.c
@@ -27,10 +27,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_opacity(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
enum flag_value flag_value;
diff --git a/src/parse/properties/outline.c b/src/parse/properties/outline.c
index 8ceac8a..ac91ffd 100644
--- a/src/parse/properties/outline.c
+++ b/src/parse/properties/outline.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_outline(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error;
diff --git a/src/parse/properties/overflow.c b/src/parse/properties/overflow.c
index 7bc1938..dbb373a 100644
--- a/src/parse/properties/overflow.c
+++ b/src/parse/properties/overflow.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_overflow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error1, error2 = CSS_OK;
const css_token *token;
enum flag_value flag_value;
diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c
index bef3607..a87ffa5 100644
--- a/src/parse/properties/padding.c
+++ b/src/parse/properties/padding.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_padding(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_fixed side_length[4];
diff --git a/src/parse/properties/pause.c b/src/parse/properties/pause.c
index b238d20..e558337 100644
--- a/src/parse/properties/pause.c
+++ b/src/parse/properties/pause.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_pause(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *first_token;
const css_token *token;
diff --git a/src/parse/properties/play_during.c b/src/parse/properties/play_during.c
index 54e048f..da7f236 100644
--- a/src/parse/properties/play_during.c
+++ b/src/parse/properties/play_during.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_play_during(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
uint8_t flags = 0;
diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c
index 06524da..2cc849c 100644
--- a/src/parse/properties/properties.c
+++ b/src/parse/properties/properties.c
@@ -74,6 +74,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_display,
css__parse_elevation,
css__parse_empty_cells,
+ css__parse_fill_opacity,
css__parse_flex,
css__parse_flex_basis,
css__parse_flex_direction,
@@ -140,6 +141,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_speak,
css__parse_speech_rate,
css__parse_stress,
+ css__parse_stroke_opacity,
css__parse_table_layout,
css__parse_text_align,
css__parse_text_decoration,
@@ -261,6 +263,8 @@ const uint32_t property_unit_mask[CSS_N_PROPERTIES] = {
[CSS_PROP_WORD_SPACING] = UNIT_MASK_WORD_SPACING,
[CSS_PROP_Z_INDEX] = UNIT_MASK_Z_INDEX,
[CSS_PROP_OPACITY] = UNIT_MASK_OPACITY,
+ [CSS_PROP_FILL_OPACITY] = UNIT_MASK_FILL_OPACITY,
+ [CSS_PROP_STROKE_OPACITY] = UNIT_MASK_STROKE_OPACITY,
[CSS_PROP_BREAK_AFTER] = UNIT_MASK_BREAK_AFTER,
[CSS_PROP_BREAK_BEFORE] = UNIT_MASK_BREAK_BEFORE,
[CSS_PROP_BREAK_INSIDE] = UNIT_MASK_BREAK_INSIDE,
diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen
index b0e797c..3452f81 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -6,6 +6,13 @@
#property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
#property:CSS_PROP_ENUM WRAP:
+# When a property takes a NUMBER and/or LENGTH_UNIT you may add calc() support:
+# In the below, PROPERTY_FOO_CALC is the opcode enum for the set-but-calculated value bytecode.
+# e.g. HEIGHT_SET (for a LENGTH_UNIT) would be HEIGHT_CALC here.
+# CALC:( UNIT_??:PROPERTY_FOO_CALC CALC:) <-- When a default unit must be considered
+# CALC:( NUMBER:PROPERTY_FOO_CALC CALC:) <-- When a number must be produced (not a dimension)
+# CALC:( ANY:PROPERTY_FOO_CALC CALC:) <-- When a number or dimension is valid (e.g. line-height)
+
background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:)
border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: INITIAL: REVERT: UNSET: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:)
@@ -22,35 +29,35 @@ empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: INITIAL: REVERT: UNSET: SHOW:0
float:CSS_PROP_FLOAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
-font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
+font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:FONT_SIZE_CALC CALC:)
font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
-height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
+height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:HEIGHT_CALC CALC:)
-letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
+letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:) CALC:( UNIT_PX:LETTER_SPACING_CALC CALC:)
-line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
+line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( ANY:LINE_HEIGHT_CALC CALC:)
border_top:BORDER_SIDE_TOP WRAP:css__parse_border_side
border_bottom:BORDER_SIDE_BOTTOM WRAP:css__parse_border_side
border_left:BORDER_SIDE_LEFT WRAP:css__parse_border_side
border_right:BORDER_SIDE_RIGHT WRAP:css__parse_border_side
-max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
+max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MAX_HEIGHT_CALC CALC:)
-max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
+max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MAX_WIDTH_CALC CALC:)
-min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
+min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MIN_HEIGHT_CALC CALC:)
-min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
+min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MIN_WIDTH_CALC CALC:)
color:CSS_PROP_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLOR_SET
#generic for padding_{top, bottom, left, right}.c
-padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:)
+padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:PADDING_CALC CALC:)
padding_bottom:CSS_PROP_PADDING_BOTTOM WRAP:css__parse_padding_side
padding_left:CSS_PROP_PADDING_LEFT WRAP:css__parse_padding_side
@@ -59,7 +66,7 @@ padding_right:CSS_PROP_PADDING_RIGHT WRAP:css__parse_padding_side
#generic for margin_{top, bottom, left, right}.c
-margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
+margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:) CALC:( UNIT_PX:MARGIN_CALC CALC:)
margin_top:CSS_PROP_MARGIN_TOP WRAP:css__parse_margin_side
margin_bottom:CSS_PROP_MARGIN_BOTTOM WRAP:css__parse_margin_side
@@ -67,7 +74,7 @@ margin_left:CSS_PROP_MARGIN_LEFT WRAP:css__parse_margin_side
margin_right:CSS_PROP_MARGIN_RIGHT WRAP:css__parse_margin_side
#generic for {top, bottom, left, right}.c
-side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:)
+side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) LENGTH_UNIT:) CALC:( UNIT_PX:BOTTOM_CALC CALC:)
top:CSS_PROP_TOP WRAP:css__parse_side
bottom:CSS_PROP_BOTTOM WRAP:css__parse_side
@@ -76,7 +83,7 @@ right:CSS_PROP_RIGHT WRAP:css__parse_side
#generic for border_{top, bottom, left, right}_width.c
-border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
+border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:BORDER_WIDTH_CALC CALC:)
border_top_width:CSS_PROP_BORDER_TOP_WIDTH WRAP:css__parse_border_side_width
border_bottom_width:CSS_PROP_BORDER_BOTTOM_WIDTH WRAP:css__parse_border_side_width
@@ -120,7 +127,7 @@ list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: INITIAL: REVERT: UNS
list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
-orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:)
+orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:ORPHANS_CALC CALC:)
outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET
@@ -133,24 +140,23 @@ overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:
overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:)
-
page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:)
page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:)
page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
-pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:)
+pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_S:PAUSE_AFTER_CALC CALC:)
-pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:)
+pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_S:PAUSE_BEFORE_CALC CALC:)
-pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
+pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_HZ:PITCH_CALC CALC:)
-pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
+pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:) CALC:( NUMBER:PITCH_RANGE_CALC CALC:)
position:CSS_PROP_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED STICKY:0,POSITION_STICKY IDENT:)
-richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:)
+richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:) CALC:( NUMBER:RICHNESS_CALC CALC:)
speak:CSS_PROP_SPEAK IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:)
@@ -160,37 +166,35 @@ speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: INITIAL: REVERT: UNSET: DI
speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: INITIAL: REVERT: UNSET: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:)
-speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:)
+speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:SPEECH_RATE_CALC CALC:)
-stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:)
+stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:) CALC:( NUMBER:STRESS_CALC CALC:)
table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:)
text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:)
-text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:)
+text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT LENGTH_UNIT:) CALC:( UNIT_PX:TEXT_INDENT_CALC CALC:)
text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: INITIAL: REVERT: UNSET: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:)
unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
-vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:)
+vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN LENGTH_UNIT:) CALC:( UNIT_PX:VERTICAL_ALIGN_CALC CALC:)
visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: INITIAL: REVERT: UNSET: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
-volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
+volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:) CALC:( ANY:VOLUME_CALC CALC:)
white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:)
-widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
-
-
-width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:)
+widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:WIDOWS_CALC CALC:)
-word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
+width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:WIDTH_CALC CALC:)
-z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
+word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:) CALC:( UNIT_PX:WORD_SPACING_CALC CALC:)
+z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:) CALC:( NUMBER:Z_INDEX_CALC CALC:)
break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:)
@@ -198,11 +202,11 @@ break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO
break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:)
-column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:)
+column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:COLUMN_COUNT_CALC CALC:)
column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: INITIAL: REVERT: UNSET: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
-column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
+column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:) CALC:( UNIT_PX:COLUMN_GAP_CALC CALC:)
column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
@@ -212,7 +216,7 @@ column_rule_width:CSS_PROP_COLUMN_RULE_WIDTH WRAP:css__parse_border_side_width
column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: INITIAL: REVERT: UNSET: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
-column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:)
+column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:) CALC:( UNIT_PX:COLUMN_WIDTH_CALC CALC:)
writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: INITIAL: REVERT: UNSET: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:)
@@ -224,16 +228,16 @@ align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETC
align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: INITIAL: REVERT: UNSET: STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
-flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
+flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:FLEX_BASIS_CALC CALC:)
flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: UNSET: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE IDENT:)
-flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
+flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:FLEX_GROW_CALC CALC:)
-flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
+flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:FLEX_SHRINK_CALC CALC:)
flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:)
-order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORDER_SET NUMBER:)
+order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( true:ORDER_SET NUMBER:) CALC:( NUMBER:ORDER_CALC CALC:)
diff --git a/src/parse/properties/properties.h b/src/parse/properties/properties.h
index 1e7f821..17b7f41 100644
--- a/src/parse/properties/properties.h
+++ b/src/parse/properties/properties.h
@@ -17,445 +17,451 @@
* Type of property handler function
*/
typedef css_error (*css_prop_handler)(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
extern const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP];
css_error css__parse_align_content(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_align_items(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_align_self(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_azimuth(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_attachment(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_image(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_position(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_background_repeat(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_bottom(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_bottom_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_bottom_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_bottom_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_collapse(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_left(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_left_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_left_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_left_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_right(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_right_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_right_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_right_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_spacing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_top(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_top_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_top_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_top_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_border_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_bottom(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_box_sizing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_break_after(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_break_before(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_break_inside(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_caption_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_clear(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_clip(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_columns(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_count(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_fill(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_gap(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_rule(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_rule_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_rule_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_rule_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_span(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_column_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_content(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_counter_increment(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_counter_reset(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_cue(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_cue_after(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_cue_before(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_cursor(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_direction(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_display(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_elevation(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_empty_cells(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
+ css_style *result);
+css_error css__parse_fill_opacity(css_language *c,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_basis(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_direction(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_flow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_grow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_shrink(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_flex_wrap(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_float(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_size(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_variant(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_font_weight(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_height(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_justify_content(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_left(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_letter_spacing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_line_height(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_list_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_list_style_image(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_list_style_position(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_list_style_type(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin_bottom(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin_left(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin_right(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_margin_top(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_max_height(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_max_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_min_height(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_min_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_opacity(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_order(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_orphans(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_outline(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_outline_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_outline_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_outline_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_overflow(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_overflow_x(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_overflow_y(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding_bottom(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding_left(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding_right(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_padding_top(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_page_break_after(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_page_break_before(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_page_break_inside(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pause(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pause_after(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pause_before(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pitch_range(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_pitch(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_play_during(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_position(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_quotes(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_richness(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_right(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speak_header(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speak_numeral(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speak_punctuation(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speak(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_speech_rate(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_stress(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
+ css_style *result);
+css_error css__parse_stroke_opacity(css_language *c,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_table_layout(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_text_align(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_text_decoration(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_text_indent(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_text_transform(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_top(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_unicode_bidi(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_vertical_align(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_visibility(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_voice_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_volume(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_white_space(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_widows(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_word_spacing(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_writing_mode(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
css_error css__parse_z_index(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result);
/** Mapping from property bytecode index to bytecode unit class mask. */
@@ -546,6 +552,8 @@ extern const uint32_t property_unit_mask[CSS_N_PROPERTIES];
#define UNIT_MASK_WORD_SPACING (UNIT_LENGTH)
#define UNIT_MASK_Z_INDEX (0)
#define UNIT_MASK_OPACITY (0)
+#define UNIT_MASK_FILL_OPACITY (0)
+#define UNIT_MASK_STROKE_OPACITY (0)
#define UNIT_MASK_BREAK_AFTER (0)
#define UNIT_MASK_BREAK_BEFORE (0)
#define UNIT_MASK_BREAK_INSIDE (0)
diff --git a/src/parse/properties/quotes.c b/src/parse/properties/quotes.c
index b71158f..f5360a4 100644
--- a/src/parse/properties/quotes.c
+++ b/src/parse/properties/quotes.c
@@ -28,10 +28,10 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_quotes(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
enum flag_value flag_value;
diff --git a/src/parse/properties/stroke_opacity.c b/src/parse/properties/stroke_opacity.c
new file mode 100644
index 0000000..7c10998
--- /dev/null
+++ b/src/parse/properties/stroke_opacity.c
@@ -0,0 +1,82 @@
+/*
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+#include <assert.h>
+#include <string.h>
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "parse/properties/properties.h"
+#include "parse/properties/utils.h"
+
+/**
+ * Parse stroke-opacity
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result resulting style
+ * \return CSS_OK on success,
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not valid
+ *
+ * Post condition: \a *ctx is updated with the next token to process
+ * If the input is invalid, then \a *ctx remains unchanged.
+ */
+css_error css__parse_stroke_opacity(css_language *c,
+ const parserutils_vector *vector, int32_t *ctx,
+ css_style *result)
+{
+ int32_t orig_ctx = *ctx;
+ css_error error;
+ const css_token *token;
+ enum flag_value flag_value;
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ flag_value = get_css_flag_value(c, token);
+
+ if (flag_value != FLAG_VALUE__NONE) {
+ error = css_stylesheet_style_flag_value(result, flag_value,
+ CSS_PROP_STROKE_OPACITY);
+
+ } else if (token->type == CSS_TOKEN_NUMBER) {
+ css_fixed num = 0;
+ size_t consumed = 0;
+
+ num = css__number_from_lwc_string(token->idata, false, &consumed);
+ /* Invalid if there are trailing characters */
+ if (consumed != lwc_string_length(token->idata)) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ /* Clamp to range [0,1] */
+ if (num < 0)
+ num = 0;
+ if (num > INTTOFIX(1))
+ num = INTTOFIX(1);
+
+ error = css__stylesheet_style_appendOPV(result, CSS_PROP_STROKE_OPACITY, 0, STROKE_OPACITY_SET);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
+
+ error = css__stylesheet_style_append(result, num);
+ } else {
+ error = CSS_INVALID;
+ }
+
+ if (error != CSS_OK)
+ *ctx = orig_ctx;
+
+ return error;
+}
+
diff --git a/src/parse/properties/text_decoration.c b/src/parse/properties/text_decoration.c
index 1345b8e..acfda5f 100644
--- a/src/parse/properties/text_decoration.c
+++ b/src/parse/properties/text_decoration.c
@@ -28,14 +28,14 @@
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_text_decoration(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error = CSS_INVALID;
const css_token *token;
enum flag_value flag_value;
- bool match;
+ bool match = false;
/* IDENT([ underline || overline || line-through || blink ])
* | IDENT (none, inherit) */
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index 1e184f8..5af1695 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -126,10 +126,10 @@ css_error css__parse_list_style_type_value(css_language *c, const css_token *ide
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum border_side_e side)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx;
const css_token *token;
css_error error = CSS_OK;
@@ -366,10 +366,10 @@ static void HSL_to_RGB(css_fixed hue, css_fixed sat, css_fixed lit, uint8_t *r,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_colour_specifier(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint16_t *value, uint32_t *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
const css_token *token;
bool match;
css_error error;
@@ -913,11 +913,11 @@ css_error css__parse_hash_colour(lwc_string *data, uint32_t *result)
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_unit_specifier(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint32_t default_unit,
css_fixed *length, uint32_t *unit)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
const css_token *token;
css_fixed num;
size_t consumed = 0;
@@ -938,7 +938,7 @@ css_error css__parse_unit_specifier(css_language *c,
if (token->type == CSS_TOKEN_DIMENSION) {
size_t len = lwc_string_length(token->idata);
const char *data = lwc_string_data(token->idata);
- css_unit temp_unit = CSS_UNIT_PX;
+ uint32_t temp_unit = CSS_UNIT_PX;
error = css__parse_unit_keyword(data + consumed, len - consumed,
&temp_unit);
@@ -947,7 +947,7 @@ css_error css__parse_unit_specifier(css_language *c,
return error;
}
- *unit = (uint32_t) temp_unit;
+ *unit = temp_unit;
} else if (token->type == CSS_TOKEN_NUMBER) {
/* Non-zero values are permitted in quirks mode */
if (num != 0) {
@@ -966,8 +966,8 @@ css_error css__parse_unit_specifier(css_language *c,
* dimensions separated from their units by whitespace
* (e.g. "0 px")
*/
- int temp_ctx = *ctx;
- css_unit temp_unit;
+ int32_t temp_ctx = *ctx;
+ uint32_t temp_unit;
consumeWhitespace(vector, &temp_ctx);
@@ -981,7 +981,7 @@ css_error css__parse_unit_specifier(css_language *c,
if (error == CSS_OK) {
c->sheet->quirks_used = true;
*ctx = temp_ctx;
- *unit = (uint32_t) temp_unit;
+ *unit = temp_unit;
}
}
}
@@ -1103,7 +1103,7 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit)
* The resulting string's reference is passed to the caller
*/
css_error css__ident_list_or_string_to_string(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
lwc_string **result)
{
@@ -1141,11 +1141,11 @@ css_error css__ident_list_or_string_to_string(css_language *c,
* The resulting string's reference is passed to the caller
*/
css_error css__ident_list_to_string(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
lwc_string **result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
const css_token *token;
css_error error = CSS_OK;
parserutils_buffer *buffer;
@@ -1229,12 +1229,12 @@ cleanup:
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__comma_list_to_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
css_code_t (*get_value)(css_language *c, const css_token *token, bool first),
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
int prev_ctx = orig_ctx;
const css_token *token;
bool first = true;
@@ -1333,3 +1333,364 @@ cleanup:
return error;
}
+
+/******************************************************************************/
+
+/* CALC
+ *
+ * calc( <calc-sum> )
+ *
+ * where
+ * <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*
+ *
+ * where
+ * <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*
+ *
+ * where
+ * <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> )
+ *
+ *
+ * Once a calc() expression is parsed, it generates into the bytecode as
+ * an opV where the V is VALUE_IS_CALC, then a unit kind which is the
+ * expected resolved type for the calc, and a string index. The string is
+ * another kind of bytecode, essentially it's a sequence of stack machine
+ * operations which are one of the calc_opcodes enum. They are:
+ *
+ * * CALC_PUSH_NUMBER (N)
+ * - takes a css_fixed and pushes it onto the operand stack
+ * * CALC_PUSH_VALUE (V)
+ * - takes a css_fixed and a unit, and pushes them
+ * * CALC_{ADD,SUBTRACT,MULTIPLY,DIVIDE} (+ - * /)
+ * - pop two values, perform the operation, push the result
+ * * CALC_FINISH (=)
+ * - pop the top value from the stack and return it.
+ *
+ * As an example:
+ *
+ * calc(10px + (4rem / 2)) =>
+ * V 10 px
+ * V 4 rem
+ * N 2
+ * /
+ * +
+ * =
+ */
+
+static css_error
+css__parse_calc_sum(css_language *c,
+ enum css_properties_e property,
+ const parserutils_vector *vector, int *ctx,
+ parserutils_buffer *result);
+
+static css_error
+css__parse_calc_number(
+ const parserutils_vector *vector, int *ctx,
+ parserutils_buffer *result)
+{
+ const css_token *token;
+ css_fixed num;
+ size_t consumed;
+ css_code_t push = CALC_PUSH_NUMBER;
+
+ /* Consume the number token */
+ token = parserutils_vector_iterate(vector, ctx);
+ if (token == NULL || token->type != CSS_TOKEN_NUMBER) {
+ return CSS_INVALID;
+ }
+
+ num = css__number_from_string((const uint8_t *)lwc_string_data(token->idata),
+ lwc_string_length(token->idata), false, &consumed);
+
+ if (consumed != lwc_string_length(token->idata)) {
+ return CSS_INVALID;
+ }
+
+ return css_error_from_parserutils_error(
+ parserutils_buffer_appendv(result, 2,
+ &push, sizeof(push),
+ &num, sizeof(num)
+ )
+ );
+}
+
+static css_error
+css__parse_calc_value(css_language *c,
+ enum css_properties_e property,
+ const parserutils_vector *vector, int *ctx,
+ parserutils_buffer *result)
+{
+ css_error error;
+ int orig_ctx = *ctx;
+ const css_token *token;
+
+ /* On entry, we are already pointing at the value to parse, so peek it */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (tokenIsChar(token, '(')) {
+ parserutils_vector_iterate(vector, ctx);
+ consumeWhitespace(vector, ctx);
+ error = css__parse_calc_sum(c, property, vector, ctx, result);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ token = parserutils_vector_peek(vector, *ctx);
+ if (!tokenIsChar(token, ')')) {
+ return CSS_INVALID;
+ }
+ /* Consume the close-paren to complete this value */
+ parserutils_vector_iterate(vector, ctx);
+ } else switch (token->type) {
+ case CSS_TOKEN_NUMBER:
+ error = css__parse_calc_number(vector, ctx, result);
+ if (error != CSS_OK) {
+ return error;
+ }
+ break;
+ case CSS_TOKEN_DIMENSION: /* Fall through */
+ case CSS_TOKEN_PERCENTAGE:
+ {
+ css_fixed length = 0;
+ uint32_t unit = 0;
+ css_code_t push = CALC_PUSH_VALUE;
+ *ctx = orig_ctx;
+
+ error = css__parse_unit_specifier(c, vector, ctx, UNIT_CALC_NUMBER, &length, &unit);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
+
+ if (!(unit & property_unit_mask[property])) {
+ /* This unit is not valid for this property. */
+ return CSS_INVALID;
+ }
+
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_appendv(result, 3,
+ &push, sizeof(push),
+ &length, sizeof(length),
+ &unit, sizeof(unit)
+ )
+ );
+
+ }
+ break;
+
+ default:
+ error = CSS_INVALID;
+ break;
+ }
+
+ consumeWhitespace(vector, ctx);
+ return error;
+}
+
+/* Both this, and css_parse_calc_sum must stop when it encounters a close-paren.
+ * If it hasn't had any useful tokens before that, it's an error. It does not
+ * need to restore ctx before returning an error but it does need to ensure that
+ * the close paren has not been consumed
+ */
+static css_error
+css__parse_calc_product(css_language *c,
+ enum css_properties_e property,
+ const parserutils_vector *vector, int *ctx,
+ parserutils_buffer *result)
+{
+ css_error error = CSS_OK;
+ const css_token *token;
+ css_code_t operator;
+
+ /* First parse a value */
+ error = css__parse_calc_value(c, property, vector, ctx, result);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ do {
+ /* What is our next token? */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token == NULL) {
+ error = CSS_INVALID;
+ break;
+ } else if (
+ tokenIsChar(token, ')') ||
+ tokenIsChar(token, '+') ||
+ tokenIsChar(token, '-'))
+ break;
+ else if (tokenIsChar(token, '*'))
+ operator = CALC_MULTIPLY;
+ else if (tokenIsChar(token, '/'))
+ operator = CALC_DIVIDE;
+ else {
+ error = CSS_INVALID;
+ break;
+ }
+ /* Consume that * or / now */
+ parserutils_vector_iterate(vector, ctx);
+
+ consumeWhitespace(vector, ctx);
+
+ if (operator == CALC_MULTIPLY) {
+ /* parse another value */
+ error = css__parse_calc_value(c, property, vector,
+ ctx, result);
+ } else {
+ error = css__parse_calc_number(vector, ctx, result);
+ }
+ if (error != CSS_OK)
+ break;
+
+ /* emit the multiplication/division operator */
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(result, (const uint8_t *)&operator, sizeof(operator))
+ );
+ } while (1);
+ /* We've fallen off, either we had an error or we're left with ')' */
+ return error;
+}
+
+
+css_error
+css__parse_calc_sum(css_language *c,
+ enum css_properties_e property,
+ const parserutils_vector *vector, int *ctx,
+ parserutils_buffer *result)
+{
+ css_error error = CSS_OK;
+ const css_token *token;
+ css_code_t operator;
+
+ /* First parse a product */
+ error = css__parse_calc_product(c, property, vector, ctx, result);
+ if (error != CSS_OK) {
+ return error;
+ }
+
+ do {
+ /* What is our next token? */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token == NULL) {
+ error = CSS_INVALID;
+ break;
+ } else if (tokenIsChar(token, ')'))
+ break;
+ else if (tokenIsChar(token, '+'))
+ operator = CALC_ADD;
+ else if (tokenIsChar(token, '-'))
+ operator = CALC_SUBTRACT;
+ else {
+ error = CSS_INVALID;
+ break;
+ }
+ /* Consume that + or - now */
+ parserutils_vector_iterate(vector, ctx);
+ consumeWhitespace(vector, ctx);
+
+ /* parse another product */
+ error = css__parse_calc_product(c, property, vector, ctx, result);
+ if (error != CSS_OK)
+ break;
+
+ /* emit the addition/subtraction operator */
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(result, (const uint8_t *)&operator, sizeof(operator))
+ );
+ } while (1);
+ /* We've fallen off, either we had an error or we're left with ')' */
+ return error;
+}
+
+/* Documented in utils.h */
+css_error css__parse_calc(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result,
+ css_code_t OPV,
+ uint32_t unit)
+{
+ int orig_ctx = *ctx;
+ const css_token *token;
+ css_error error = CSS_OK;
+ css_style *calc_style = NULL;
+ parserutils_buffer *calc_buffer = NULL;
+ lwc_string *calc_expr = NULL;
+ uint32_t expr_index = 0;
+ css_code_t finish = CALC_FINISH;
+ enum css_properties_e property = getOpcode(OPV);
+
+ consumeWhitespace(vector, ctx);
+
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token == NULL) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ if (parserutils_buffer_create(&calc_buffer) != PARSERUTILS_OK) {
+ /* Since &calc_buffer is valid, the only error case is NONMEM */
+ *ctx = orig_ctx;
+ return CSS_NOMEM;
+ }
+
+ error = css__stylesheet_style_create(c->sheet, &calc_style);
+ if (error != CSS_OK)
+ goto cleanup;
+
+ error = css__stylesheet_style_append(calc_style, OPV);
+ if (error != CSS_OK)
+ goto cleanup;
+
+ error = css__stylesheet_style_append(calc_style, (css_code_t) unit);
+ if (error != CSS_OK)
+ goto cleanup;
+
+ error = css__parse_calc_sum(c, property, vector, ctx, calc_buffer);
+ if (error != CSS_OK)
+ goto cleanup;
+
+ consumeWhitespace(vector, ctx);
+ token = parserutils_vector_peek(vector, *ctx);
+ if (!tokenIsChar(token, ')')) {
+ /* If we don't get a close-paren, give up now */
+ error = CSS_INVALID;
+ goto cleanup;
+ }
+
+ /* Append the indicator that the calc is finished */
+ error = css_error_from_parserutils_error(
+ parserutils_buffer_append(calc_buffer, (const uint8_t *)&finish, sizeof(finish))
+ );
+ if (error != CSS_OK)
+ goto cleanup;
+
+ /* Swallow that close paren */
+ parserutils_vector_iterate(vector, ctx);
+
+ /* Create the lwc string representing the calculation and store it in */
+ error = css_error_from_lwc_error(
+ lwc_intern_string((const char *)calc_buffer->data, calc_buffer->length, &calc_expr)
+ );
+ if (error != CSS_OK)
+ goto cleanup;
+
+ /* This always takes ownership of calc_expr, so we should not use after this */
+ error = css__stylesheet_string_add(calc_style->sheet, calc_expr, &expr_index);
+ if (error != CSS_OK)
+ goto cleanup;
+
+ error = css__stylesheet_style_append(calc_style,
+ (css_code_t) expr_index);
+ if (error != CSS_OK) {
+ goto cleanup;
+ }
+
+ error = css__stylesheet_merge_style(result, calc_style);
+cleanup:
+ css__stylesheet_style_destroy(calc_style);
+ parserutils_buffer_destroy(calc_buffer);
+ /* We do not need to clean up calc_expr, it will never leak */
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ }
+
+ return error;
+}
diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h
index 54a3fd1..a079f35 100644
--- a/src/parse/properties/utils.h
+++ b/src/parse/properties/utils.h
@@ -66,7 +66,7 @@ enum border_side_e { BORDER_SIDE_TOP = 0, BORDER_SIDE_RIGHT = 1, BORDER_SIDE_BOT
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum border_side_e side);
/**
@@ -85,7 +85,7 @@ css_error css__parse_border_side(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side_color(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
/**
@@ -104,7 +104,7 @@ css_error css__parse_border_side_color(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
@@ -124,7 +124,7 @@ css_error css__parse_border_side_style(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_border_side_width(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
@@ -144,7 +144,7 @@ css_error css__parse_border_side_width(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
@@ -163,7 +163,7 @@ css_error css__parse_side(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_margin_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
/**
@@ -181,7 +181,7 @@ css_error css__parse_margin_side(css_language *c,
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_padding_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result, enum css_properties_e op);
@@ -194,7 +194,7 @@ css_error css__parse_list_style_type_value(css_language *c,
const css_token *token, uint16_t *value);
css_error css__parse_colour_specifier(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint16_t *value, uint32_t *result);
css_error css__parse_named_colour(css_language *c, lwc_string *data,
@@ -203,7 +203,7 @@ css_error css__parse_named_colour(css_language *c, lwc_string *data,
css_error css__parse_hash_colour(lwc_string *data, uint32_t *result);
css_error css__parse_unit_specifier(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
uint32_t default_unit,
css_fixed *length, uint32_t *unit);
@@ -211,21 +211,45 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len,
uint32_t *unit);
css_error css__ident_list_or_string_to_string(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
lwc_string **result);
css_error css__ident_list_to_string(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
lwc_string **result);
css_error css__comma_list_to_style(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
bool (*reserved)(css_language *c, const css_token *ident),
css_code_t (*get_value)(css_language *c,
const css_token *token,
bool first),
css_style *result);
+/**
+ * Parse a CSS calc() invocation
+ *
+ * Calc can generate a number of kinds of units, so we have to tell the
+ * parser the kind of unit we're aiming for (e.g. UNIT_PX, UNIT_ANGLE, etc.)
+ *
+ * \param[in] c Parsing context
+ * \param[in] vector Vector of tokens to process
+ * \param[in] ctx Pointer to vector iteration context
+ * \param[in] result Pointer to location to receive resulting style
+ * \param[in] OPV The CSS property we are calculating for
+ * \param[in] unit The kind of unit which we want to come out of this calc()
+ * \return CSS_OK on success,
+ * CSS_NOMEM on memory exhaustion,
+ CSS_INVALID if the input is not valid
+ *
+ * Post condition: \a *ctx is updated with the next token to process
+ * If the input is invalid, then \a *ctx remains unchanged.
+ */
+css_error css__parse_calc(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result,
+ css_code_t OPV,
+ uint32_t unit);
#endif
diff --git a/src/parse/properties/voice_family.c b/src/parse/properties/voice_family.c
index f62ba15..45d63f1 100644
--- a/src/parse/properties/voice_family.c
+++ b/src/parse/properties/voice_family.c
@@ -84,10 +84,10 @@ static css_code_t voice_family_value(css_language *c, const css_token *token, bo
* If the input is invalid, then \a *ctx remains unchanged.
*/
css_error css__parse_voice_family(css_language *c,
- const parserutils_vector *vector, int *ctx,
+ const parserutils_vector *vector, int32_t *ctx,
css_style *result)
{
- int orig_ctx = *ctx;
+ int32_t orig_ctx = *ctx;
css_error error;
const css_token *token;
enum flag_value flag_value;
diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c
index 786a3b7..ff4aab1 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -148,6 +148,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("display"),
SMAP("elevation"),
SMAP("empty-cells"),
+ SMAP("fill-opacity"),
SMAP("flex"),
SMAP("flex-basis"),
SMAP("flex-direction"),
@@ -214,6 +215,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("speak"),
SMAP("speech-rate"),
SMAP("stress"),
+ SMAP("stroke-opacity"),
SMAP("table-layout"),
SMAP("text-align"),
SMAP("text-decoration"),
@@ -489,6 +491,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
SMAP("grid"),
SMAP("inline-grid"),
SMAP("sticky"),
+ SMAP("calc"),
SMAP("aliceblue"),
SMAP("antiquewhite"),
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index 6d6dd49..968d2b2 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -51,22 +51,23 @@ enum {
COLUMN_COUNT, COLUMN_FILL, COLUMN_GAP, COLUMN_RULE, COLUMN_RULE_COLOR,
COLUMN_RULE_STYLE, COLUMN_RULE_WIDTH, COLUMN_SPAN, COLUMN_WIDTH,
CONTENT, COUNTER_INCREMENT, COUNTER_RESET, CUE, CUE_AFTER, CUE_BEFORE,
- CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, FLEX, FLEX_BASIS,
- FLEX_DIRECTION, FLEX_FLOW, FLEX_GROW, FLEX_SHRINK, FLEX_WRAP,
- LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_VARIANT,
- FONT_WEIGHT, HEIGHT, JUSTIFY_CONTENT, LEFT, LETTER_SPACING, LINE_HEIGHT,
- LIST_STYLE, LIST_STYLE_IMAGE, LIST_STYLE_POSITION, LIST_STYLE_TYPE,
- MARGIN, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP,
- MAX_HEIGHT, MAX_WIDTH, MIN_HEIGHT, MIN_WIDTH, OPACITY, ORDER, ORPHANS,
- OUTLINE, OUTLINE_COLOR, OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW,
- OVERFLOW_X, OVERFLOW_Y, PADDING, PADDING_BOTTOM, PADDING_LEFT,
- PADDING_RIGHT, PADDING_TOP, PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE,
- PAGE_BREAK_INSIDE, PAUSE, PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH,
- PLAY_DURING, POSITION, QUOTES, RICHNESS, RIGHT, SPEAK_HEADER,
- SPEAK_NUMERAL, SPEAK_PUNCTUATION, SPEAK, SPEECH_RATE, STRESS,
- TABLE_LAYOUT, TEXT_ALIGN, TEXT_DECORATION, TEXT_INDENT, TEXT_TRANSFORM,
- TOP, UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME,
- WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, WRITING_MODE, Z_INDEX,
+ CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, FILL_OPACITY, FLEX,
+ FLEX_BASIS, FLEX_DIRECTION, FLEX_FLOW, FLEX_GROW, FLEX_SHRINK,
+ FLEX_WRAP, LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE,
+ FONT_VARIANT, FONT_WEIGHT, HEIGHT, JUSTIFY_CONTENT, LEFT,
+ LETTER_SPACING, LINE_HEIGHT, LIST_STYLE, LIST_STYLE_IMAGE,
+ LIST_STYLE_POSITION, LIST_STYLE_TYPE, MARGIN, MARGIN_BOTTOM,
+ MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, MAX_HEIGHT, MAX_WIDTH,
+ MIN_HEIGHT, MIN_WIDTH, OPACITY, ORDER, ORPHANS, OUTLINE, OUTLINE_COLOR,
+ OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, OVERFLOW_X, OVERFLOW_Y, PADDING,
+ PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT, PADDING_TOP,
+ PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE, PAGE_BREAK_INSIDE, PAUSE,
+ PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH, PLAY_DURING, POSITION,
+ QUOTES, RICHNESS, RIGHT, SPEAK_HEADER, SPEAK_NUMERAL, SPEAK_PUNCTUATION,
+ SPEAK, SPEECH_RATE, STRESS, STROKE_OPACITY, TABLE_LAYOUT, TEXT_ALIGN,
+ TEXT_DECORATION, TEXT_INDENT, TEXT_TRANSFORM, TOP, UNICODE_BIDI,
+ VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME, WHITE_SPACE, WIDOWS,
+ WIDTH, WORD_SPACING, WRITING_MODE, Z_INDEX,
LAST_PROP = Z_INDEX,
@@ -109,7 +110,7 @@ enum {
VERTICAL_LR, CONTENT_BOX, BORDER_BOX, STRETCH, INLINE_FLEX, FLEX_START,
FLEX_END, SPACE_BETWEEN, SPACE_AROUND, SPACE_EVENLY, ROW, ROW_REVERSE,
COLUMN_REVERSE, WRAP_STRING, WRAP_REVERSE, AND, OR, ONLY, INFINITE,
- GRID, INLINE_GRID, STICKY,
+ GRID, INLINE_GRID, STICKY, CALC,
/* Named colours */
FIRST_COLOUR,
diff --git a/src/select/Makefile b/src/select/Makefile
index b9e7390..1c61909 100644
--- a/src/select/Makefile
+++ b/src/select/Makefile
@@ -1,7 +1,8 @@
# Sources
+.PHONY: select_generator
select_generator:
python3 src/select/select_generator.py
-DIR_SOURCES := arena.c computed.c dispatch.c hash.c select.c strings.c font_face.c format_list_style.c unit.c
+DIR_SOURCES := arena.c calc.c computed.c dispatch.c hash.c select.c strings.c font_face.c format_list_style.c unit.c
include $(NSBUILD)/Makefile.subdir
diff --git a/src/select/assets.py b/src/select/assets.py
index 67c6b6b..0372b4c 100644
--- a/src/select/assets.py
+++ b/src/select/assets.py
@@ -10,21 +10,46 @@ copyright = '''\
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2017 The NetSurf Project
*/
+
+'''
+
+def ifndef(name):
+ name = name.upper()
+ name = f"CSS_COMPUTED_{name}_H_"
+ return f"#ifndef {name}\n#define {name}\n"
+
+include_propget = '''\
+
+#include "select/propget.h"
+'''
+
+include_calc = '''\
+
+#include "select/calc.h"
+'''
+
+calc_unions = '''\
+
+typedef union {
+ css_fixed value;
+ lwc_string *calc;
+} css_fixed_or_calc;
'''
assets = {}
assets['computed.h'] = {}
-assets['computed.h']['header'] = copyright
-assets['computed.h']['footer'] = ''
+assets['computed.h']['header'] = copyright + ifndef("computed") + include_calc + calc_unions
+assets['computed.h']['footer'] = '\n#endif\n'
assets['propset.h'] = {}
-assets['propset.h']['header'] = copyright + '''
-/** Default values are 'initial value', unless the property is inherited,
- * in which case it is 'inherit'. */'''
-assets['propset.h']['footer'] = ''
+assets['propset.h']['header'] = copyright + ifndef("propset") + include_propget
+assets['propset.h']['footer'] = '\n#endif\n'
assets['propget.h'] = {}
-assets['propget.h']['header'] = copyright
-assets['propget.h']['footer'] = ''
+assets['propget.h']['header'] = copyright + ifndef("propget")
+assets['propget.h']['footer'] = '\n#endif\n'
+assets['destroy.inc'] = {}
+assets['destroy.inc']['header'] = copyright
+assets['destroy.inc']['footer'] = ''
diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h
index b26560d..d83a2e7 100644
--- a/src/select/autogenerated_computed.h
+++ b/src/select/autogenerated_computed.h
@@ -5,6 +5,16 @@
* Copyright 2017 The NetSurf Project
*/
+#ifndef CSS_COMPUTED_COMPUTED_H_
+#define CSS_COMPUTED_COMPUTED_H_
+
+#include "select/calc.h"
+
+typedef union {
+ css_fixed value;
+ lwc_string *calc;
+} css_fixed_or_calc;
+
struct css_computed_style_i {
/*
@@ -52,6 +62,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
@@ -95,6 +106,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
@@ -140,9 +152,9 @@ struct css_computed_style_i {
* quotes 1 sizeof(ptr)
*
* --- --- ---
- * 462 bits 228 + 8sizeof(ptr) bytes
+ * 464 bits 236 + 8sizeof(ptr) bytes
* ===================
- * 286 + 8sizeof(ptr) bytes
+ * 294 + 8sizeof(ptr) bytes
*
* Bit allocations:
*
@@ -192,15 +204,15 @@ 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 bbaaorplfecuCk..................
- * background_color; background_attachment; orphans; order; opacity;
- * list_style_image; flex_shrink; flex_grow; counter_reset; counter_increment;
- * color; background_image
+ * 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
*/
uint32_t bits[15];
@@ -229,6 +241,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;
@@ -256,14 +269,14 @@ 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;
int32_t widows;
- css_fixed width;
+ css_fixed_or_calc width;
css_fixed word_spacing;
int32_t z_index;
-
};
struct css_computed_style {
@@ -279,4 +292,7 @@ struct css_computed_style {
struct css_computed_style *next;
uint32_t count;
uint32_t bin;
+ css_calculator *calc;
};
+
+#endif
diff --git a/src/select/autogenerated_destroy.inc b/src/select/autogenerated_destroy.inc
new file mode 100644
index 0000000..078ea10
--- /dev/null
+++ b/src/select/autogenerated_destroy.inc
@@ -0,0 +1,116 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2017 The NetSurf Project
+ */
+
+
+/* set_align_content(style, 0, 0, CSS_UNIT_PX); */
+/* set_align_items(style, 0, 0, CSS_UNIT_PX); */
+/* set_align_self(style, 0, 0, CSS_UNIT_PX); */
+/* set_background_attachment(style, 0, 0, CSS_UNIT_PX); */
+/* set_background_color(style, 0, 0, CSS_UNIT_PX); */
+/* set_background_image(style, 0, 0, CSS_UNIT_PX); */
+/* set_background_position(style, 0, 0, CSS_UNIT_PX); */
+/* set_background_repeat(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_bottom_color(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_bottom_style(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_bottom_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_collapse(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_left_color(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_left_style(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_left_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_right_color(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_right_style(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_right_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_spacing(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_top_color(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_top_style(style, 0, 0, CSS_UNIT_PX); */
+/* set_border_top_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_bottom(style, 0, 0, CSS_UNIT_PX); */
+/* set_box_sizing(style, 0, 0, CSS_UNIT_PX); */
+/* set_break_after(style, 0, 0, CSS_UNIT_PX); */
+/* set_break_before(style, 0, 0, CSS_UNIT_PX); */
+/* set_break_inside(style, 0, 0, CSS_UNIT_PX); */
+/* set_caption_side(style, 0, 0, CSS_UNIT_PX); */
+/* set_clear(style, 0, 0, CSS_UNIT_PX); */
+/* set_clip(style, 0, 0, CSS_UNIT_PX); */
+/* set_color(style, 0, 0, CSS_UNIT_PX); */
+/* set_column_count(style, 0, 0, CSS_UNIT_PX); */
+/* set_column_fill(style, 0, 0, CSS_UNIT_PX); */
+/* set_column_gap(style, 0, 0, CSS_UNIT_PX); */
+/* set_column_rule_color(style, 0, 0, CSS_UNIT_PX); */
+/* set_column_rule_style(style, 0, 0, CSS_UNIT_PX); */
+/* set_column_rule_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_column_span(style, 0, 0, CSS_UNIT_PX); */
+/* set_column_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_content(style, 0, 0, CSS_UNIT_PX); */
+/* set_counter_increment(style, 0, 0, CSS_UNIT_PX); */
+/* set_counter_reset(style, 0, 0, CSS_UNIT_PX); */
+/* set_cursor(style, 0, 0, CSS_UNIT_PX); */
+/* set_direction(style, 0, 0, CSS_UNIT_PX); */
+/* set_display(style, 0, 0, CSS_UNIT_PX); */
+/* set_empty_cells(style, 0, 0, CSS_UNIT_PX); */
+/* set_fill_opacity(style, 0, 0, CSS_UNIT_PX); */
+/* set_flex_basis(style, 0, 0, CSS_UNIT_PX); */
+/* set_flex_direction(style, 0, 0, CSS_UNIT_PX); */
+/* set_flex_grow(style, 0, 0, CSS_UNIT_PX); */
+/* set_flex_shrink(style, 0, 0, CSS_UNIT_PX); */
+/* set_flex_wrap(style, 0, 0, CSS_UNIT_PX); */
+/* set_float(style, 0, 0, CSS_UNIT_PX); */
+/* set_font_family(style, 0, 0, CSS_UNIT_PX); */
+/* set_font_size(style, 0, 0, CSS_UNIT_PX); */
+/* set_font_style(style, 0, 0, CSS_UNIT_PX); */
+/* set_font_variant(style, 0, 0, CSS_UNIT_PX); */
+/* set_font_weight(style, 0, 0, CSS_UNIT_PX); */
+/* set_height(style, 0, 0, CSS_UNIT_PX); */
+/* set_justify_content(style, 0, 0, CSS_UNIT_PX); */
+/* set_left(style, 0, 0, CSS_UNIT_PX); */
+/* set_letter_spacing(style, 0, 0, CSS_UNIT_PX); */
+/* set_line_height(style, 0, 0, CSS_UNIT_PX); */
+/* set_list_style_image(style, 0, 0, CSS_UNIT_PX); */
+/* set_list_style_position(style, 0, 0, CSS_UNIT_PX); */
+/* set_list_style_type(style, 0, 0, CSS_UNIT_PX); */
+/* set_margin_bottom(style, 0, 0, CSS_UNIT_PX); */
+/* set_margin_left(style, 0, 0, CSS_UNIT_PX); */
+/* set_margin_right(style, 0, 0, CSS_UNIT_PX); */
+/* set_margin_top(style, 0, 0, CSS_UNIT_PX); */
+/* set_max_height(style, 0, 0, CSS_UNIT_PX); */
+/* set_max_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_min_height(style, 0, 0, CSS_UNIT_PX); */
+/* set_min_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_opacity(style, 0, 0, CSS_UNIT_PX); */
+/* set_order(style, 0, 0, CSS_UNIT_PX); */
+/* set_orphans(style, 0, 0, CSS_UNIT_PX); */
+/* set_outline_color(style, 0, 0, CSS_UNIT_PX); */
+/* set_outline_style(style, 0, 0, CSS_UNIT_PX); */
+/* set_outline_width(style, 0, 0, CSS_UNIT_PX); */
+/* set_overflow_x(style, 0, 0, CSS_UNIT_PX); */
+/* set_overflow_y(style, 0, 0, CSS_UNIT_PX); */
+/* set_padding_bottom(style, 0, 0, CSS_UNIT_PX); */
+/* set_padding_left(style, 0, 0, CSS_UNIT_PX); */
+/* set_padding_right(style, 0, 0, CSS_UNIT_PX); */
+/* set_padding_top(style, 0, 0, CSS_UNIT_PX); */
+/* set_page_break_after(style, 0, 0, CSS_UNIT_PX); */
+/* set_page_break_before(style, 0, 0, CSS_UNIT_PX); */
+/* set_page_break_inside(style, 0, 0, CSS_UNIT_PX); */
+/* set_position(style, 0, 0, CSS_UNIT_PX); */
+/* set_quotes(style, 0, 0, CSS_UNIT_PX); */
+/* set_right(style, 0, 0, CSS_UNIT_PX); */
+/* set_stroke_opacity(style, 0, 0, CSS_UNIT_PX); */
+/* set_table_layout(style, 0, 0, CSS_UNIT_PX); */
+/* set_text_align(style, 0, 0, CSS_UNIT_PX); */
+/* set_text_decoration(style, 0, 0, CSS_UNIT_PX); */
+/* set_text_indent(style, 0, 0, CSS_UNIT_PX); */
+/* set_text_transform(style, 0, 0, CSS_UNIT_PX); */
+/* set_top(style, 0, 0, CSS_UNIT_PX); */
+/* set_unicode_bidi(style, 0, 0, CSS_UNIT_PX); */
+/* set_vertical_align(style, 0, 0, CSS_UNIT_PX); */
+/* set_visibility(style, 0, 0, CSS_UNIT_PX); */
+/* set_white_space(style, 0, 0, CSS_UNIT_PX); */
+/* set_widows(style, 0, 0, CSS_UNIT_PX); */
+set_width(style, 0, (css_fixed_or_calc)0, CSS_UNIT_PX);
+/* set_word_spacing(style, 0, 0, CSS_UNIT_PX); */
+/* set_writing_mode(style, 0, 0, CSS_UNIT_PX); */
+/* set_z_index(style, 0, 0, CSS_UNIT_PX); */
diff --git a/src/select/autogenerated_propget.h b/src/select/autogenerated_propget.h
index cf82c86..e335132 100644
--- a/src/select/autogenerated_propget.h
+++ b/src/select/autogenerated_propget.h
@@ -5,10 +5,22 @@
* Copyright 2017 The NetSurf Project
*/
+#ifndef CSS_COMPUTED_PROPGET_H_
+#define CSS_COMPUTED_PROPGET_H_
+
#define ALIGN_CONTENT_INDEX 10
#define ALIGN_CONTENT_SHIFT 20
#define ALIGN_CONTENT_MASK 0x700000
+static inline uint8_t get_align_content_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[ALIGN_CONTENT_INDEX];
+ bits &= ALIGN_CONTENT_MASK;
+ bits >>= ALIGN_CONTENT_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_align_content(const css_computed_style *style)
{
uint32_t bits = style->i.bits[ALIGN_CONTENT_INDEX];
@@ -26,6 +38,15 @@ static inline uint8_t get_align_content(const css_computed_style *style)
#define ALIGN_ITEMS_INDEX 10
#define ALIGN_ITEMS_SHIFT 23
#define ALIGN_ITEMS_MASK 0x3800000
+static inline uint8_t get_align_items_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[ALIGN_ITEMS_INDEX];
+ bits &= ALIGN_ITEMS_MASK;
+ bits >>= ALIGN_ITEMS_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_align_items(const css_computed_style *style)
{
uint32_t bits = style->i.bits[ALIGN_ITEMS_INDEX];
@@ -43,6 +64,15 @@ static inline uint8_t get_align_items(const css_computed_style *style)
#define ALIGN_SELF_INDEX 10
#define ALIGN_SELF_SHIFT 26
#define ALIGN_SELF_MASK 0x1c000000
+static inline uint8_t get_align_self_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[ALIGN_SELF_INDEX];
+ bits &= ALIGN_SELF_MASK;
+ bits >>= ALIGN_SELF_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_align_self(const css_computed_style *style)
{
uint32_t bits = style->i.bits[ALIGN_SELF_INDEX];
@@ -60,6 +90,16 @@ static inline uint8_t get_align_self(const css_computed_style *style)
#define BACKGROUND_ATTACHMENT_INDEX 14
#define BACKGROUND_ATTACHMENT_SHIFT 28
#define BACKGROUND_ATTACHMENT_MASK 0x30000000
+static inline uint8_t get_background_attachment_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
+ bits &= BACKGROUND_ATTACHMENT_MASK;
+ bits >>= BACKGROUND_ATTACHMENT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_background_attachment(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
@@ -77,6 +117,15 @@ static inline uint8_t get_background_attachment(const css_computed_style *style)
#define BACKGROUND_COLOR_INDEX 14
#define BACKGROUND_COLOR_SHIFT 30
#define BACKGROUND_COLOR_MASK 0xc0000000
+static inline uint8_t get_background_color_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_COLOR_INDEX];
+ bits &= BACKGROUND_COLOR_MASK;
+ bits >>= BACKGROUND_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_background_color(const css_computed_style *style,
css_color *color)
{
@@ -94,8 +143,17 @@ 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 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];
+ bits &= BACKGROUND_IMAGE_MASK;
+ bits >>= BACKGROUND_IMAGE_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_background_image(const css_computed_style *style,
lwc_string **string)
{
@@ -115,6 +173,16 @@ static inline uint8_t get_background_image(const css_computed_style *style,
#define BACKGROUND_POSITION_INDEX 12
#define BACKGROUND_POSITION_SHIFT 10
#define BACKGROUND_POSITION_MASK 0x1ffc00
+static inline uint8_t get_background_position_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_POSITION_INDEX];
+ bits &= BACKGROUND_POSITION_MASK;
+ bits >>= BACKGROUND_POSITION_SHIFT;
+
+ /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_background_position(const css_computed_style *style,
css_fixed *length_a, css_unit *unit_a, css_fixed *length_b,
css_unit *unit_b)
@@ -140,6 +208,16 @@ static inline uint8_t get_background_position(const css_computed_style *style,
#define BACKGROUND_REPEAT_INDEX 10
#define BACKGROUND_REPEAT_SHIFT 29
#define BACKGROUND_REPEAT_MASK 0xe0000000
+static inline uint8_t get_background_repeat_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BACKGROUND_REPEAT_INDEX];
+ bits &= BACKGROUND_REPEAT_MASK;
+ bits >>= BACKGROUND_REPEAT_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_background_repeat(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BACKGROUND_REPEAT_INDEX];
@@ -157,6 +235,16 @@ static inline uint8_t get_background_repeat(const css_computed_style *style)
#define BORDER_BOTTOM_COLOR_INDEX 11
#define BORDER_BOTTOM_COLOR_SHIFT 0
#define BORDER_BOTTOM_COLOR_MASK 0x3
+static inline uint8_t get_border_bottom_color_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
+ bits &= BORDER_BOTTOM_COLOR_MASK;
+ bits >>= BORDER_BOTTOM_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_bottom_color(const css_computed_style *style,
css_color *color)
{
@@ -176,6 +264,16 @@ static inline uint8_t get_border_bottom_color(const css_computed_style *style,
#define BORDER_BOTTOM_STYLE_INDEX 13
#define BORDER_BOTTOM_STYLE_SHIFT 28
#define BORDER_BOTTOM_STYLE_MASK 0xf0000000
+static inline uint8_t get_border_bottom_style_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
+ bits &= BORDER_BOTTOM_STYLE_MASK;
+ bits >>= BORDER_BOTTOM_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_border_bottom_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
@@ -193,6 +291,16 @@ static inline uint8_t get_border_bottom_style(const css_computed_style *style)
#define BORDER_BOTTOM_WIDTH_INDEX 0
#define BORDER_BOTTOM_WIDTH_SHIFT 0
#define BORDER_BOTTOM_WIDTH_MASK 0xff
+static inline uint8_t get_border_bottom_width_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
+ bits &= BORDER_BOTTOM_WIDTH_MASK;
+ bits >>= BORDER_BOTTOM_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_border_bottom_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -215,6 +323,15 @@ static inline uint8_t get_border_bottom_width(const css_computed_style *style,
#define BORDER_COLLAPSE_INDEX 11
#define BORDER_COLLAPSE_SHIFT 2
#define BORDER_COLLAPSE_MASK 0xc
+static inline uint8_t get_border_collapse_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_COLLAPSE_INDEX];
+ bits &= BORDER_COLLAPSE_MASK;
+ bits >>= BORDER_COLLAPSE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_collapse(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_COLLAPSE_INDEX];
@@ -232,6 +349,16 @@ static inline uint8_t get_border_collapse(const css_computed_style *style)
#define BORDER_LEFT_COLOR_INDEX 11
#define BORDER_LEFT_COLOR_SHIFT 4
#define BORDER_LEFT_COLOR_MASK 0x30
+static inline uint8_t get_border_left_color_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_LEFT_COLOR_INDEX];
+ bits &= BORDER_LEFT_COLOR_MASK;
+ bits >>= BORDER_LEFT_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_left_color(const css_computed_style *style,
css_color *color)
{
@@ -251,6 +378,16 @@ static inline uint8_t get_border_left_color(const css_computed_style *style,
#define BORDER_LEFT_STYLE_INDEX 9
#define BORDER_LEFT_STYLE_SHIFT 3
#define BORDER_LEFT_STYLE_MASK 0x78
+static inline uint8_t get_border_left_style_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_LEFT_STYLE_INDEX];
+ bits &= BORDER_LEFT_STYLE_MASK;
+ bits >>= BORDER_LEFT_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_border_left_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_LEFT_STYLE_INDEX];
@@ -268,6 +405,16 @@ static inline uint8_t get_border_left_style(const css_computed_style *style)
#define BORDER_LEFT_WIDTH_INDEX 0
#define BORDER_LEFT_WIDTH_SHIFT 8
#define BORDER_LEFT_WIDTH_MASK 0xff00
+static inline uint8_t get_border_left_width_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_LEFT_WIDTH_INDEX];
+ bits &= BORDER_LEFT_WIDTH_MASK;
+ bits >>= BORDER_LEFT_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_border_left_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -290,6 +437,16 @@ static inline uint8_t get_border_left_width(const css_computed_style *style,
#define BORDER_RIGHT_COLOR_INDEX 11
#define BORDER_RIGHT_COLOR_SHIFT 6
#define BORDER_RIGHT_COLOR_MASK 0xc0
+static inline uint8_t get_border_right_color_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_RIGHT_COLOR_INDEX];
+ bits &= BORDER_RIGHT_COLOR_MASK;
+ bits >>= BORDER_RIGHT_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_right_color(const css_computed_style *style,
css_color *color)
{
@@ -309,6 +466,16 @@ static inline uint8_t get_border_right_color(const css_computed_style *style,
#define BORDER_RIGHT_STYLE_INDEX 9
#define BORDER_RIGHT_STYLE_SHIFT 7
#define BORDER_RIGHT_STYLE_MASK 0x780
+static inline uint8_t get_border_right_style_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_RIGHT_STYLE_INDEX];
+ bits &= BORDER_RIGHT_STYLE_MASK;
+ bits >>= BORDER_RIGHT_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_border_right_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_RIGHT_STYLE_INDEX];
@@ -326,6 +493,16 @@ static inline uint8_t get_border_right_style(const css_computed_style *style)
#define BORDER_RIGHT_WIDTH_INDEX 0
#define BORDER_RIGHT_WIDTH_SHIFT 16
#define BORDER_RIGHT_WIDTH_MASK 0xff0000
+static inline uint8_t get_border_right_width_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
+ bits &= BORDER_RIGHT_WIDTH_MASK;
+ bits >>= BORDER_RIGHT_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_border_right_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -348,6 +525,15 @@ static inline uint8_t get_border_right_width(const css_computed_style *style,
#define BORDER_SPACING_INDEX 12
#define BORDER_SPACING_SHIFT 21
#define BORDER_SPACING_MASK 0xffe00000
+static inline uint8_t get_border_spacing_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_SPACING_INDEX];
+ bits &= BORDER_SPACING_MASK;
+ bits >>= BORDER_SPACING_SHIFT;
+
+ /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_border_spacing(const css_computed_style *style,
css_fixed *length_a, css_unit *unit_a, css_fixed *length_b,
css_unit *unit_b)
@@ -373,6 +559,15 @@ static inline uint8_t get_border_spacing(const css_computed_style *style,
#define BORDER_TOP_COLOR_INDEX 11
#define BORDER_TOP_COLOR_SHIFT 8
#define BORDER_TOP_COLOR_MASK 0x300
+static inline uint8_t get_border_top_color_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_TOP_COLOR_INDEX];
+ bits &= BORDER_TOP_COLOR_MASK;
+ bits >>= BORDER_TOP_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_border_top_color(const css_computed_style *style,
css_color *color)
{
@@ -392,6 +587,15 @@ static inline uint8_t get_border_top_color(const css_computed_style *style,
#define BORDER_TOP_STYLE_INDEX 9
#define BORDER_TOP_STYLE_SHIFT 11
#define BORDER_TOP_STYLE_MASK 0x7800
+static inline uint8_t get_border_top_style_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_TOP_STYLE_INDEX];
+ bits &= BORDER_TOP_STYLE_MASK;
+ bits >>= BORDER_TOP_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_border_top_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BORDER_TOP_STYLE_INDEX];
@@ -409,6 +613,15 @@ static inline uint8_t get_border_top_style(const css_computed_style *style)
#define BORDER_TOP_WIDTH_INDEX 0
#define BORDER_TOP_WIDTH_SHIFT 24
#define BORDER_TOP_WIDTH_MASK 0xff000000
+static inline uint8_t get_border_top_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BORDER_TOP_WIDTH_INDEX];
+ bits &= BORDER_TOP_WIDTH_MASK;
+ bits >>= BORDER_TOP_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_border_top_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -431,31 +644,29 @@ static inline uint8_t get_border_top_width(const css_computed_style *style,
#define BOTTOM_INDEX 3
#define BOTTOM_SHIFT 11
#define BOTTOM_MASK 0x3f800
-static inline uint8_t get_bottom(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
+static inline uint8_t get_bottom_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BOTTOM_INDEX];
bits &= BOTTOM_MASK;
bits >>= BOTTOM_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_BOTTOM_SET) {
- *length = style->i.bottom;
- *unit = bits >> 2;
- }
-
+
+ /* 7bits: uuuuutt : unit | type */
return (bits & 0x3);
}
-static inline uint8_t get_bottom_bits(
- const css_computed_style *style)
+static inline uint8_t get_bottom(const css_computed_style *style, css_fixed
+ *length, css_unit *unit)
{
uint32_t bits = style->i.bits[BOTTOM_INDEX];
bits &= BOTTOM_MASK;
bits >>= BOTTOM_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
+
+ /* 7bits: uuuuutt : unit | type */
+ if ((bits & 0x3) == CSS_BOTTOM_SET) {
+ *length = style->i.bottom;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
}
#undef BOTTOM_INDEX
#undef BOTTOM_SHIFT
@@ -464,6 +675,15 @@ static inline uint8_t get_bottom_bits(
#define BOX_SIZING_INDEX 11
#define BOX_SIZING_SHIFT 10
#define BOX_SIZING_MASK 0xc00
+static inline uint8_t get_box_sizing_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BOX_SIZING_INDEX];
+ bits &= BOX_SIZING_MASK;
+ bits >>= BOX_SIZING_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_box_sizing(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BOX_SIZING_INDEX];
@@ -481,6 +701,15 @@ static inline uint8_t get_box_sizing(const css_computed_style *style)
#define BREAK_AFTER_INDEX 9
#define BREAK_AFTER_SHIFT 15
#define BREAK_AFTER_MASK 0x78000
+static inline uint8_t get_break_after_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BREAK_AFTER_INDEX];
+ bits &= BREAK_AFTER_MASK;
+ bits >>= BREAK_AFTER_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_break_after(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BREAK_AFTER_INDEX];
@@ -498,6 +727,15 @@ static inline uint8_t get_break_after(const css_computed_style *style)
#define BREAK_BEFORE_INDEX 9
#define BREAK_BEFORE_SHIFT 19
#define BREAK_BEFORE_MASK 0x780000
+static inline uint8_t get_break_before_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BREAK_BEFORE_INDEX];
+ bits &= BREAK_BEFORE_MASK;
+ bits >>= BREAK_BEFORE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_break_before(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BREAK_BEFORE_INDEX];
@@ -515,6 +753,15 @@ static inline uint8_t get_break_before(const css_computed_style *style)
#define BREAK_INSIDE_INDEX 9
#define BREAK_INSIDE_SHIFT 23
#define BREAK_INSIDE_MASK 0x7800000
+static inline uint8_t get_break_inside_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[BREAK_INSIDE_INDEX];
+ bits &= BREAK_INSIDE_MASK;
+ bits >>= BREAK_INSIDE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_break_inside(const css_computed_style *style)
{
uint32_t bits = style->i.bits[BREAK_INSIDE_INDEX];
@@ -532,6 +779,15 @@ static inline uint8_t get_break_inside(const css_computed_style *style)
#define CAPTION_SIDE_INDEX 11
#define CAPTION_SIDE_SHIFT 12
#define CAPTION_SIDE_MASK 0x3000
+static inline uint8_t get_caption_side_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CAPTION_SIDE_INDEX];
+ bits &= CAPTION_SIDE_MASK;
+ bits >>= CAPTION_SIDE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_caption_side(const css_computed_style *style)
{
uint32_t bits = style->i.bits[CAPTION_SIDE_INDEX];
@@ -549,6 +805,15 @@ static inline uint8_t get_caption_side(const css_computed_style *style)
#define CLEAR_INDEX 13
#define CLEAR_SHIFT 1
#define CLEAR_MASK 0xe
+static inline uint8_t get_clear_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CLEAR_INDEX];
+ bits &= CLEAR_MASK;
+ bits >>= CLEAR_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_clear(const css_computed_style *style)
{
uint32_t bits = style->i.bits[CLEAR_INDEX];
@@ -566,6 +831,16 @@ static inline uint8_t get_clear(const css_computed_style *style)
#define CLIP_INDEX 2
#define CLIP_SHIFT 6
#define CLIP_MASK 0xffffffc0
+static inline uint8_t get_clip_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CLIP_INDEX];
+ bits &= CLIP_MASK;
+ bits >>= CLIP_SHIFT;
+
+ /* 26bits: aaaaabbbbbcccccdddddtttttt : unit_a | unit_b | unit_c |
+ unit_d | type */
+ return (bits & 0x3f);
+}
static inline uint8_t get_clip(
const css_computed_style *style,
css_computed_clip_rect *rect)
@@ -606,8 +881,17 @@ static inline uint8_t get_clip(
#undef CLIP_MASK
#define COLOR_INDEX 14
-#define COLOR_SHIFT 19
-#define COLOR_MASK 0x80000
+#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];
+ bits &= COLOR_MASK;
+ bits >>= COLOR_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_color(const css_computed_style *style, css_color
*color)
{
@@ -627,6 +911,15 @@ static inline uint8_t get_color(const css_computed_style *style, css_color
#define COLUMN_COUNT_INDEX 11
#define COLUMN_COUNT_SHIFT 14
#define COLUMN_COUNT_MASK 0xc000
+static inline uint8_t get_column_count_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_COUNT_INDEX];
+ bits &= COLUMN_COUNT_MASK;
+ bits >>= COLUMN_COUNT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_count(const css_computed_style *style, int32_t
*integer)
{
@@ -646,6 +939,15 @@ static inline uint8_t get_column_count(const css_computed_style *style, int32_t
#define COLUMN_FILL_INDEX 11
#define COLUMN_FILL_SHIFT 16
#define COLUMN_FILL_MASK 0x30000
+static inline uint8_t get_column_fill_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_FILL_INDEX];
+ bits &= COLUMN_FILL_MASK;
+ bits >>= COLUMN_FILL_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_fill(const css_computed_style *style)
{
uint32_t bits = style->i.bits[COLUMN_FILL_INDEX];
@@ -663,6 +965,15 @@ static inline uint8_t get_column_fill(const css_computed_style *style)
#define COLUMN_GAP_INDEX 3
#define COLUMN_GAP_SHIFT 18
#define COLUMN_GAP_MASK 0x1fc0000
+static inline uint8_t get_column_gap_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_GAP_INDEX];
+ bits &= COLUMN_GAP_MASK;
+ bits >>= COLUMN_GAP_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_gap(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -685,6 +996,16 @@ static inline uint8_t get_column_gap(const css_computed_style *style, css_fixed
#define COLUMN_RULE_COLOR_INDEX 11
#define COLUMN_RULE_COLOR_SHIFT 18
#define COLUMN_RULE_COLOR_MASK 0xc0000
+static inline uint8_t get_column_rule_color_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_RULE_COLOR_INDEX];
+ bits &= COLUMN_RULE_COLOR_MASK;
+ bits >>= COLUMN_RULE_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_rule_color(const css_computed_style *style,
css_color *color)
{
@@ -704,6 +1025,16 @@ static inline uint8_t get_column_rule_color(const css_computed_style *style,
#define COLUMN_RULE_STYLE_INDEX 7
#define COLUMN_RULE_STYLE_SHIFT 0
#define COLUMN_RULE_STYLE_MASK 0xf
+static inline uint8_t get_column_rule_style_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_RULE_STYLE_INDEX];
+ bits &= COLUMN_RULE_STYLE_MASK;
+ bits >>= COLUMN_RULE_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_column_rule_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[COLUMN_RULE_STYLE_INDEX];
@@ -721,6 +1052,16 @@ static inline uint8_t get_column_rule_style(const css_computed_style *style)
#define COLUMN_RULE_WIDTH_INDEX 1
#define COLUMN_RULE_WIDTH_SHIFT 7
#define COLUMN_RULE_WIDTH_MASK 0x7f80
+static inline uint8_t get_column_rule_width_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_RULE_WIDTH_INDEX];
+ bits &= COLUMN_RULE_WIDTH_MASK;
+ bits >>= COLUMN_RULE_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_column_rule_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -743,6 +1084,15 @@ static inline uint8_t get_column_rule_width(const css_computed_style *style,
#define COLUMN_SPAN_INDEX 11
#define COLUMN_SPAN_SHIFT 20
#define COLUMN_SPAN_MASK 0x300000
+static inline uint8_t get_column_span_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_SPAN_INDEX];
+ bits &= COLUMN_SPAN_MASK;
+ bits >>= COLUMN_SPAN_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_span(const css_computed_style *style)
{
uint32_t bits = style->i.bits[COLUMN_SPAN_INDEX];
@@ -760,6 +1110,15 @@ static inline uint8_t get_column_span(const css_computed_style *style)
#define COLUMN_WIDTH_INDEX 3
#define COLUMN_WIDTH_SHIFT 25
#define COLUMN_WIDTH_MASK 0xfe000000
+static inline uint8_t get_column_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[COLUMN_WIDTH_INDEX];
+ bits &= COLUMN_WIDTH_MASK;
+ bits >>= COLUMN_WIDTH_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_column_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -782,6 +1141,15 @@ static inline uint8_t get_column_width(const css_computed_style *style,
#define CONTENT_INDEX 11
#define CONTENT_SHIFT 22
#define CONTENT_MASK 0xc00000
+static inline uint8_t get_content_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CONTENT_INDEX];
+ bits &= CONTENT_MASK;
+ bits >>= CONTENT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_content(const css_computed_style *style, const
css_computed_content_item **content_item)
{
@@ -801,8 +1169,18 @@ 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 18
+#define COUNTER_INCREMENT_MASK 0x40000
+static inline uint8_t get_counter_increment_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[COUNTER_INCREMENT_INDEX];
+ bits &= COUNTER_INCREMENT_MASK;
+ bits >>= COUNTER_INCREMENT_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_counter_increment(const css_computed_style *style,
const css_computed_counter **counter_arr)
{
@@ -820,8 +1198,17 @@ 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 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];
+ bits &= COUNTER_RESET_MASK;
+ bits >>= COUNTER_RESET_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_counter_reset(const css_computed_style *style, const
css_computed_counter **counter_arr)
{
@@ -841,6 +1228,15 @@ static inline uint8_t get_counter_reset(const css_computed_style *style, const
#define CURSOR_INDEX 9
#define CURSOR_SHIFT 27
#define CURSOR_MASK 0xf8000000
+static inline uint8_t get_cursor_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[CURSOR_INDEX];
+ bits &= CURSOR_MASK;
+ bits >>= CURSOR_SHIFT;
+
+ /* 5bits: ttttt : type */
+ return (bits & 0x1f);
+}
static inline uint8_t get_cursor(const css_computed_style *style, lwc_string
***string_arr)
{
@@ -860,6 +1256,15 @@ static inline uint8_t get_cursor(const css_computed_style *style, lwc_string
#define DIRECTION_INDEX 11
#define DIRECTION_SHIFT 24
#define DIRECTION_MASK 0x3000000
+static inline uint8_t get_direction_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[DIRECTION_INDEX];
+ bits &= DIRECTION_MASK;
+ bits >>= DIRECTION_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_direction(const css_computed_style *style)
{
uint32_t bits = style->i.bits[DIRECTION_INDEX];
@@ -877,6 +1282,15 @@ static inline uint8_t get_direction(const css_computed_style *style)
#define DISPLAY_INDEX 8
#define DISPLAY_SHIFT 3
#define DISPLAY_MASK 0xf8
+static inline uint8_t get_display_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[DISPLAY_INDEX];
+ bits &= DISPLAY_MASK;
+ bits >>= DISPLAY_SHIFT;
+
+ /* 5bits: ttttt : type */
+ return (bits & 0x1f);
+}
static inline uint8_t get_display(const css_computed_style *style)
{
uint32_t bits = style->i.bits[DISPLAY_INDEX];
@@ -894,6 +1308,15 @@ static inline uint8_t get_display(const css_computed_style *style)
#define EMPTY_CELLS_INDEX 11
#define EMPTY_CELLS_SHIFT 26
#define EMPTY_CELLS_MASK 0xc000000
+static inline uint8_t get_empty_cells_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[EMPTY_CELLS_INDEX];
+ bits &= EMPTY_CELLS_MASK;
+ bits >>= EMPTY_CELLS_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_empty_cells(const css_computed_style *style)
{
uint32_t bits = style->i.bits[EMPTY_CELLS_INDEX];
@@ -908,9 +1331,48 @@ 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 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];
+ 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
+static inline uint8_t get_flex_basis_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLEX_BASIS_INDEX];
+ bits &= FLEX_BASIS_MASK;
+ bits >>= FLEX_BASIS_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_flex_basis(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -933,6 +1395,15 @@ static inline uint8_t get_flex_basis(const css_computed_style *style, css_fixed
#define FLEX_DIRECTION_INDEX 13
#define FLEX_DIRECTION_SHIFT 4
#define FLEX_DIRECTION_MASK 0x70
+static inline uint8_t get_flex_direction_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLEX_DIRECTION_INDEX];
+ bits &= FLEX_DIRECTION_MASK;
+ bits >>= FLEX_DIRECTION_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_flex_direction(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FLEX_DIRECTION_INDEX];
@@ -948,8 +1419,17 @@ 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];
+ bits &= FLEX_GROW_MASK;
+ bits >>= FLEX_GROW_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_flex_grow(const css_computed_style *style, css_fixed
*fixed)
{
@@ -969,8 +1449,17 @@ 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];
+ bits &= FLEX_SHRINK_MASK;
+ bits >>= FLEX_SHRINK_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_flex_shrink(const css_computed_style *style,
css_fixed *fixed)
{
@@ -992,6 +1481,15 @@ static inline uint8_t get_flex_shrink(const css_computed_style *style,
#define FLEX_WRAP_INDEX 11
#define FLEX_WRAP_SHIFT 28
#define FLEX_WRAP_MASK 0x30000000
+static inline uint8_t get_flex_wrap_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLEX_WRAP_INDEX];
+ bits &= FLEX_WRAP_MASK;
+ bits >>= FLEX_WRAP_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_flex_wrap(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FLEX_WRAP_INDEX];
@@ -1009,6 +1507,15 @@ static inline uint8_t get_flex_wrap(const css_computed_style *style)
#define FLOAT_INDEX 11
#define FLOAT_SHIFT 30
#define FLOAT_MASK 0xc0000000
+static inline uint8_t get_float_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FLOAT_INDEX];
+ bits &= FLOAT_MASK;
+ bits >>= FLOAT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_float(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FLOAT_INDEX];
@@ -1026,6 +1533,15 @@ static inline uint8_t get_float(const css_computed_style *style)
#define FONT_FAMILY_INDEX 13
#define FONT_FAMILY_SHIFT 7
#define FONT_FAMILY_MASK 0x380
+static inline uint8_t get_font_family_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_FAMILY_INDEX];
+ bits &= FONT_FAMILY_MASK;
+ bits >>= FONT_FAMILY_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_font_family(const css_computed_style *style,
lwc_string ***string_arr)
{
@@ -1045,6 +1561,15 @@ static inline uint8_t get_font_family(const css_computed_style *style,
#define FONT_SIZE_INDEX 1
#define FONT_SIZE_SHIFT 23
#define FONT_SIZE_MASK 0xff800000
+static inline uint8_t get_font_size_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_SIZE_INDEX];
+ bits &= FONT_SIZE_MASK;
+ bits >>= FONT_SIZE_SHIFT;
+
+ /* 9bits: uuuuutttt : unit | type */
+ return (bits & 0xf);
+}
static inline uint8_t get_font_size(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1067,6 +1592,15 @@ static inline uint8_t get_font_size(const css_computed_style *style, css_fixed
#define FONT_STYLE_INDEX 10
#define FONT_STYLE_SHIFT 0
#define FONT_STYLE_MASK 0x3
+static inline uint8_t get_font_style_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_STYLE_INDEX];
+ bits &= FONT_STYLE_MASK;
+ bits >>= FONT_STYLE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_font_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FONT_STYLE_INDEX];
@@ -1084,6 +1618,15 @@ static inline uint8_t get_font_style(const css_computed_style *style)
#define FONT_VARIANT_INDEX 10
#define FONT_VARIANT_SHIFT 2
#define FONT_VARIANT_MASK 0xc
+static inline uint8_t get_font_variant_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_VARIANT_INDEX];
+ bits &= FONT_VARIANT_MASK;
+ bits >>= FONT_VARIANT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_font_variant(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FONT_VARIANT_INDEX];
@@ -1101,6 +1644,15 @@ static inline uint8_t get_font_variant(const css_computed_style *style)
#define FONT_WEIGHT_INDEX 6
#define FONT_WEIGHT_SHIFT 0
#define FONT_WEIGHT_MASK 0xf
+static inline uint8_t get_font_weight_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[FONT_WEIGHT_INDEX];
+ bits &= FONT_WEIGHT_MASK;
+ bits >>= FONT_WEIGHT_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_font_weight(const css_computed_style *style)
{
uint32_t bits = style->i.bits[FONT_WEIGHT_INDEX];
@@ -1118,6 +1670,15 @@ static inline uint8_t get_font_weight(const css_computed_style *style)
#define HEIGHT_INDEX 7
#define HEIGHT_SHIFT 11
#define HEIGHT_MASK 0x3f800
+static inline uint8_t get_height_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[HEIGHT_INDEX];
+ bits &= HEIGHT_MASK;
+ bits >>= HEIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_height(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1140,6 +1701,15 @@ static inline uint8_t get_height(const css_computed_style *style, css_fixed
#define JUSTIFY_CONTENT_INDEX 13
#define JUSTIFY_CONTENT_SHIFT 10
#define JUSTIFY_CONTENT_MASK 0x1c00
+static inline uint8_t get_justify_content_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[JUSTIFY_CONTENT_INDEX];
+ bits &= JUSTIFY_CONTENT_MASK;
+ bits >>= JUSTIFY_CONTENT_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_justify_content(const css_computed_style *style)
{
uint32_t bits = style->i.bits[JUSTIFY_CONTENT_INDEX];
@@ -1157,31 +1727,29 @@ static inline uint8_t get_justify_content(const css_computed_style *style)
#define LEFT_INDEX 7
#define LEFT_SHIFT 18
#define LEFT_MASK 0x1fc0000
-static inline uint8_t get_left(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
+static inline uint8_t get_left_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[LEFT_INDEX];
bits &= LEFT_MASK;
bits >>= LEFT_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_LEFT_SET) {
- *length = style->i.left;
- *unit = bits >> 2;
- }
-
+
+ /* 7bits: uuuuutt : unit | type */
return (bits & 0x3);
}
-static inline uint8_t get_left_bits(
- const css_computed_style *style)
+static inline uint8_t get_left(const css_computed_style *style, css_fixed
+ *length, css_unit *unit)
{
uint32_t bits = style->i.bits[LEFT_INDEX];
bits &= LEFT_MASK;
bits >>= LEFT_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
+
+ /* 7bits: uuuuutt : unit | type */
+ if ((bits & 0x3) == CSS_LEFT_SET) {
+ *length = style->i.left;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
}
#undef LEFT_INDEX
#undef LEFT_SHIFT
@@ -1190,6 +1758,15 @@ static inline uint8_t get_left_bits(
#define LETTER_SPACING_INDEX 7
#define LETTER_SPACING_SHIFT 25
#define LETTER_SPACING_MASK 0xfe000000
+static inline uint8_t get_letter_spacing_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[LETTER_SPACING_INDEX];
+ bits &= LETTER_SPACING_MASK;
+ bits >>= LETTER_SPACING_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_letter_spacing(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1212,6 +1789,15 @@ static inline uint8_t get_letter_spacing(const css_computed_style *style,
#define LINE_HEIGHT_INDEX 6
#define LINE_HEIGHT_SHIFT 4
#define LINE_HEIGHT_MASK 0x7f0
+static inline uint8_t get_line_height_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[LINE_HEIGHT_INDEX];
+ bits &= LINE_HEIGHT_MASK;
+ bits >>= LINE_HEIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_line_height(
const css_computed_style *style,
css_fixed *length, css_unit *unit)
@@ -1237,8 +1823,17 @@ 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];
+ bits &= LIST_STYLE_IMAGE_MASK;
+ bits >>= LIST_STYLE_IMAGE_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_list_style_image(const css_computed_style *style,
lwc_string **string)
{
@@ -1258,6 +1853,16 @@ static inline uint8_t get_list_style_image(const css_computed_style *style,
#define LIST_STYLE_POSITION_INDEX 10
#define LIST_STYLE_POSITION_SHIFT 4
#define LIST_STYLE_POSITION_MASK 0x30
+static inline uint8_t get_list_style_position_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[LIST_STYLE_POSITION_INDEX];
+ bits &= LIST_STYLE_POSITION_MASK;
+ bits >>= LIST_STYLE_POSITION_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_list_style_position(const css_computed_style *style)
{
uint32_t bits = style->i.bits[LIST_STYLE_POSITION_INDEX];
@@ -1275,6 +1880,15 @@ static inline uint8_t get_list_style_position(const css_computed_style *style)
#define LIST_STYLE_TYPE_INDEX 8
#define LIST_STYLE_TYPE_SHIFT 8
#define LIST_STYLE_TYPE_MASK 0x3f00
+static inline uint8_t get_list_style_type_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[LIST_STYLE_TYPE_INDEX];
+ bits &= LIST_STYLE_TYPE_MASK;
+ bits >>= LIST_STYLE_TYPE_SHIFT;
+
+ /* 6bits: tttttt : type */
+ return (bits & 0x3f);
+}
static inline uint8_t get_list_style_type(const css_computed_style *style)
{
uint32_t bits = style->i.bits[LIST_STYLE_TYPE_INDEX];
@@ -1292,6 +1906,15 @@ static inline uint8_t get_list_style_type(const css_computed_style *style)
#define MARGIN_BOTTOM_INDEX 6
#define MARGIN_BOTTOM_SHIFT 11
#define MARGIN_BOTTOM_MASK 0x3f800
+static inline uint8_t get_margin_bottom_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MARGIN_BOTTOM_INDEX];
+ bits &= MARGIN_BOTTOM_MASK;
+ bits >>= MARGIN_BOTTOM_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_margin_bottom(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1314,6 +1937,15 @@ static inline uint8_t get_margin_bottom(const css_computed_style *style,
#define MARGIN_LEFT_INDEX 6
#define MARGIN_LEFT_SHIFT 18
#define MARGIN_LEFT_MASK 0x1fc0000
+static inline uint8_t get_margin_left_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MARGIN_LEFT_INDEX];
+ bits &= MARGIN_LEFT_MASK;
+ bits >>= MARGIN_LEFT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_margin_left(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1336,6 +1968,15 @@ static inline uint8_t get_margin_left(const css_computed_style *style,
#define MARGIN_RIGHT_INDEX 6
#define MARGIN_RIGHT_SHIFT 25
#define MARGIN_RIGHT_MASK 0xfe000000
+static inline uint8_t get_margin_right_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MARGIN_RIGHT_INDEX];
+ bits &= MARGIN_RIGHT_MASK;
+ bits >>= MARGIN_RIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_margin_right(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1358,6 +1999,15 @@ static inline uint8_t get_margin_right(const css_computed_style *style,
#define MARGIN_TOP_INDEX 5
#define MARGIN_TOP_SHIFT 4
#define MARGIN_TOP_MASK 0x7f0
+static inline uint8_t get_margin_top_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MARGIN_TOP_INDEX];
+ bits &= MARGIN_TOP_MASK;
+ bits >>= MARGIN_TOP_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_margin_top(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1380,6 +2030,15 @@ static inline uint8_t get_margin_top(const css_computed_style *style, css_fixed
#define MAX_HEIGHT_INDEX 5
#define MAX_HEIGHT_SHIFT 11
#define MAX_HEIGHT_MASK 0x3f800
+static inline uint8_t get_max_height_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MAX_HEIGHT_INDEX];
+ bits &= MAX_HEIGHT_MASK;
+ bits >>= MAX_HEIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_max_height(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1402,6 +2061,15 @@ static inline uint8_t get_max_height(const css_computed_style *style, css_fixed
#define MAX_WIDTH_INDEX 5
#define MAX_WIDTH_SHIFT 18
#define MAX_WIDTH_MASK 0x1fc0000
+static inline uint8_t get_max_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MAX_WIDTH_INDEX];
+ bits &= MAX_WIDTH_MASK;
+ bits >>= MAX_WIDTH_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_max_width(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1424,6 +2092,15 @@ static inline uint8_t get_max_width(const css_computed_style *style, css_fixed
#define MIN_HEIGHT_INDEX 5
#define MIN_HEIGHT_SHIFT 25
#define MIN_HEIGHT_MASK 0xfe000000
+static inline uint8_t get_min_height_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MIN_HEIGHT_INDEX];
+ bits &= MIN_HEIGHT_MASK;
+ bits >>= MIN_HEIGHT_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_min_height(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1446,6 +2123,15 @@ static inline uint8_t get_min_height(const css_computed_style *style, css_fixed
#define MIN_WIDTH_INDEX 4
#define MIN_WIDTH_SHIFT 4
#define MIN_WIDTH_MASK 0x7f0
+static inline uint8_t get_min_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[MIN_WIDTH_INDEX];
+ bits &= MIN_WIDTH_MASK;
+ bits >>= MIN_WIDTH_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_min_width(const css_computed_style *style, css_fixed
*length, css_unit *unit)
{
@@ -1466,8 +2152,17 @@ 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];
+ bits &= OPACITY_MASK;
+ bits >>= OPACITY_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_opacity(const css_computed_style *style, css_fixed
*fixed)
{
@@ -1487,8 +2182,17 @@ 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];
+ bits &= ORDER_MASK;
+ bits >>= ORDER_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_order(const css_computed_style *style, int32_t
*integer)
{
@@ -1508,8 +2212,17 @@ 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];
+ bits &= ORPHANS_MASK;
+ bits >>= ORPHANS_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_orphans(const css_computed_style *style, int32_t
*integer)
{
@@ -1529,6 +2242,15 @@ static inline uint8_t get_orphans(const css_computed_style *style, int32_t
#define OUTLINE_COLOR_INDEX 10
#define OUTLINE_COLOR_SHIFT 6
#define OUTLINE_COLOR_MASK 0xc0
+static inline uint8_t get_outline_color_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OUTLINE_COLOR_INDEX];
+ bits &= OUTLINE_COLOR_MASK;
+ bits >>= OUTLINE_COLOR_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_outline_color(const css_computed_style *style,
css_color *color)
{
@@ -1550,6 +2272,15 @@ static inline uint8_t get_outline_color(const css_computed_style *style,
#define OUTLINE_STYLE_INDEX 5
#define OUTLINE_STYLE_SHIFT 0
#define OUTLINE_STYLE_MASK 0xf
+static inline uint8_t get_outline_style_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OUTLINE_STYLE_INDEX];
+ bits &= OUTLINE_STYLE_MASK;
+ bits >>= OUTLINE_STYLE_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_outline_style(const css_computed_style *style)
{
uint32_t bits = style->i.bits[OUTLINE_STYLE_INDEX];
@@ -1567,6 +2298,15 @@ static inline uint8_t get_outline_style(const css_computed_style *style)
#define OUTLINE_WIDTH_INDEX 1
#define OUTLINE_WIDTH_SHIFT 15
#define OUTLINE_WIDTH_MASK 0x7f8000
+static inline uint8_t get_outline_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OUTLINE_WIDTH_INDEX];
+ bits &= OUTLINE_WIDTH_MASK;
+ bits >>= OUTLINE_WIDTH_SHIFT;
+
+ /* 8bits: uuuuuttt : unit | type */
+ return (bits & 0x7);
+}
static inline uint8_t get_outline_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1589,6 +2329,15 @@ static inline uint8_t get_outline_width(const css_computed_style *style,
#define OVERFLOW_X_INDEX 13
#define OVERFLOW_X_SHIFT 13
#define OVERFLOW_X_MASK 0xe000
+static inline uint8_t get_overflow_x_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OVERFLOW_X_INDEX];
+ bits &= OVERFLOW_X_MASK;
+ bits >>= OVERFLOW_X_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_overflow_x(const css_computed_style *style)
{
uint32_t bits = style->i.bits[OVERFLOW_X_INDEX];
@@ -1606,6 +2355,15 @@ static inline uint8_t get_overflow_x(const css_computed_style *style)
#define OVERFLOW_Y_INDEX 13
#define OVERFLOW_Y_SHIFT 16
#define OVERFLOW_Y_MASK 0x70000
+static inline uint8_t get_overflow_y_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[OVERFLOW_Y_INDEX];
+ bits &= OVERFLOW_Y_MASK;
+ bits >>= OVERFLOW_Y_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_overflow_y(const css_computed_style *style)
{
uint32_t bits = style->i.bits[OVERFLOW_Y_INDEX];
@@ -1623,6 +2381,15 @@ static inline uint8_t get_overflow_y(const css_computed_style *style)
#define PADDING_BOTTOM_INDEX 8
#define PADDING_BOTTOM_SHIFT 14
#define PADDING_BOTTOM_MASK 0xfc000
+static inline uint8_t get_padding_bottom_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PADDING_BOTTOM_INDEX];
+ bits &= PADDING_BOTTOM_MASK;
+ bits >>= PADDING_BOTTOM_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_padding_bottom(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1645,6 +2412,15 @@ static inline uint8_t get_padding_bottom(const css_computed_style *style,
#define PADDING_LEFT_INDEX 8
#define PADDING_LEFT_SHIFT 20
#define PADDING_LEFT_MASK 0x3f00000
+static inline uint8_t get_padding_left_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PADDING_LEFT_INDEX];
+ bits &= PADDING_LEFT_MASK;
+ bits >>= PADDING_LEFT_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_padding_left(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1667,6 +2443,15 @@ static inline uint8_t get_padding_left(const css_computed_style *style,
#define PADDING_RIGHT_INDEX 8
#define PADDING_RIGHT_SHIFT 26
#define PADDING_RIGHT_MASK 0xfc000000
+static inline uint8_t get_padding_right_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PADDING_RIGHT_INDEX];
+ bits &= PADDING_RIGHT_MASK;
+ bits >>= PADDING_RIGHT_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_padding_right(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1689,6 +2474,15 @@ static inline uint8_t get_padding_right(const css_computed_style *style,
#define PADDING_TOP_INDEX 3
#define PADDING_TOP_SHIFT 5
#define PADDING_TOP_MASK 0x7e0
+static inline uint8_t get_padding_top_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PADDING_TOP_INDEX];
+ bits &= PADDING_TOP_MASK;
+ bits >>= PADDING_TOP_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_padding_top(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1711,6 +2505,15 @@ static inline uint8_t get_padding_top(const css_computed_style *style,
#define PAGE_BREAK_AFTER_INDEX 13
#define PAGE_BREAK_AFTER_SHIFT 19
#define PAGE_BREAK_AFTER_MASK 0x380000
+static inline uint8_t get_page_break_after_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[PAGE_BREAK_AFTER_INDEX];
+ bits &= PAGE_BREAK_AFTER_MASK;
+ bits >>= PAGE_BREAK_AFTER_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_page_break_after(const css_computed_style *style)
{
uint32_t bits = style->i.bits[PAGE_BREAK_AFTER_INDEX];
@@ -1728,6 +2531,16 @@ static inline uint8_t get_page_break_after(const css_computed_style *style)
#define PAGE_BREAK_BEFORE_INDEX 13
#define PAGE_BREAK_BEFORE_SHIFT 22
#define PAGE_BREAK_BEFORE_MASK 0x1c00000
+static inline uint8_t get_page_break_before_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[PAGE_BREAK_BEFORE_INDEX];
+ bits &= PAGE_BREAK_BEFORE_MASK;
+ bits >>= PAGE_BREAK_BEFORE_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_page_break_before(const css_computed_style *style)
{
uint32_t bits = style->i.bits[PAGE_BREAK_BEFORE_INDEX];
@@ -1745,6 +2558,16 @@ static inline uint8_t get_page_break_before(const css_computed_style *style)
#define PAGE_BREAK_INSIDE_INDEX 10
#define PAGE_BREAK_INSIDE_SHIFT 8
#define PAGE_BREAK_INSIDE_MASK 0x300
+static inline uint8_t get_page_break_inside_bits(const css_computed_style
+ *style)
+{
+ uint32_t bits = style->i.bits[PAGE_BREAK_INSIDE_INDEX];
+ bits &= PAGE_BREAK_INSIDE_MASK;
+ bits >>= PAGE_BREAK_INSIDE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_page_break_inside(const css_computed_style *style)
{
uint32_t bits = style->i.bits[PAGE_BREAK_INSIDE_INDEX];
@@ -1762,6 +2585,15 @@ static inline uint8_t get_page_break_inside(const css_computed_style *style)
#define POSITION_INDEX 13
#define POSITION_SHIFT 25
#define POSITION_MASK 0xe000000
+static inline uint8_t get_position_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[POSITION_INDEX];
+ bits &= POSITION_MASK;
+ bits >>= POSITION_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_position(const css_computed_style *style)
{
uint32_t bits = style->i.bits[POSITION_INDEX];
@@ -1776,9 +2608,18 @@ 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];
+ bits &= QUOTES_MASK;
+ bits >>= QUOTES_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_quotes(const css_computed_style *style, lwc_string
***string_arr)
{
@@ -1798,39 +2639,76 @@ static inline uint8_t get_quotes(const css_computed_style *style, lwc_string
#define RIGHT_INDEX 4
#define RIGHT_SHIFT 11
#define RIGHT_MASK 0x3f800
-static inline uint8_t get_right(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
+static inline uint8_t get_right_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[RIGHT_INDEX];
bits &= RIGHT_MASK;
bits >>= RIGHT_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_RIGHT_SET) {
- *length = style->i.right;
- *unit = bits >> 2;
- }
-
+
+ /* 7bits: uuuuutt : unit | type */
return (bits & 0x3);
}
-static inline uint8_t get_right_bits(
- const css_computed_style *style)
+static inline uint8_t get_right(const css_computed_style *style, css_fixed
+ *length, css_unit *unit)
{
uint32_t bits = style->i.bits[RIGHT_INDEX];
bits &= RIGHT_MASK;
bits >>= RIGHT_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
+
+ /* 7bits: uuuuutt : unit | type */
+ if ((bits & 0x3) == CSS_RIGHT_SET) {
+ *length = style->i.right;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
}
#undef RIGHT_INDEX
#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
+static inline uint8_t get_table_layout_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TABLE_LAYOUT_INDEX];
+ bits &= TABLE_LAYOUT_MASK;
+ bits >>= TABLE_LAYOUT_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_table_layout(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TABLE_LAYOUT_INDEX];
@@ -1848,6 +2726,15 @@ static inline uint8_t get_table_layout(const css_computed_style *style)
#define TEXT_ALIGN_INDEX 4
#define TEXT_ALIGN_SHIFT 0
#define TEXT_ALIGN_MASK 0xf
+static inline uint8_t get_text_align_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TEXT_ALIGN_INDEX];
+ bits &= TEXT_ALIGN_MASK;
+ bits >>= TEXT_ALIGN_SHIFT;
+
+ /* 4bits: tttt : type */
+ return (bits & 0xf);
+}
static inline uint8_t get_text_align(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TEXT_ALIGN_INDEX];
@@ -1865,6 +2752,15 @@ static inline uint8_t get_text_align(const css_computed_style *style)
#define TEXT_DECORATION_INDEX 3
#define TEXT_DECORATION_SHIFT 0
#define TEXT_DECORATION_MASK 0x1f
+static inline uint8_t get_text_decoration_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TEXT_DECORATION_INDEX];
+ bits &= TEXT_DECORATION_MASK;
+ bits >>= TEXT_DECORATION_SHIFT;
+
+ /* 5bits: ttttt : type */
+ return (bits & 0x1f);
+}
static inline uint8_t get_text_decoration(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TEXT_DECORATION_INDEX];
@@ -1882,6 +2778,15 @@ static inline uint8_t get_text_decoration(const css_computed_style *style)
#define TEXT_INDENT_INDEX 2
#define TEXT_INDENT_SHIFT 0
#define TEXT_INDENT_MASK 0x3f
+static inline uint8_t get_text_indent_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TEXT_INDENT_INDEX];
+ bits &= TEXT_INDENT_MASK;
+ bits >>= TEXT_INDENT_SHIFT;
+
+ /* 6bits: uuuuut : unit | type */
+ return (bits & 0x1);
+}
static inline uint8_t get_text_indent(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1904,6 +2809,15 @@ static inline uint8_t get_text_indent(const css_computed_style *style,
#define TEXT_TRANSFORM_INDEX 9
#define TEXT_TRANSFORM_SHIFT 0
#define TEXT_TRANSFORM_MASK 0x7
+static inline uint8_t get_text_transform_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[TEXT_TRANSFORM_INDEX];
+ bits &= TEXT_TRANSFORM_MASK;
+ bits >>= TEXT_TRANSFORM_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_text_transform(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TEXT_TRANSFORM_INDEX];
@@ -1921,31 +2835,29 @@ static inline uint8_t get_text_transform(const css_computed_style *style)
#define TOP_INDEX 4
#define TOP_SHIFT 18
#define TOP_MASK 0x1fc0000
-static inline uint8_t get_top(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
+static inline uint8_t get_top_bits(const css_computed_style *style)
{
uint32_t bits = style->i.bits[TOP_INDEX];
bits &= TOP_MASK;
bits >>= TOP_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_TOP_SET) {
- *length = style->i.top;
- *unit = bits >> 2;
- }
-
+
+ /* 7bits: uuuuutt : unit | type */
return (bits & 0x3);
}
-static inline uint8_t get_top_bits(
- const css_computed_style *style)
+static inline uint8_t get_top(const css_computed_style *style, css_fixed
+ *length, css_unit *unit)
{
uint32_t bits = style->i.bits[TOP_INDEX];
bits &= TOP_MASK;
bits >>= TOP_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
+
+ /* 7bits: uuuuutt : unit | type */
+ if ((bits & 0x3) == CSS_TOP_SET) {
+ *length = style->i.top;
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
}
#undef TOP_INDEX
#undef TOP_SHIFT
@@ -1954,6 +2866,15 @@ static inline uint8_t get_top_bits(
#define UNICODE_BIDI_INDEX 10
#define UNICODE_BIDI_SHIFT 12
#define UNICODE_BIDI_MASK 0x3000
+static inline uint8_t get_unicode_bidi_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[UNICODE_BIDI_INDEX];
+ bits &= UNICODE_BIDI_MASK;
+ bits >>= UNICODE_BIDI_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_unicode_bidi(const css_computed_style *style)
{
uint32_t bits = style->i.bits[UNICODE_BIDI_INDEX];
@@ -1971,6 +2892,15 @@ static inline uint8_t get_unicode_bidi(const css_computed_style *style)
#define VERTICAL_ALIGN_INDEX 12
#define VERTICAL_ALIGN_SHIFT 1
#define VERTICAL_ALIGN_MASK 0x3fe
+static inline uint8_t get_vertical_align_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[VERTICAL_ALIGN_INDEX];
+ bits &= VERTICAL_ALIGN_MASK;
+ bits >>= VERTICAL_ALIGN_SHIFT;
+
+ /* 9bits: uuuuutttt : unit | type */
+ return (bits & 0xf);
+}
static inline uint8_t get_vertical_align(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -1993,6 +2923,15 @@ static inline uint8_t get_vertical_align(const css_computed_style *style,
#define VISIBILITY_INDEX 10
#define VISIBILITY_SHIFT 14
#define VISIBILITY_MASK 0xc000
+static inline uint8_t get_visibility_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[VISIBILITY_INDEX];
+ bits &= VISIBILITY_MASK;
+ bits >>= VISIBILITY_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_visibility(const css_computed_style *style)
{
uint32_t bits = style->i.bits[VISIBILITY_INDEX];
@@ -2010,6 +2949,15 @@ static inline uint8_t get_visibility(const css_computed_style *style)
#define WHITE_SPACE_INDEX 8
#define WHITE_SPACE_SHIFT 0
#define WHITE_SPACE_MASK 0x7
+static inline uint8_t get_white_space_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WHITE_SPACE_INDEX];
+ bits &= WHITE_SPACE_MASK;
+ bits >>= WHITE_SPACE_SHIFT;
+
+ /* 3bits: ttt : type */
+ return (bits & 0x7);
+}
static inline uint8_t get_white_space(const css_computed_style *style)
{
uint32_t bits = style->i.bits[WHITE_SPACE_INDEX];
@@ -2027,6 +2975,15 @@ static inline uint8_t get_white_space(const css_computed_style *style)
#define WIDOWS_INDEX 12
#define WIDOWS_SHIFT 0
#define WIDOWS_MASK 0x1
+static inline uint8_t get_widows_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WIDOWS_INDEX];
+ bits &= WIDOWS_MASK;
+ bits >>= WIDOWS_SHIFT;
+
+ /* 1bit: t : type */
+ return (bits & 0x1);
+}
static inline uint8_t get_widows(const css_computed_style *style, int32_t
*integer)
{
@@ -2046,8 +3003,17 @@ static inline uint8_t get_widows(const css_computed_style *style, int32_t
#define WIDTH_INDEX 4
#define WIDTH_SHIFT 25
#define WIDTH_MASK 0xfe000000
-static inline uint8_t get_width(const css_computed_style *style, css_fixed
- *length, css_unit *unit)
+static inline uint8_t get_width_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WIDTH_INDEX];
+ bits &= WIDTH_MASK;
+ bits >>= WIDTH_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
+static inline uint8_t get_width(const css_computed_style *style,
+ css_fixed_or_calc *length, css_unit *unit)
{
uint32_t bits = style->i.bits[WIDTH_INDEX];
bits &= WIDTH_MASK;
@@ -2068,6 +3034,15 @@ static inline uint8_t get_width(const css_computed_style *style, css_fixed
#define WORD_SPACING_INDEX 1
#define WORD_SPACING_SHIFT 0
#define WORD_SPACING_MASK 0x7f
+static inline uint8_t get_word_spacing_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WORD_SPACING_INDEX];
+ bits &= WORD_SPACING_MASK;
+ bits >>= WORD_SPACING_SHIFT;
+
+ /* 7bits: uuuuutt : unit | type */
+ return (bits & 0x3);
+}
static inline uint8_t get_word_spacing(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
@@ -2090,6 +3065,15 @@ static inline uint8_t get_word_spacing(const css_computed_style *style,
#define WRITING_MODE_INDEX 10
#define WRITING_MODE_SHIFT 16
#define WRITING_MODE_MASK 0x30000
+static inline uint8_t get_writing_mode_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[WRITING_MODE_INDEX];
+ bits &= WRITING_MODE_MASK;
+ bits >>= WRITING_MODE_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_writing_mode(const css_computed_style *style)
{
uint32_t bits = style->i.bits[WRITING_MODE_INDEX];
@@ -2107,6 +3091,15 @@ static inline uint8_t get_writing_mode(const css_computed_style *style)
#define Z_INDEX_INDEX 10
#define Z_INDEX_SHIFT 18
#define Z_INDEX_MASK 0xc0000
+static inline uint8_t get_z_index_bits(const css_computed_style *style)
+{
+ uint32_t bits = style->i.bits[Z_INDEX_INDEX];
+ bits &= Z_INDEX_MASK;
+ bits >>= Z_INDEX_SHIFT;
+
+ /* 2bits: tt : type */
+ return (bits & 0x3);
+}
static inline uint8_t get_z_index(const css_computed_style *style, int32_t
*integer)
{
@@ -2122,3 +3115,5 @@ static inline uint8_t get_z_index(const css_computed_style *style, int32_t
#undef Z_INDEX_INDEX
#undef Z_INDEX_SHIFT
#undef Z_INDEX_MASK
+
+#endif
diff --git a/src/select/autogenerated_propset.h b/src/select/autogenerated_propset.h
index 036c2ba..c884e03 100644
--- a/src/select/autogenerated_propset.h
+++ b/src/select/autogenerated_propset.h
@@ -5,8 +5,11 @@
* Copyright 2017 The NetSurf Project
*/
-/** Default values are 'initial value', unless the property is inherited,
- * in which case it is 'inherit'. */
+#ifndef CSS_COMPUTED_PROPSET_H_
+#define CSS_COMPUTED_PROPSET_H_
+
+#include "select/propget.h"
+
#define ALIGN_CONTENT_INDEX 10
#define ALIGN_CONTENT_SHIFT 20
@@ -15,9 +18,7 @@
static inline css_error set_align_content(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ALIGN_CONTENT_INDEX];
+ uint32_t *bits = &style->i.bits[ALIGN_CONTENT_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~ALIGN_CONTENT_MASK) | (((uint32_t)type & 0x7) <<
@@ -35,9 +36,7 @@ static inline css_error set_align_content(css_computed_style *style, uint8_t
static inline css_error set_align_items(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ALIGN_ITEMS_INDEX];
+ uint32_t *bits = &style->i.bits[ALIGN_ITEMS_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~ALIGN_ITEMS_MASK) | (((uint32_t)type & 0x7) <<
@@ -55,9 +54,7 @@ static inline css_error set_align_items(css_computed_style *style, uint8_t type)
static inline css_error set_align_self(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ALIGN_SELF_INDEX];
+ uint32_t *bits = &style->i.bits[ALIGN_SELF_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~ALIGN_SELF_MASK) | (((uint32_t)type & 0x7) <<
@@ -76,9 +73,7 @@ static inline css_error set_align_self(css_computed_style *style, uint8_t type)
static inline css_error set_background_attachment(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) | (((uint32_t)type & 0x3)
@@ -97,9 +92,7 @@ static inline css_error set_background_attachment(css_computed_style *style,
static inline css_error set_background_color(css_computed_style *style, uint8_t
type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BACKGROUND_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -114,15 +107,13 @@ 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 16
+#define BACKGROUND_IMAGE_MASK 0x10000
static inline css_error set_background_image(css_computed_style *style, uint8_t
type, lwc_string *string)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~BACKGROUND_IMAGE_MASK) | (((uint32_t)type & 0x1) <<
@@ -153,9 +144,7 @@ static inline css_error set_background_position(css_computed_style *style,
uint8_t type, css_fixed length_a, css_unit unit_a, css_fixed
length_b, css_unit unit_b)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
/* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
*bits = (*bits & ~BACKGROUND_POSITION_MASK) | ((((uint32_t)type & 0x1)
@@ -179,9 +168,7 @@ static inline css_error set_background_position(css_computed_style *style,
static inline css_error set_background_repeat(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
+ uint32_t *bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~BACKGROUND_REPEAT_MASK) | (((uint32_t)type & 0x7) <<
@@ -200,9 +187,7 @@ static inline css_error set_background_repeat(css_computed_style *style,
static inline css_error set_border_bottom_color(css_computed_style *style,
uint8_t type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) | (((uint32_t)type & 0x3)
@@ -223,9 +208,7 @@ static inline css_error set_border_bottom_color(css_computed_style *style,
static inline css_error set_border_bottom_style(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) | (((uint32_t)type & 0xf)
@@ -244,9 +227,7 @@ static inline css_error set_border_bottom_style(css_computed_style *style,
static inline css_error set_border_bottom_width(css_computed_style *style,
uint8_t type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) | ((((uint32_t)type & 0x7)
@@ -267,9 +248,7 @@ static inline css_error set_border_bottom_width(css_computed_style *style,
static inline css_error set_border_collapse(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_COLLAPSE_MASK) | (((uint32_t)type & 0x3) <<
@@ -288,9 +267,7 @@ static inline css_error set_border_collapse(css_computed_style *style, uint8_t
static inline css_error set_border_left_color(css_computed_style *style,
uint8_t type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_LEFT_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -311,9 +288,7 @@ static inline css_error set_border_left_color(css_computed_style *style,
static inline css_error set_border_left_style(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BORDER_LEFT_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -332,9 +307,7 @@ static inline css_error set_border_left_style(css_computed_style *style,
static inline css_error set_border_left_width(css_computed_style *style,
uint8_t type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -355,9 +328,7 @@ static inline css_error set_border_left_width(css_computed_style *style,
static inline css_error set_border_right_color(css_computed_style *style,
uint8_t type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -378,9 +349,7 @@ static inline css_error set_border_right_color(css_computed_style *style,
static inline css_error set_border_right_style(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -399,9 +368,7 @@ static inline css_error set_border_right_style(css_computed_style *style,
static inline css_error set_border_right_width(css_computed_style *style,
uint8_t type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) | ((((uint32_t)type & 0x7) |
@@ -423,9 +390,7 @@ static inline css_error set_border_spacing(css_computed_style *style, uint8_t
type, css_fixed length_a, css_unit unit_a, css_fixed length_b,
css_unit unit_b)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_SPACING_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_SPACING_INDEX];
/* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
*bits = (*bits & ~BORDER_SPACING_MASK) | ((((uint32_t)type & 0x1) | (
@@ -448,9 +413,7 @@ static inline css_error set_border_spacing(css_computed_style *style, uint8_t
static inline css_error set_border_top_color(css_computed_style *style, uint8_t
type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BORDER_TOP_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -471,9 +434,7 @@ static inline css_error set_border_top_color(css_computed_style *style, uint8_t
static inline css_error set_border_top_style(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BORDER_TOP_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -492,9 +453,7 @@ static inline css_error set_border_top_style(css_computed_style *style, uint8_t
static inline css_error set_border_top_width(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~BORDER_TOP_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -515,9 +474,7 @@ static inline css_error set_border_top_width(css_computed_style *style, uint8_t
static inline css_error set_bottom(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BOTTOM_INDEX];
+ uint32_t *bits = &style->i.bits[BOTTOM_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~BOTTOM_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -537,9 +494,7 @@ static inline css_error set_bottom(css_computed_style *style, uint8_t type,
static inline css_error set_box_sizing(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BOX_SIZING_INDEX];
+ uint32_t *bits = &style->i.bits[BOX_SIZING_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~BOX_SIZING_MASK) | (((uint32_t)type & 0x3) <<
@@ -557,9 +512,7 @@ static inline css_error set_box_sizing(css_computed_style *style, uint8_t type)
static inline css_error set_break_after(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BREAK_AFTER_INDEX];
+ uint32_t *bits = &style->i.bits[BREAK_AFTER_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BREAK_AFTER_MASK) | (((uint32_t)type & 0xf) <<
@@ -578,9 +531,7 @@ static inline css_error set_break_after(css_computed_style *style, uint8_t type)
static inline css_error set_break_before(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BREAK_BEFORE_INDEX];
+ uint32_t *bits = &style->i.bits[BREAK_BEFORE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BREAK_BEFORE_MASK) | (((uint32_t)type & 0xf) <<
@@ -599,9 +550,7 @@ static inline css_error set_break_before(css_computed_style *style, uint8_t
static inline css_error set_break_inside(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[BREAK_INSIDE_INDEX];
+ uint32_t *bits = &style->i.bits[BREAK_INSIDE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~BREAK_INSIDE_MASK) | (((uint32_t)type & 0xf) <<
@@ -620,9 +569,7 @@ static inline css_error set_break_inside(css_computed_style *style, uint8_t
static inline css_error set_caption_side(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[CAPTION_SIDE_INDEX];
+ uint32_t *bits = &style->i.bits[CAPTION_SIDE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~CAPTION_SIDE_MASK) | (((uint32_t)type & 0x3) <<
@@ -640,9 +587,7 @@ static inline css_error set_caption_side(css_computed_style *style, uint8_t
static inline css_error set_clear(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[CLEAR_INDEX];
+ uint32_t *bits = &style->i.bits[CLEAR_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~CLEAR_MASK) | (((uint32_t)type & 0x7) << CLEAR_SHIFT);
@@ -697,15 +642,13 @@ static inline css_error set_clip(
#undef CLIP_MASK
#define COLOR_INDEX 14
-#define COLOR_SHIFT 19
-#define COLOR_MASK 0x80000
+#define COLOR_SHIFT 17
+#define COLOR_MASK 0x20000
static inline css_error set_color(css_computed_style *style, uint8_t type,
css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[COLOR_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~COLOR_MASK) | (((uint32_t)type & 0x1) << COLOR_SHIFT);
@@ -725,9 +668,7 @@ static inline css_error set_color(css_computed_style *style, uint8_t type,
static inline css_error set_column_count(css_computed_style *style, uint8_t
type, int32_t integer)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_COUNT_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_COUNT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~COLUMN_COUNT_MASK) | (((uint32_t)type & 0x3) <<
@@ -747,9 +688,7 @@ static inline css_error set_column_count(css_computed_style *style, uint8_t
static inline css_error set_column_fill(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_FILL_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_FILL_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~COLUMN_FILL_MASK) | (((uint32_t)type & 0x3) <<
@@ -768,9 +707,7 @@ static inline css_error set_column_fill(css_computed_style *style, uint8_t type)
static inline css_error set_column_gap(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_GAP_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_GAP_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~COLUMN_GAP_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -791,9 +728,7 @@ static inline css_error set_column_gap(css_computed_style *style, uint8_t type,
static inline css_error set_column_rule_color(css_computed_style *style,
uint8_t type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_RULE_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_RULE_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~COLUMN_RULE_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -814,9 +749,7 @@ static inline css_error set_column_rule_color(css_computed_style *style,
static inline css_error set_column_rule_style(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_RULE_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_RULE_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~COLUMN_RULE_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -835,9 +768,7 @@ static inline css_error set_column_rule_style(css_computed_style *style,
static inline css_error set_column_rule_width(css_computed_style *style,
uint8_t type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_RULE_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_RULE_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -857,9 +788,7 @@ static inline css_error set_column_rule_width(css_computed_style *style,
static inline css_error set_column_span(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_SPAN_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_SPAN_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~COLUMN_SPAN_MASK) | (((uint32_t)type & 0x3) <<
@@ -878,9 +807,7 @@ static inline css_error set_column_span(css_computed_style *style, uint8_t type)
static inline css_error set_column_width(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COLUMN_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[COLUMN_WIDTH_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~COLUMN_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -978,15 +905,13 @@ 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 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COUNTER_INCREMENT_INDEX];
+ uint32_t *bits = &style->i.bits[COUNTER_INCREMENT_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~COUNTER_INCREMENT_MASK) | (((uint32_t)type & 0x1) <<
@@ -1016,15 +941,13 @@ 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 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[COUNTER_RESET_INDEX];
+ uint32_t *bits = &style->i.bits[COUNTER_RESET_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~COUNTER_RESET_MASK) | (((uint32_t)type & 0x1) <<
@@ -1060,9 +983,7 @@ static inline css_error set_counter_reset(css_computed_style *style, uint8_t
static inline css_error set_cursor(css_computed_style *style, uint8_t type,
lwc_string **string_arr)
{
- uint32_t *bits;
-
- bits = &style->i.bits[CURSOR_INDEX];
+ uint32_t *bits = &style->i.bits[CURSOR_INDEX];
/* 5bits: ttttt : type */
*bits = (*bits & ~CURSOR_MASK) | (((uint32_t)type & 0x1f) <<
@@ -1097,9 +1018,7 @@ static inline css_error set_cursor(css_computed_style *style, uint8_t type,
static inline css_error set_direction(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[DIRECTION_INDEX];
+ uint32_t *bits = &style->i.bits[DIRECTION_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~DIRECTION_MASK) | (((uint32_t)type & 0x3) <<
@@ -1117,9 +1036,7 @@ static inline css_error set_direction(css_computed_style *style, uint8_t type)
static inline css_error set_display(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[DISPLAY_INDEX];
+ uint32_t *bits = &style->i.bits[DISPLAY_INDEX];
/* 5bits: ttttt : type */
*bits = (*bits & ~DISPLAY_MASK) | (((uint32_t)type & 0x1f) <<
@@ -1137,9 +1054,7 @@ static inline css_error set_display(css_computed_style *style, uint8_t type)
static inline css_error set_empty_cells(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[EMPTY_CELLS_INDEX];
+ uint32_t *bits = &style->i.bits[EMPTY_CELLS_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~EMPTY_CELLS_MASK) | (((uint32_t)type & 0x3) <<
@@ -1151,6 +1066,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 20
+#define FILL_OPACITY_MASK 0x100000
+
+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
@@ -1158,9 +1094,7 @@ static inline css_error set_empty_cells(css_computed_style *style, uint8_t type)
static inline css_error set_flex_basis(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_BASIS_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_BASIS_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~FLEX_BASIS_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1181,9 +1115,7 @@ static inline css_error set_flex_basis(css_computed_style *style, uint8_t type,
static inline css_error set_flex_direction(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_DIRECTION_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_DIRECTION_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~FLEX_DIRECTION_MASK) | (((uint32_t)type & 0x7) <<
@@ -1196,15 +1128,13 @@ 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_GROW_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_GROW_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~FLEX_GROW_MASK) | (((uint32_t)type & 0x1) <<
@@ -1219,15 +1149,13 @@ 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_SHRINK_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_SHRINK_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~FLEX_SHRINK_MASK) | (((uint32_t)type & 0x1) <<
@@ -1247,9 +1175,7 @@ static inline css_error set_flex_shrink(css_computed_style *style, uint8_t
static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLEX_WRAP_INDEX];
+ uint32_t *bits = &style->i.bits[FLEX_WRAP_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~FLEX_WRAP_MASK) | (((uint32_t)type & 0x3) <<
@@ -1267,9 +1193,7 @@ static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type)
static inline css_error set_float(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FLOAT_INDEX];
+ uint32_t *bits = &style->i.bits[FLOAT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~FLOAT_MASK) | (((uint32_t)type & 0x3) << FLOAT_SHIFT);
@@ -1287,9 +1211,7 @@ static inline css_error set_float(css_computed_style *style, uint8_t type)
static inline css_error set_font_family(css_computed_style *style, uint8_t
type, lwc_string **string_arr)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_FAMILY_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_FAMILY_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~FONT_FAMILY_MASK) | (((uint32_t)type & 0x7) <<
@@ -1325,9 +1247,7 @@ static inline css_error set_font_family(css_computed_style *style, uint8_t
static inline css_error set_font_size(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_SIZE_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_SIZE_INDEX];
/* 9bits: uuuuutttt : unit | type */
*bits = (*bits & ~FONT_SIZE_MASK) | ((((uint32_t)type & 0xf) | (unit <<
@@ -1347,9 +1267,7 @@ static inline css_error set_font_size(css_computed_style *style, uint8_t type,
static inline css_error set_font_style(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_STYLE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~FONT_STYLE_MASK) | (((uint32_t)type & 0x3) <<
@@ -1368,9 +1286,7 @@ static inline css_error set_font_style(css_computed_style *style, uint8_t type)
static inline css_error set_font_variant(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_VARIANT_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_VARIANT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~FONT_VARIANT_MASK) | (((uint32_t)type & 0x3) <<
@@ -1388,9 +1304,7 @@ static inline css_error set_font_variant(css_computed_style *style, uint8_t
static inline css_error set_font_weight(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[FONT_WEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[FONT_WEIGHT_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~FONT_WEIGHT_MASK) | (((uint32_t)type & 0xf) <<
@@ -1409,9 +1323,7 @@ static inline css_error set_font_weight(css_computed_style *style, uint8_t type)
static inline css_error set_height(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[HEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[HEIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1432,9 +1344,7 @@ static inline css_error set_height(css_computed_style *style, uint8_t type,
static inline css_error set_justify_content(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[JUSTIFY_CONTENT_INDEX];
+ uint32_t *bits = &style->i.bits[JUSTIFY_CONTENT_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~JUSTIFY_CONTENT_MASK) | (((uint32_t)type & 0x7) <<
@@ -1453,9 +1363,7 @@ static inline css_error set_justify_content(css_computed_style *style, uint8_t
static inline css_error set_left(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LEFT_INDEX];
+ uint32_t *bits = &style->i.bits[LEFT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~LEFT_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -1476,9 +1384,7 @@ static inline css_error set_left(css_computed_style *style, uint8_t type,
static inline css_error set_letter_spacing(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LETTER_SPACING_INDEX];
+ uint32_t *bits = &style->i.bits[LETTER_SPACING_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~LETTER_SPACING_MASK) | ((((uint32_t)type & 0x3) | (
@@ -1499,9 +1405,7 @@ static inline css_error set_letter_spacing(css_computed_style *style, uint8_t
static inline css_error set_line_height(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LINE_HEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[LINE_HEIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~LINE_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1516,15 +1420,13 @@ 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
+ uint32_t *bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~LIST_STYLE_IMAGE_MASK) | (((uint32_t)type & 0x1) <<
@@ -1554,9 +1456,7 @@ static inline css_error set_list_style_image(css_computed_style *style, uint8_t
static inline css_error set_list_style_position(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
+ uint32_t *bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~LIST_STYLE_POSITION_MASK) | (((uint32_t)type & 0x3)
@@ -1575,9 +1475,7 @@ static inline css_error set_list_style_position(css_computed_style *style,
static inline css_error set_list_style_type(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
+ uint32_t *bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
/* 6bits: tttttt : type */
*bits = (*bits & ~LIST_STYLE_TYPE_MASK) | (((uint32_t)type & 0x3f) <<
@@ -1596,9 +1494,7 @@ static inline css_error set_list_style_type(css_computed_style *style, uint8_t
static inline css_error set_margin_bottom(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
+ uint32_t *bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MARGIN_BOTTOM_MASK) | ((((uint32_t)type & 0x3) | (
@@ -1619,9 +1515,7 @@ static inline css_error set_margin_bottom(css_computed_style *style, uint8_t
static inline css_error set_margin_left(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MARGIN_LEFT_INDEX];
+ uint32_t *bits = &style->i.bits[MARGIN_LEFT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MARGIN_LEFT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1642,9 +1536,7 @@ static inline css_error set_margin_left(css_computed_style *style, uint8_t
static inline css_error set_margin_right(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MARGIN_RIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[MARGIN_RIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MARGIN_RIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1665,9 +1557,7 @@ static inline css_error set_margin_right(css_computed_style *style, uint8_t
static inline css_error set_margin_top(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MARGIN_TOP_INDEX];
+ uint32_t *bits = &style->i.bits[MARGIN_TOP_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MARGIN_TOP_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1688,9 +1578,7 @@ static inline css_error set_margin_top(css_computed_style *style, uint8_t type,
static inline css_error set_max_height(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MAX_HEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[MAX_HEIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MAX_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1711,9 +1599,7 @@ static inline css_error set_max_height(css_computed_style *style, uint8_t type,
static inline css_error set_max_width(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MAX_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[MAX_WIDTH_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MAX_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1734,9 +1620,7 @@ static inline css_error set_max_width(css_computed_style *style, uint8_t type,
static inline css_error set_min_height(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MIN_HEIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[MIN_HEIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MIN_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1757,9 +1641,7 @@ static inline css_error set_min_height(css_computed_style *style, uint8_t type,
static inline css_error set_min_width(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[MIN_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[MIN_WIDTH_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~MIN_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1774,15 +1656,13 @@ 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OPACITY_INDEX];
+ uint32_t *bits = &style->i.bits[OPACITY_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~OPACITY_MASK) | (((uint32_t)type & 0x1) <<
@@ -1797,15 +1677,13 @@ 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ORDER_INDEX];
+ uint32_t *bits = &style->i.bits[ORDER_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~ORDER_MASK) | (((uint32_t)type & 0x1) << ORDER_SHIFT);
@@ -1819,15 +1697,13 @@ 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[ORPHANS_INDEX];
+ uint32_t *bits = &style->i.bits[ORPHANS_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~ORPHANS_MASK) | (((uint32_t)type & 0x1) <<
@@ -1848,9 +1724,7 @@ static inline css_error set_orphans(css_computed_style *style, uint8_t type,
static inline css_error set_outline_color(css_computed_style *style, uint8_t
type, css_color color)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OUTLINE_COLOR_INDEX];
+ uint32_t *bits = &style->i.bits[OUTLINE_COLOR_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~OUTLINE_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -1871,9 +1745,7 @@ static inline css_error set_outline_color(css_computed_style *style, uint8_t
static inline css_error set_outline_style(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OUTLINE_STYLE_INDEX];
+ uint32_t *bits = &style->i.bits[OUTLINE_STYLE_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~OUTLINE_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -1892,9 +1764,7 @@ static inline css_error set_outline_style(css_computed_style *style, uint8_t
static inline css_error set_outline_width(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OUTLINE_WIDTH_INDEX];
+ uint32_t *bits = &style->i.bits[OUTLINE_WIDTH_INDEX];
/* 8bits: uuuuuttt : unit | type */
*bits = (*bits & ~OUTLINE_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -1914,9 +1784,7 @@ static inline css_error set_outline_width(css_computed_style *style, uint8_t
static inline css_error set_overflow_x(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OVERFLOW_X_INDEX];
+ uint32_t *bits = &style->i.bits[OVERFLOW_X_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~OVERFLOW_X_MASK) | (((uint32_t)type & 0x7) <<
@@ -1934,9 +1802,7 @@ static inline css_error set_overflow_x(css_computed_style *style, uint8_t type)
static inline css_error set_overflow_y(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[OVERFLOW_Y_INDEX];
+ uint32_t *bits = &style->i.bits[OVERFLOW_Y_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~OVERFLOW_Y_MASK) | (((uint32_t)type & 0x7) <<
@@ -1955,9 +1821,7 @@ static inline css_error set_overflow_y(css_computed_style *style, uint8_t type)
static inline css_error set_padding_bottom(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PADDING_BOTTOM_INDEX];
+ uint32_t *bits = &style->i.bits[PADDING_BOTTOM_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~PADDING_BOTTOM_MASK) | ((((uint32_t)type & 0x1) | (
@@ -1978,9 +1842,7 @@ static inline css_error set_padding_bottom(css_computed_style *style, uint8_t
static inline css_error set_padding_left(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PADDING_LEFT_INDEX];
+ uint32_t *bits = &style->i.bits[PADDING_LEFT_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~PADDING_LEFT_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -2001,9 +1863,7 @@ static inline css_error set_padding_left(css_computed_style *style, uint8_t
static inline css_error set_padding_right(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PADDING_RIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[PADDING_RIGHT_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~PADDING_RIGHT_MASK) | ((((uint32_t)type & 0x1) | (
@@ -2024,9 +1884,7 @@ static inline css_error set_padding_right(css_computed_style *style, uint8_t
static inline css_error set_padding_top(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PADDING_TOP_INDEX];
+ uint32_t *bits = &style->i.bits[PADDING_TOP_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~PADDING_TOP_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -2047,9 +1905,7 @@ static inline css_error set_padding_top(css_computed_style *style, uint8_t
static inline css_error set_page_break_after(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PAGE_BREAK_AFTER_INDEX];
+ uint32_t *bits = &style->i.bits[PAGE_BREAK_AFTER_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~PAGE_BREAK_AFTER_MASK) | (((uint32_t)type & 0x7) <<
@@ -2068,9 +1924,7 @@ static inline css_error set_page_break_after(css_computed_style *style, uint8_t
static inline css_error set_page_break_before(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PAGE_BREAK_BEFORE_INDEX];
+ uint32_t *bits = &style->i.bits[PAGE_BREAK_BEFORE_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) | (((uint32_t)type & 0x7) <<
@@ -2089,9 +1943,7 @@ static inline css_error set_page_break_before(css_computed_style *style,
static inline css_error set_page_break_inside(css_computed_style *style,
uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[PAGE_BREAK_INSIDE_INDEX];
+ uint32_t *bits = &style->i.bits[PAGE_BREAK_INSIDE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) | (((uint32_t)type & 0x3) <<
@@ -2109,9 +1961,7 @@ static inline css_error set_page_break_inside(css_computed_style *style,
static inline css_error set_position(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[POSITION_INDEX];
+ uint32_t *bits = &style->i.bits[POSITION_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~POSITION_MASK) | (((uint32_t)type & 0x7) <<
@@ -2123,16 +1973,14 @@ 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)
{
- uint32_t *bits;
-
- bits = &style->i.bits[QUOTES_INDEX];
+ uint32_t *bits = &style->i.bits[QUOTES_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~QUOTES_MASK) | (((uint32_t)type & 0x1) <<
@@ -2168,9 +2016,7 @@ static inline css_error set_quotes(css_computed_style *style, uint8_t type,
static inline css_error set_right(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[RIGHT_INDEX];
+ uint32_t *bits = &style->i.bits[RIGHT_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~RIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -2184,6 +2030,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
@@ -2191,9 +2058,7 @@ static inline css_error set_right(css_computed_style *style, uint8_t type,
static inline css_error set_table_layout(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TABLE_LAYOUT_INDEX];
+ uint32_t *bits = &style->i.bits[TABLE_LAYOUT_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~TABLE_LAYOUT_MASK) | (((uint32_t)type & 0x3) <<
@@ -2211,9 +2076,7 @@ static inline css_error set_table_layout(css_computed_style *style, uint8_t
static inline css_error set_text_align(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TEXT_ALIGN_INDEX];
+ uint32_t *bits = &style->i.bits[TEXT_ALIGN_INDEX];
/* 4bits: tttt : type */
*bits = (*bits & ~TEXT_ALIGN_MASK) | (((uint32_t)type & 0xf) <<
@@ -2232,9 +2095,7 @@ static inline css_error set_text_align(css_computed_style *style, uint8_t type)
static inline css_error set_text_decoration(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TEXT_DECORATION_INDEX];
+ uint32_t *bits = &style->i.bits[TEXT_DECORATION_INDEX];
/* 5bits: ttttt : type */
*bits = (*bits & ~TEXT_DECORATION_MASK) | (((uint32_t)type & 0x1f) <<
@@ -2253,9 +2114,7 @@ static inline css_error set_text_decoration(css_computed_style *style, uint8_t
static inline css_error set_text_indent(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TEXT_INDENT_INDEX];
+ uint32_t *bits = &style->i.bits[TEXT_INDENT_INDEX];
/* 6bits: uuuuut : unit | type */
*bits = (*bits & ~TEXT_INDENT_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -2276,9 +2135,7 @@ static inline css_error set_text_indent(css_computed_style *style, uint8_t
static inline css_error set_text_transform(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
+ uint32_t *bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~TEXT_TRANSFORM_MASK) | (((uint32_t)type & 0x7) <<
@@ -2297,9 +2154,7 @@ static inline css_error set_text_transform(css_computed_style *style, uint8_t
static inline css_error set_top(css_computed_style *style, uint8_t type,
css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[TOP_INDEX];
+ uint32_t *bits = &style->i.bits[TOP_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~TOP_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -2320,9 +2175,7 @@ static inline css_error set_top(css_computed_style *style, uint8_t type,
static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[UNICODE_BIDI_INDEX];
+ uint32_t *bits = &style->i.bits[UNICODE_BIDI_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~UNICODE_BIDI_MASK) | (((uint32_t)type & 0x3) <<
@@ -2341,9 +2194,7 @@ static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t
static inline css_error set_vertical_align(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
+ uint32_t *bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
/* 9bits: uuuuutttt : unit | type */
*bits = (*bits & ~VERTICAL_ALIGN_MASK) | ((((uint32_t)type & 0xf) | (
@@ -2363,9 +2214,7 @@ static inline css_error set_vertical_align(css_computed_style *style, uint8_t
static inline css_error set_visibility(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[VISIBILITY_INDEX];
+ uint32_t *bits = &style->i.bits[VISIBILITY_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~VISIBILITY_MASK) | (((uint32_t)type & 0x3) <<
@@ -2383,9 +2232,7 @@ static inline css_error set_visibility(css_computed_style *style, uint8_t type)
static inline css_error set_white_space(css_computed_style *style, uint8_t type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WHITE_SPACE_INDEX];
+ uint32_t *bits = &style->i.bits[WHITE_SPACE_INDEX];
/* 3bits: ttt : type */
*bits = (*bits & ~WHITE_SPACE_MASK) | (((uint32_t)type & 0x7) <<
@@ -2404,9 +2251,7 @@ static inline css_error set_white_space(css_computed_style *style, uint8_t type)
static inline css_error set_widows(css_computed_style *style, uint8_t type,
int32_t integer)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WIDOWS_INDEX];
+ uint32_t *bits = &style->i.bits[WIDOWS_INDEX];
/* 1bit: t : type */
*bits = (*bits & ~WIDOWS_MASK) | (((uint32_t)type & 0x1) <<
@@ -2425,17 +2270,29 @@ static inline css_error set_widows(css_computed_style *style, uint8_t type,
#define WIDTH_MASK 0xfe000000
static inline css_error set_width(css_computed_style *style, uint8_t type,
- css_fixed length, css_unit unit)
+ css_fixed_or_calc length, css_unit unit)
{
- uint32_t *bits;
+ uint32_t orig_bits = (style->i.bits[WIDTH_INDEX] & WIDTH_MASK) >>
+ WIDTH_SHIFT;
- bits = &style->i.bits[WIDTH_INDEX];
+ /* 7bits: uuuuutt : unit | type */
+ if ((orig_bits & 0x3) == CSS_WIDTH_SET) {
+ if ((orig_bits & 0x7c) >> 2 == CSS_UNIT_CALC) {
+ lwc_string_unref(style->i.width.calc);
+ }
+ }
+
+ uint32_t *bits = &style->i.bits[WIDTH_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
<< WIDTH_SHIFT);
- style->i.width = length;
+ if (unit == CSS_UNIT_CALC) {
+ style->i.width.calc = lwc_string_ref(length.calc);
+ } else {
+ style->i.width.value = length.value;
+ }
return CSS_OK;
}
@@ -2450,9 +2307,7 @@ static inline css_error set_width(css_computed_style *style, uint8_t type,
static inline css_error set_word_spacing(css_computed_style *style, uint8_t
type, css_fixed length, css_unit unit)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WORD_SPACING_INDEX];
+ uint32_t *bits = &style->i.bits[WORD_SPACING_INDEX];
/* 7bits: uuuuutt : unit | type */
*bits = (*bits & ~WORD_SPACING_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -2473,9 +2328,7 @@ static inline css_error set_word_spacing(css_computed_style *style, uint8_t
static inline css_error set_writing_mode(css_computed_style *style, uint8_t
type)
{
- uint32_t *bits;
-
- bits = &style->i.bits[WRITING_MODE_INDEX];
+ uint32_t *bits = &style->i.bits[WRITING_MODE_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~WRITING_MODE_MASK) | (((uint32_t)type & 0x3) <<
@@ -2494,9 +2347,7 @@ static inline css_error set_writing_mode(css_computed_style *style, uint8_t
static inline css_error set_z_index(css_computed_style *style, uint8_t type,
int32_t integer)
{
- uint32_t *bits;
-
- bits = &style->i.bits[Z_INDEX_INDEX];
+ uint32_t *bits = &style->i.bits[Z_INDEX_INDEX];
/* 2bits: tt : type */
*bits = (*bits & ~Z_INDEX_MASK) | (((uint32_t)type & 0x3) <<
@@ -2509,3 +2360,5 @@ static inline css_error set_z_index(css_computed_style *style, uint8_t type,
#undef Z_INDEX_INDEX
#undef Z_INDEX_SHIFT
#undef Z_INDEX_MASK
+
+#endif
diff --git a/src/select/calc.c b/src/select/calc.c
new file mode 100644
index 0000000..387188e
--- /dev/null
+++ b/src/select/calc.c
@@ -0,0 +1,285 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2024 Daniel Silverstone <dsilvers@netsurf-browser.org>
+ */
+
+#include "libcss/hint.h"
+
+#include "select/calc.h"
+#include "select/helpers.h"
+#include "select/unit.h"
+
+#include "utils/utils.h"
+
+/** The default number of entries on a calculator stack */
+#define DEFAULT_STACK_SIZE 32
+
+#ifndef NDEBUG
+#define CANARY "A css_calculator has leaked"
+#define CANARY_SLEN SLEN(CANARY)
+#endif
+
+/****************************** Allocation **********************************/
+
+/* Exported function, documented in calc.h */
+css_error css_calculator_create(css_calculator **out)
+{
+ *out = calloc(1, sizeof(css_calculator));
+ if (*out == NULL) {
+ return CSS_NOMEM;
+ }
+
+#ifndef NDEBUG
+ if (lwc_intern_string(CANARY, CANARY_SLEN, &((*out)->canary)) !=
+ lwc_error_ok) {
+ free(*out);
+ *out = NULL;
+ return CSS_NOMEM;
+ }
+#endif
+
+ (*out)->stack =
+ calloc(DEFAULT_STACK_SIZE, sizeof(css_calculator_stack_entry));
+ if ((*out)->stack == NULL) {
+#ifndef NDEBUG
+ lwc_string_unref((*out)->canary);
+#endif
+ free(*out);
+ *out = NULL;
+ return CSS_NOMEM;
+ }
+
+ (*out)->refcount = 1;
+ (*out)->stack_alloc = DEFAULT_STACK_SIZE;
+ (*out)->stack_ptr = 0;
+
+ return CSS_OK;
+}
+
+/* Exported function, documented in calc.h */
+css_calculator *css_calculator_ref(css_calculator *calc)
+{
+ calc->refcount += 1;
+ return calc;
+}
+
+/* Exported function, documented in calc.h */
+void css_calculator_unref(css_calculator *calc)
+{
+ calc->refcount -= 1;
+ if (calc->refcount == 0) {
+#ifndef NDEBUG
+ lwc_string_unref(calc->canary);
+#endif
+ free(calc->stack);
+ free(calc);
+ }
+}
+
+/****************************** Helpers ************************************/
+
+static css_error css__calculator_push(css_calculator *calc, unit unit,
+ css_fixed value)
+{
+ if (calc->stack_ptr == calc->stack_alloc) {
+ css_calculator_stack_entry *newstack =
+ realloc(calc->stack, sizeof(css_calculator_stack_entry) *
+ 2 * calc->stack_alloc);
+ if (newstack == NULL) {
+ return CSS_NOMEM;
+ }
+ calc->stack = newstack;
+ calc->stack_alloc *= 2;
+ }
+ calc->stack[calc->stack_ptr].unit = unit;
+ calc->stack[calc->stack_ptr].value = value;
+ calc->stack_ptr += 1;
+
+ return CSS_OK;
+}
+
+static css_error css__calculator_pop(css_calculator *calc, unit *unit,
+ css_fixed *value)
+{
+ if (calc->stack_ptr == 0) {
+ return CSS_INVALID;
+ }
+
+ calc->stack_ptr -= 1;
+ *unit = calc->stack[calc->stack_ptr].unit;
+ *value = calc->stack[calc->stack_ptr].value;
+
+ return CSS_OK;
+}
+
+#define CALC_PUSH(unit, value) \
+ do { \
+ ret = css__calculator_push(calc, unit, value); \
+ if (ret != CSS_OK) { \
+ return ret; \
+ } \
+ } while (0)
+
+#define CALC_POP(unit, value) \
+ do { \
+ ret = css__calculator_pop(calc, &unit, &value); \
+ if (ret != CSS_OK) { \
+ return ret; \
+ } \
+ } while (0)
+
+/* Normalise:
+ * - lengths to pixels
+ * - angles to degrees
+ * - time to ms
+ * - freq to hz
+ * - resolution to dpi
+ */
+static css_error css__normalise_unit(const css_unit_ctx *unit_ctx,
+ const css_computed_style *style,
+ int32_t available, unit *u, css_fixed *v)
+{
+ if (*u & UNIT_LENGTH) {
+ css_fixed px = css_unit_len2css_px(style, unit_ctx, *v,
+ css__to_css_unit(*u));
+ *v = px;
+ *u = UNIT_PX;
+ return CSS_OK;
+ } else if (*u & UNIT_ANGLE) {
+ css_fixed deg = css_unit_angle2deg(css__to_css_unit(*u), *v);
+ *v = deg;
+ *u = UNIT_DEG;
+ return CSS_OK;
+ } else if (*u & UNIT_TIME) {
+ if (*u == UNIT_S) {
+ *v = css_multiply_fixed(*v, INTTOFIX(1000));
+ }
+ *u = UNIT_MS;
+ return CSS_OK;
+ } else if (*u & UNIT_FREQ) {
+ if (*u == UNIT_KHZ) {
+ *v = css_multiply_fixed(*v, INTTOFIX(1000));
+ }
+ *u = UNIT_HZ;
+ return CSS_OK;
+ } else if (*u & UNIT_RESOLUTION) {
+ if (*u == UNIT_DPCM) {
+ *v = css_multiply_fixed(*v, FLTTOFIX(2.54));
+ } else if (*u == UNIT_DPPX) {
+ *v = css_multiply_fixed(*v, INTTOFIX(96));
+ }
+ *u = UNIT_DPI;
+ return CSS_OK;
+ } else if (*u == UNIT_PCT) {
+ css_fixed pct100 = css_unit_device2css_px(INTTOFIX(available),
+ unit_ctx->device_dpi);
+ if (available < 0) {
+ return CSS_INVALID;
+ }
+ *v = css_multiply_fixed(*v, pct100);
+ *v = css_divide_fixed(*v, F_100);
+ *u = UNIT_PX;
+ return CSS_OK;
+ } else if (*u == UNIT_CALC_NUMBER) {
+ /* Nothing to do to normalise numbers */
+ return CSS_OK;
+ }
+ return CSS_INVALID;
+}
+
+/****************************** Compute ************************************/
+
+/* Exported function, documented in calc.h */
+css_error css_calculator_calculate(css_calculator *calc,
+ const css_unit_ctx *unit_ctx,
+ int32_t available, lwc_string *expr,
+ const css_computed_style *style,
+ css_unit *unit_out, css_fixed *value_out)
+{
+ css_error ret = CSS_OK;
+ /* Alignment note: lwc string data is always very well aligned */
+ css_code_t *codeptr = (css_code_t *)(void *)lwc_string_data(expr);
+
+ /* Reset the stack before we begin, just in case */
+ calc->stack_ptr = 0;
+
+ /* We are trusting that the bytecode is sane */
+ while (*codeptr != CALC_FINISH) {
+ css_code_t op = *codeptr++;
+ switch (op) {
+ case CALC_PUSH_VALUE: {
+ css_fixed v = (css_fixed)(*codeptr++);
+ unit u = (unit)(*codeptr++);
+ ret = css__normalise_unit(unit_ctx, style, available,
+ &u, &v);
+ if (ret != CSS_OK) {
+ return ret;
+ }
+ CALC_PUSH(u, v);
+ break;
+ }
+ case CALC_PUSH_NUMBER: {
+ css_fixed v = (css_fixed)(*codeptr++);
+ CALC_PUSH(UNIT_CALC_NUMBER, v);
+ break;
+ }
+ case CALC_ADD: /* fallthrough */
+ case CALC_SUBTRACT: {
+ unit u_left, u_right;
+ css_fixed v_left, v_right;
+ CALC_POP(u_right, v_right);
+ CALC_POP(u_left, v_left);
+ if (op == CALC_ADD) {
+ v_left = css_add_fixed(v_left, v_right);
+ } else {
+ v_left = css_subtract_fixed(v_left, v_right);
+ }
+ CALC_PUSH(u_left, v_left);
+ break;
+ }
+ case CALC_MULTIPLY: /* fallthrough */
+ case CALC_DIVIDE: {
+ unit u_left, u_right;
+ css_fixed v_left, v_right;
+ CALC_POP(u_right, v_right);
+ CALC_POP(u_left, v_left);
+
+ if (op == CALC_MULTIPLY && u_left == UNIT_CALC_NUMBER) {
+ unit u_tmp = u_left;
+ css_fixed v_tmp = v_left;
+ u_left = u_right;
+ v_left = v_right;
+ u_right = u_tmp;
+ v_right = v_tmp;
+ }
+
+ if (u_right != UNIT_CALC_NUMBER) {
+ return CSS_INVALID;
+ }
+
+ if (op == CALC_MULTIPLY) {
+ v_left = css_multiply_fixed(v_left, v_right);
+ } else {
+ v_left = css_divide_fixed(v_left, v_right);
+ }
+
+ CALC_PUSH(u_left, v_left);
+ break;
+ }
+ case CALC_FINISH: /* Should not happen */
+ default:
+ return CSS_INVALID;
+ }
+ }
+
+ if (calc->stack_ptr != 1) {
+ return CSS_INVALID;
+ }
+
+ *unit_out = css__to_css_unit(calc->stack[0].unit);
+ *value_out = calc->stack[0].value;
+
+ return CSS_OK;
+}
diff --git a/src/select/calc.h b/src/select/calc.h
new file mode 100644
index 0000000..4f5fd4d
--- /dev/null
+++ b/src/select/calc.h
@@ -0,0 +1,92 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2024 Daniel Silverstone <dsilvers@netsurf-browser.org>
+ */
+
+#ifndef css_select_calc_h_
+#define css_select_calc_h_
+
+#include <stdint.h>
+
+#include "bytecode/bytecode.h"
+#include "libcss/errors.h"
+#include "libcss/unit.h"
+
+typedef struct {
+ unit unit;
+ css_fixed value;
+} css_calculator_stack_entry;
+
+typedef struct {
+ uint32_t refcount;
+ css_calculator_stack_entry *stack;
+ size_t stack_alloc;
+ size_t stack_ptr;
+#ifndef NDEBUG
+ lwc_string *canary;
+#endif
+} css_calculator;
+
+/**
+ * Create a new CSS calculator
+ *
+ * This creates a new CSS calculator with a reference count of one.
+ *
+ * The caller is responsible for calling \ref css_calculator_unref
+ * when it is done with this calculator.
+ *
+ * \param out The created calculator in saved here
+ * \return CSS_OK if no problems were encountered, likely CSS_NOMEM if there
+ * were
+ */
+css_error css_calculator_create(css_calculator **out);
+
+/**
+ * Add a ref to a CSS calculator
+ *
+ * If you are storing a calculator in more than one place you should ref
+ * it when storing it into a new place. You will neeed to call \ref
+ * css_calculator_unref to match any call to this.
+ *
+ * \param calc The calculator to add a reference to
+ * \return The same calculator pointer for ease of use
+ */
+css_calculator *css_calculator_ref(css_calculator *calc);
+
+/**
+ * Unref a CSS calculator
+ *
+ * Every call to \ref css_calculator_create or \ref css_calculator_ref must be
+ * matched with a call to this function. When the last ref is removed then
+ * the underlying calculator is freed.
+ *
+ * \param calc The calculator to unref
+ */
+void css_calculator_unref(css_calculator *calc);
+
+/**
+ * Perform a calculation
+ *
+ * To resolve the value of a calc() property, call this function. This will
+ * interpret the bytecode in the given expression, with the given display
+ * context and available space, and will fill out the computed unit and value.
+ *
+ * \param calc The calculator to use
+ * \param unit_ctx The display context for resolving units
+ * \param available The available space (for percentages)
+ * \param style The style from which the expression was derived
+ * \param expr The expression to compute
+ * \param unit_out The computed unit is placed here
+ * \param value_out The computed value is placed here
+ * \return CSS_OK if computation succeeded, otherwise likely CSS_INVALID or
+ * CSS_NOMEM
+ */
+css_error css_calculator_calculate(css_calculator *calc,
+ const css_unit_ctx *unit_ctx,
+ int32_t available, lwc_string *expr,
+ const css_computed_style *style,
+ css_unit *unit_out, css_fixed *value_out);
+
+#endif /* css_select_calc_h_ */
diff --git a/src/select/computed.c b/src/select/computed.c
index c257f17..3f5b8a7 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -8,6 +8,7 @@
#include <string.h>
#include "select/arena.h"
+#include "select/calc.h"
#include "select/computed.h"
#include "select/dispatch.h"
#include "select/propget.h"
@@ -48,6 +49,12 @@ static css_error compute_absolute_length(css_computed_style *style,
css_fixed *len, css_unit *unit),
css_error (*set)(css_computed_style *style, uint8_t type,
css_fixed len, css_unit unit));
+static css_error compute_absolute_length_calc(css_computed_style *style,
+ const css_hint_length *ex_size,
+ uint8_t (*get)(const css_computed_style *style,
+ css_fixed_or_calc *len, css_unit *unit),
+ css_error (*set)(css_computed_style *style, uint8_t type,
+ css_fixed_or_calc len, css_unit unit));
static css_error compute_absolute_length_pair(css_computed_style *style,
const css_hint_length *ex_size,
uint8_t (*get)(const css_computed_style *style,
@@ -66,18 +73,20 @@ static css_error compute_absolute_length_pair(css_computed_style *style,
* CSS_NOMEM on memory exhaustion,
* CSS_BADPARM on bad parameters.
*/
-css_error css__computed_style_create(css_computed_style **result)
+css_error css__computed_style_create(css_computed_style **result, css_calculator *calc)
{
css_computed_style *s;
if (result == NULL)
return CSS_BADPARM;
- s = calloc(sizeof(css_computed_style), 1);
+ s = calloc(1, sizeof(css_computed_style));
if (s == NULL)
return CSS_NOMEM;
s->bin = UINT32_MAX;
+ s->calc = css_calculator_ref(calc);
+
*result = s;
return CSS_OK;
@@ -189,6 +198,11 @@ css_error css_computed_style_destroy(css_computed_style *style)
if (style->i.background_image != NULL)
lwc_string_unref(style->i.background_image);
+ if (style->calc != NULL)
+ css_calculator_unref(style->calc);
+
+#include "select/autogenerated_destroy.inc"
+
free(style);
return CSS_OK;
@@ -246,7 +260,7 @@ css_error css__computed_style_clone(
css_error error;
css_computed_style *clone;
- error = css__computed_style_create(&clone);
+ error = css__computed_style_create(&clone, orig->calc);
if (error != CSS_OK) {
return error;
}
@@ -291,7 +305,7 @@ css_error css_computed_style_compose(
* to avoid the churn of unnecesaraly allocating and freeing
* the memory to compose styles into.
*/
- error = css__computed_style_create(&composed);
+ error = css__computed_style_create(&composed, child->calc);
if (error != CSS_OK) {
return error;
}
@@ -688,10 +702,69 @@ uint8_t css_computed_max_width(const css_computed_style *style,
return get_max_width(style, length, unit);
}
+uint8_t css_computed_width_px(
+ const css_computed_style *style,
+ const css_unit_ctx *unit_ctx,
+ int available_px,
+ int *px_out)
+{
+ enum css_width_e type;
+ css_unit unit = CSS_UNIT_PX;
+ css_fixed_or_calc value = {.value = 0};
+
+ type = get_width(style, &value, &unit);
+ switch (type) {
+ case CSS_WIDTH_INHERIT:
+ break;
+ case CSS_WIDTH_AUTO:
+ break;
+ case CSS_WIDTH_SET:
+ switch (unit) {
+ case CSS_UNIT_CALC:
+ if (css_calculator_calculate(
+ style->calc, unit_ctx,
+ available_px, value.calc,
+ style, &unit, &value.value) == CSS_OK) {
+ type = CSS_WIDTH_SET;
+ *px_out = FIXTOINT(value.value);
+ } else {
+ type = CSS_WIDTH_AUTO;
+ }
+ break;
+ case CSS_UNIT_PCT:
+ if (available_px < 0) {
+ type = CSS_WIDTH_AUTO;
+ break;
+ }
+
+ *px_out = FPCT_OF_INT_TOINT(
+ value.value,
+ available_px);
+ break;
+ default:
+ *px_out = FIXTOINT(css_unit_len2device_px(
+ style, unit_ctx,
+ value.value, unit));
+ break;
+ }
+ break;
+ }
+
+ return type;
+}
+
uint8_t css_computed_width(const css_computed_style *style,
css_fixed *length, css_unit *unit)
{
- return get_width(style, length, unit);
+ css_fixed_or_calc length_ = {.value = 0};
+ uint8_t ret = get_width(style, &length_, unit);
+ if (ret == CSS_WIDTH_SET) {
+ if (*unit == CSS_UNIT_CALC) {
+ return CSS_WIDTH_AUTO;
+ }
+ *length = length_.value;
+ }
+ return ret;
}
uint8_t css_computed_empty_cells(const css_computed_style *style)
@@ -810,6 +883,18 @@ 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_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);
@@ -1264,7 +1349,7 @@ css_error css__compute_absolute_values(const css_computed_style *parent,
return error;
/* Fix up width */
- error = compute_absolute_length(style, &ex_size.data.length,
+ error = compute_absolute_length_calc(style, &ex_size.data.length,
get_width, set_width);
if (error != CSS_OK)
return error;
@@ -1759,6 +1844,38 @@ css_error compute_absolute_length(css_computed_style *style,
return CSS_OK;
}
+/**
+ * Compute the absolute value of length
+ *
+ * \param style Style to process
+ * \param ex_size Ex size, in ems
+ * \param get Function to read length
+ * \param set Function to write length
+ * \return CSS_OK on success
+ */
+css_error compute_absolute_length_calc(css_computed_style *style,
+ const css_hint_length *ex_size,
+ uint8_t (*get)(const css_computed_style *style,
+ css_fixed_or_calc *len, css_unit *unit),
+ css_error (*set)(css_computed_style *style, uint8_t type,
+ css_fixed_or_calc len, css_unit unit))
+{
+ css_unit unit = CSS_UNIT_PX;
+ css_fixed_or_calc length;
+ uint8_t type;
+
+ type = get(style, &length, &unit);
+
+ if (type == CSS_WIDTH_SET && unit == CSS_UNIT_EX) {
+ length.value = FMUL(length.value, ex_size->value);
+ unit = ex_size->unit;
+
+ return set(style, type, length, unit);
+ }
+
+ return CSS_OK;
+}
+
/**
* Compute the absolute value of length pair
diff --git a/src/select/computed.h b/src/select/computed.h
index a1e4eed..f376b21 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -13,6 +13,7 @@
#include <libcss/unit.h>
#include "autogenerated_computed.h"
+#include "calc.h"
/**
* Take a new reference to a computed style
@@ -30,7 +31,7 @@ static inline css_computed_style * css__computed_style_ref(
return style;
}
-css_error css__computed_style_create(css_computed_style **result);
+css_error css__computed_style_create(css_computed_style **result, css_calculator *calc);
css_error css__computed_style_initialise(css_computed_style *style,
struct css_select_handler *handler, void *pw);
diff --git a/src/select/dispatch.c b/src/select/dispatch.c
index a6c868d..cee9335 100644
--- a/src/select/dispatch.c
+++ b/src/select/dispatch.c
@@ -514,5 +514,13 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
{
PROPERTY_FUNCS(order),
0,
+ },
+ {
+ PROPERTY_FUNCS(fill_opacity),
+ 1,
+ },
+ {
+ PROPERTY_FUNCS(stroke_opacity),
+ 1,
}
};
diff --git a/src/select/overrides.py b/src/select/overrides.py
index b4d349a..869d6ec 100644
--- a/src/select/overrides.py
+++ b/src/select/overrides.py
@@ -183,35 +183,3 @@ static inline css_error set_content(
return CSS_OK;
}'''
-
-get_side = '''\
-static inline uint8_t get_{0}(
- const css_computed_style *style,
- css_fixed *length, css_unit *unit)
-{{
- uint32_t bits = style->i.bits[{1}_INDEX];
- bits &= {1}_MASK;
- bits >>= {1}_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- if ((bits & 0x3) == CSS_{1}_SET) {{
- *length = style->i.{0};
- *unit = bits >> 2;
- }}
-
- return (bits & 0x3);
-}}
-static inline uint8_t get_{0}_bits(
- const css_computed_style *style)
-{{
- uint32_t bits = style->i.bits[{1}_INDEX];
- bits &= {1}_MASK;
- bits >>= {1}_SHIFT;
-
- /* 7bits: uuuuutt : units | type */
- return bits;
-}}'''
-overrides['get']['top'] = get_side.format('top', 'TOP')
-overrides['get']['right'] = get_side.format('right', 'RIGHT')
-overrides['get']['bottom'] = get_side.format('bottom', 'BOTTOM')
-overrides['get']['left'] = get_side.format('left', 'LEFT')
diff --git a/src/select/properties/Makefile b/src/select/properties/Makefile
index 6c6cf84..eee6cc3 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 \
@@ -107,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/column_count.c b/src/select/properties/column_count.c
index 4adadd6..e502061 100644
--- a/src/select/properties/column_count.c
+++ b/src/select/properties/column_count.c
@@ -30,6 +30,13 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style,
case COLUMN_COUNT_AUTO:
value = CSS_COLUMN_COUNT_AUTO;
break;
+ case COLUMN_COUNT_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
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/flex_basis.c b/src/select/properties/flex_basis.c
index a3141bc..ed614c0 100644
--- a/src/select/properties/flex_basis.c
+++ b/src/select/properties/flex_basis.c
@@ -36,6 +36,13 @@ css_error css__cascade_flex_basis(uint32_t opv, css_style *style,
unit = *((uint32_t *) style->bytecode);
advance_bytecode(style, sizeof(unit));
break;
+ case FLEX_BASIS_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
diff --git a/src/select/properties/flex_grow.c b/src/select/properties/flex_grow.c
index 4650cef..d4fbf5d 100644
--- a/src/select/properties/flex_grow.c
+++ b/src/select/properties/flex_grow.c
@@ -21,10 +21,21 @@ css_error css__cascade_flex_grow(uint32_t opv, css_style *style,
css_fixed flex_grow = 0;
if (hasFlagValue(opv) == false) {
- value = CSS_FLEX_GROW_SET;
+ switch (getValue(opv)) {
+ case FLEX_GROW_SET:
+ value = CSS_FLEX_GROW_SET;
- flex_grow = *((css_fixed *) style->bytecode);
- advance_bytecode(style, sizeof(flex_grow));
+ flex_grow = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(flex_grow));
+ break;
+ case FLEX_GROW_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
+ }
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
diff --git a/src/select/properties/flex_shrink.c b/src/select/properties/flex_shrink.c
index 9b39ed0..3075d7b 100644
--- a/src/select/properties/flex_shrink.c
+++ b/src/select/properties/flex_shrink.c
@@ -21,10 +21,21 @@ css_error css__cascade_flex_shrink(uint32_t opv, css_style *style,
css_fixed flex_shrink = 0;
if (hasFlagValue(opv) == false) {
- value = CSS_FLEX_SHRINK_SET;
+ switch (getValue(opv)) {
+ case FLEX_SHRINK_SET:
+ value = CSS_FLEX_SHRINK_SET;
- flex_shrink = *((css_fixed *) style->bytecode);
- advance_bytecode(style, sizeof(flex_shrink));
+ flex_shrink = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(flex_shrink));
+ break;
+ case FLEX_SHRINK_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
+ }
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
diff --git a/src/select/properties/font_size.c b/src/select/properties/font_size.c
index 3ee9ce0..e4141d6 100644
--- a/src/select/properties/font_size.c
+++ b/src/select/properties/font_size.c
@@ -59,6 +59,13 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
case FONT_SIZE_SMALLER:
value = CSS_FONT_SIZE_SMALLER;
break;
+ case FONT_SIZE_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
diff --git a/src/select/properties/helpers.c b/src/select/properties/helpers.c
index 10ff228..f1f1d9f 100644
--- a/src/select/properties/helpers.c
+++ b/src/select/properties/helpers.c
@@ -165,6 +165,13 @@ css_error css__cascade_border_width(uint32_t opv, css_style *style,
case BORDER_WIDTH_THICK:
value = CSS_BORDER_WIDTH_THICK;
break;
+ case BORDER_WIDTH_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
@@ -199,6 +206,13 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
case BOTTOM_AUTO:
value = CSS_BOTTOM_AUTO;
break;
+ case BOTTOM_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
@@ -212,6 +226,50 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
return CSS_OK;
}
+css_error css__cascade_length_auto_calc(uint32_t opv, css_style *style,
+ css_select_state *state,
+ css_error (*fun)(css_computed_style *, uint8_t, css_fixed_or_calc,
+ css_unit))
+{
+ uint16_t value = CSS_BOTTOM_INHERIT;
+ css_fixed_or_calc length = (css_fixed_or_calc)0;
+ uint32_t unit = CSS_UNIT_PX;
+ uint32_t snum = 0;
+
+ if (hasFlagValue(opv) == false) {
+ switch (getValue(opv)) {
+ case BOTTOM_SET:
+ value = CSS_BOTTOM_SET;
+ length.value = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(length.value));
+ unit = css__to_css_unit(*((uint32_t *) style->bytecode));
+ advance_bytecode(style, sizeof(unit));
+ break;
+ case BOTTOM_AUTO:
+ value = CSS_BOTTOM_AUTO;
+ break;
+ case BOTTOM_CALC:
+ value = CSS_BOTTOM_SET;
+ advance_bytecode(style, sizeof(unit)); // TODO: Skip unit, not sure what to do
+ snum = *((uint32_t *) style->bytecode);
+ advance_bytecode(style, sizeof(snum));
+ unit = CSS_UNIT_CALC;
+ css__stylesheet_string_get(style->sheet, snum, &length.calc);
+ break;
+ default:
+ assert(0 && "Invalid value");
+ break;
+ }
+ }
+
+ if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
+ getFlagValue(opv))) {
+ return fun(state->computed, value, length, unit);
+ }
+
+ return CSS_OK;
+}
+
css_error css__cascade_length_normal(uint32_t opv, css_style *style,
css_select_state *state,
css_error (*fun)(css_computed_style *, uint8_t, css_fixed,
@@ -233,6 +291,13 @@ css_error css__cascade_length_normal(uint32_t opv, css_style *style,
case LETTER_SPACING_NORMAL:
value = CSS_LETTER_SPACING_NORMAL;
break;
+ case LETTER_SPACING_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
@@ -267,6 +332,13 @@ css_error css__cascade_length_none(uint32_t opv, css_style *style,
case MAX_HEIGHT_NONE:
value = CSS_MAX_HEIGHT_NONE;
break;
+ case MAX_HEIGHT_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
@@ -290,11 +362,22 @@ css_error css__cascade_length(uint32_t opv, css_style *style,
uint32_t unit = UNIT_PX;
if (hasFlagValue(opv) == false) {
- value = CSS_MIN_HEIGHT_SET;
- length = *((css_fixed *) style->bytecode);
- advance_bytecode(style, sizeof(length));
- unit = *((uint32_t *) style->bytecode);
- advance_bytecode(style, sizeof(unit));
+ switch (getValue(opv)) {
+ case MIN_HEIGHT_SET:
+ value = CSS_MIN_HEIGHT_SET;
+ length = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(length));
+ unit = *((uint32_t *) style->bytecode);
+ advance_bytecode(style, sizeof(unit));
+ break;
+ case MIN_HEIGHT_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
+ }
}
unit = css__to_css_unit(unit);
@@ -318,9 +401,20 @@ css_error css__cascade_number(uint32_t opv, css_style *style,
/** \todo values */
if (hasFlagValue(opv) == false) {
- value = 0;
- length = *((css_fixed *) style->bytecode);
- advance_bytecode(style, sizeof(length));
+ switch (getValue(opv)) {
+ case ORPHANS_SET:
+ value = 0;
+ length = *((css_fixed *) style->bytecode);
+ advance_bytecode(style, sizeof(length));
+ break;
+ case ORPHANS_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
+ }
}
/** \todo lose fun != NULL once all properties have set routines */
diff --git a/src/select/properties/helpers.h b/src/select/properties/helpers.h
index 16c5d7a..d326856 100644
--- a/src/select/properties/helpers.h
+++ b/src/select/properties/helpers.h
@@ -9,6 +9,7 @@
#define css_select_properties_helpers_h_
#include "select/helpers.h"
+#include "select/autogenerated_computed.h"
uint32_t generic_destroy_color(void *bytecode);
uint32_t generic_destroy_uri(void *bytecode);
@@ -33,6 +34,10 @@ css_error css__cascade_length_auto(uint32_t opv, css_style *style,
css_select_state *state,
css_error (*fun)(css_computed_style *, uint8_t, css_fixed,
css_unit));
+css_error css__cascade_length_auto_calc(uint32_t opv, css_style *style,
+ css_select_state *state,
+ css_error (*fun)(css_computed_style *, uint8_t, css_fixed_or_calc,
+ css_unit));
css_error css__cascade_length_normal(uint32_t opv, css_style *style,
css_select_state *state,
css_error (*fun)(css_computed_style *, uint8_t, css_fixed,
diff --git a/src/select/properties/line_height.c b/src/select/properties/line_height.c
index 7300b5d..2cf2402 100644
--- a/src/select/properties/line_height.c
+++ b/src/select/properties/line_height.c
@@ -38,6 +38,13 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style,
case LINE_HEIGHT_NORMAL:
value = CSS_LINE_HEIGHT_NORMAL;
break;
+ case LINE_HEIGHT_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
diff --git a/src/select/properties/opacity.c b/src/select/properties/opacity.c
index 818af62..3e875f9 100644
--- a/src/select/properties/opacity.c
+++ b/src/select/properties/opacity.c
@@ -21,7 +21,7 @@ css_error css__cascade_opacity(uint32_t opv, css_style *style,
css_fixed opacity = 0;
if (hasFlagValue(opv) == false) {
- value = CSS_Z_INDEX_SET;
+ value = CSS_OPACITY_SET;
opacity = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(opacity));
diff --git a/src/select/properties/order.c b/src/select/properties/order.c
index 4004c0e..0164fd0 100644
--- a/src/select/properties/order.c
+++ b/src/select/properties/order.c
@@ -21,10 +21,21 @@ css_error css__cascade_order(uint32_t opv, css_style *style,
css_fixed order = 0;
if (hasFlagValue(opv) == false) {
- value = CSS_ORDER_SET;
+ switch (getValue(opv)) {
+ case ORDER_SET:
+ value = CSS_ORDER_SET;
- order = FIXTOINT(*((css_fixed *) style->bytecode));
- advance_bytecode(style, sizeof(order));
+ order = FIXTOINT(*((css_fixed *) style->bytecode));
+ advance_bytecode(style, sizeof(order));
+ break;
+ case ORDER_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
+ }
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
diff --git a/src/select/properties/pitch.c b/src/select/properties/pitch.c
index c0c5c88..f665561 100644
--- a/src/select/properties/pitch.c
+++ b/src/select/properties/pitch.c
@@ -35,6 +35,13 @@ css_error css__cascade_pitch(uint32_t opv, css_style *style,
case PITCH_X_HIGH:
/** \todo convert to public values */
break;
+ case PITCH_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h
index be31d0b..cb0b213 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);
@@ -129,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/speech_rate.c b/src/select/properties/speech_rate.c
index 296c248..98fbe84 100644
--- a/src/select/properties/speech_rate.c
+++ b/src/select/properties/speech_rate.c
@@ -34,6 +34,13 @@ css_error css__cascade_speech_rate(uint32_t opv, css_style *style,
case SPEECH_RATE_SLOWER:
/** \todo convert to public values */
break;
+ case SPEECH_RATE_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
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/properties/vertical_align.c b/src/select/properties/vertical_align.c
index 9fbffe6..790e5f0 100644
--- a/src/select/properties/vertical_align.c
+++ b/src/select/properties/vertical_align.c
@@ -55,6 +55,13 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style,
case VERTICAL_ALIGN_TEXT_BOTTOM:
value = CSS_VERTICAL_ALIGN_TEXT_BOTTOM;
break;
+ case VERTICAL_ALIGN_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
diff --git a/src/select/properties/volume.c b/src/select/properties/volume.c
index 65bdd03..64dd9a0 100644
--- a/src/select/properties/volume.c
+++ b/src/select/properties/volume.c
@@ -40,6 +40,13 @@ css_error css__cascade_volume(uint32_t opv, css_style *style,
case VOLUME_X_LOUD:
/** \todo convert to public values */
break;
+ case VOLUME_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
diff --git a/src/select/properties/width.c b/src/select/properties/width.c
index c6d33ff..b382bcc 100644
--- a/src/select/properties/width.c
+++ b/src/select/properties/width.c
@@ -17,26 +17,26 @@
css_error css__cascade_width(uint32_t opv, css_style *style,
css_select_state *state)
{
- return css__cascade_length_auto(opv, style, state, set_width);
+ return css__cascade_length_auto_calc(opv, style, state, set_width);
}
css_error css__set_width_from_hint(const css_hint *hint,
css_computed_style *style)
{
return set_width(style, hint->status,
- hint->data.length.value, hint->data.length.unit);
+ (css_fixed_or_calc)(hint->data.length.value), hint->data.length.unit);
}
css_error css__initial_width(css_select_state *state)
{
- return set_width(state->computed, CSS_WIDTH_AUTO, 0, CSS_UNIT_PX);
+ return set_width(state->computed, CSS_WIDTH_AUTO, (css_fixed_or_calc)0, CSS_UNIT_PX);
}
css_error css__copy_width(
const css_computed_style *from,
css_computed_style *to)
{
- css_fixed length = 0;
+ css_fixed_or_calc length = (css_fixed_or_calc)0;
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_width(from, &length, &unit);
@@ -51,7 +51,7 @@ css_error css__compose_width(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
- css_fixed length = 0;
+ css_fixed_or_calc length = (css_fixed_or_calc)0;
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_width(child, &length, &unit);
diff --git a/src/select/properties/z_index.c b/src/select/properties/z_index.c
index e5159e5..23d0402 100644
--- a/src/select/properties/z_index.c
+++ b/src/select/properties/z_index.c
@@ -31,6 +31,13 @@ css_error css__cascade_z_index(uint32_t opv, css_style *style,
case Z_INDEX_AUTO:
value = CSS_Z_INDEX_AUTO;
break;
+ case Z_INDEX_CALC:
+ advance_bytecode(style, sizeof(unit));
+ advance_bytecode(style, sizeof(unit)); // TODO
+ return CSS_OK;
+ default:
+ assert(0 && "Invalid value");
+ break;
}
}
diff --git a/src/select/select.c b/src/select/select.c
index da0aa61..3b12692 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -16,6 +16,7 @@
#include "bytecode/opcodes.h"
#include "stylesheet.h"
#include "select/arena.h"
+#include "select/calc.h"
#include "select/computed.h"
#include "select/dispatch.h"
#include "select/hash.h"
@@ -57,6 +58,8 @@ struct css_select_ctx {
css_select_strings str;
+ css_calculator *calc; /**< A calculator to hand off to computed styles */
+
/* Interned default style */
css_computed_style *default_style;
};
@@ -138,7 +141,7 @@ static css_error css__create_node_data(struct css_node_data **node_data)
{
struct css_node_data *nd;
- nd = calloc(sizeof(struct css_node_data), 1);
+ nd = calloc(1, sizeof(struct css_node_data));
if (nd == NULL) {
return CSS_NOMEM;
}
@@ -234,12 +237,19 @@ css_error css_select_ctx_create(css_select_ctx **result)
if (result == NULL)
return CSS_BADPARM;
- c = calloc(sizeof(css_select_ctx), 1);
+ c = calloc(1, sizeof(css_select_ctx));
if (c == NULL)
return CSS_NOMEM;
+ error = css_calculator_create(&c->calc);
+ if (error != CSS_OK) {
+ free(c);
+ return error;
+ }
+
error = css_select_strings_intern(&c->str);
if (error != CSS_OK) {
+ css_calculator_unref(c->calc);
free(c);
return error;
}
@@ -272,6 +282,8 @@ css_error css_select_ctx_destroy(css_select_ctx *ctx)
free(ctx->sheets);
}
+ css_calculator_unref(ctx->calc);
+
free(ctx);
return CSS_OK;
@@ -453,7 +465,7 @@ static css_error css__select_ctx_create_default_style(css_select_ctx *ctx,
css_error error;
/* Need to construct the default style */
- error = css__computed_style_create(&style);
+ error = css__computed_style_create(&style, ctx->calc);
if (error != CSS_OK)
return error;
@@ -613,7 +625,7 @@ static css_error css__create_node_bloom(
*node_bloom = NULL;
/* Create the node's bloom */
- bloom = calloc(sizeof(css_bloom), CSS_BLOOM_SIZE);
+ bloom = calloc(CSS_BLOOM_SIZE, sizeof(css_bloom));
if (bloom == NULL) {
return CSS_NOMEM;
}
@@ -1314,7 +1326,7 @@ css_error css_select_style(css_select_ctx *ctx, void *node,
/* Base element style is guaranteed to exist
*/
error = css__computed_style_create(
- &state.results->styles[CSS_PSEUDO_ELEMENT_NONE]);
+ &state.results->styles[CSS_PSEUDO_ELEMENT_NONE], ctx->calc);
if (error != CSS_OK) {
goto cleanup;
}
@@ -2226,7 +2238,7 @@ css_error match_selector_chain(css_select_ctx *ctx,
/* Ensure that the appropriate computed style exists */
if (state->results->styles[pseudo] == NULL) {
error = css__computed_style_create(
- &state->results->styles[pseudo]);
+ &state->results->styles[pseudo], ctx->calc);
if (error != CSS_OK)
return error;
}
diff --git a/src/select/select_config.py b/src/select/select_config.py
index fd9e765..a4ba423 100644
--- a/src/select/select_config.py
+++ b/src/select/select_config.py
@@ -95,6 +95,8 @@ 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'),
+ ('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'),
@@ -102,7 +104,7 @@ style = {
('padding_bottom', 1, 'length', 'CSS_PADDING_SET'),
('text_indent', 1, 'length', 'CSS_TEXT_INDENT_SET'),
('vertical_align', 4, 'length', 'CSS_VERTICAL_ALIGN_SET'),
- ('width', 2, 'length', 'CSS_WIDTH_SET'),
+ ('width', 2, (('length', None, 'calc'),), 'CSS_WIDTH_SET'),
('z_index', 2, 'integer'),
# Style group, arrays
('font_family', 3, 'string_arr', None, None,
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index dcb0429..f40ee4b 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -167,6 +167,7 @@ class CSSValue:
self.size = size # `None` means sizeof(ptr)
self.defaults = defaults
self.suffix = ''
+ self.calc = False
self.bits = None if bits_size is None else {
'name': bits_name,
'type': bits_type,
@@ -223,6 +224,13 @@ class CSSProperty:
def make_values(self, vals):
"""Make list of values for this property."""
+ self.has_calc = False
+
+ if vals is not None and any(len(val) > 2 and val[2] == 'calc' for val in vals):
+ self.has_calc = True
+
+ print(f"name: {self.name}, {vals}, has calc: {self.has_calc}")
+
if vals is None:
return []
elif type(vals) is str:
@@ -233,8 +241,10 @@ class CSSProperty:
for x in values:
if x[0] == v[0]:
value = CSSValue(*x)
- if len(v) == 2:
+ if len(v) > 1 and v[1] != None:
value.defaults = v[1]
+ if len(v) > 2 and v[2] == 'calc':
+ value.calc = True
if len(vals) > 1:
value.suffix = '_' + string.ascii_lowercase[i]
val_list.append(value)
@@ -322,18 +332,17 @@ class CSSProperty:
"""
vals = []
for v in self.values:
+ or_calc = '_or_calc' if v.calc else ''
+ star = '*' if pointer else ''
vt, vn = shift_star(v.type, v.name)
- vn += v.suffix
+ vn = star + vn + v.suffix
if pointer:
- vn = '*' + vn
if v.name == 'counter_arr' or v.name == 'content_item':
vt = 'const ' + vt
- vals.append((vt, vn))
+ vals.append((vt + or_calc, vn))
if v.bits is not None:
- bt, bn = shift_star(v.bits['type'], v.bits['name'])
- bn += v.suffix
- if pointer:
- bn = '*' + bn
+ bt = v.bits['type']
+ bn = star + v.bits['name'] + v.suffix
vals.append((bt, bn))
return vals
@@ -429,21 +438,12 @@ class CSSGroup:
return bits_array
- def get_idot_grp(self):
- """Make parameters for accessing bits and values in this group."""
- i_dot = '' if self.name == 'page' else 'i.'
- grp = '' if self.name == 'style' else '->{}{}'.format(
- '' if self.name == 'page' else i_dot, self.name)
- return (i_dot, grp)
-
def make_computed_h(self):
"""Output this group's text for the computed.h file."""
t = Text()
t.append()
- typedef = 'typedef ' if self.name == 'page' else ''
- t.append('{}struct css_computed_{}{} {{'.format(
- typedef, self.name, '' if self.name == 'page' else '_i'))
+ t.append('struct css_computed_style_i {')
t.comment()
commented = []
@@ -490,103 +490,29 @@ class CSSGroup:
t.append()
t.append(self.make_value_declaration(for_commented=False))
- if self.name == 'style':
- t.append()
- for g in css_groups:
- if g.name != 'style' and g.name != 'page':
- t.append('css_computed_{0} *{0};'.format(g.name))
-
t.indent(-1)
- t.append('}}{};'.format(
- ' css_computed_' + self.name if typedef else ''))
+ t.append('};')
- if self.name != 'page':
- typedef = 'typedef ' if self.name != 'style' else ''
- t.append()
- t.append('{}struct css_computed_{} {{'.format(
- typedef, self.name))
- t.indent(1)
- t.append('struct css_computed_' + self.name + '_i i;')
- t.append()
- t.append(self.make_value_declaration(for_commented=True))
- t.append()
+ t.append()
+ t.append('struct css_computed_style {')
+ t.indent(1)
+ t.append('struct css_computed_style_i i;')
+ t.append()
+ t.append(self.make_value_declaration(for_commented=True))
+ t.append()
- t.append('struct css_computed_' + self.name + ' *next;')
- t.append('uint32_t count;')
- t.append('uint32_t bin;')
- t.indent(-1)
- t.append('}}{};'.format(
- ' css_computed_' + self.name if typedef else ''))
+ t.append('struct css_computed_style *next;')
+ t.append('uint32_t count;')
+ t.append('uint32_t bin;')
+ t.append('css_calculator *calc;')
+ t.indent(-1)
+ t.append('};')
return t.to_string()
def make_propset_h(self):
- """Output this group's property functions for the propset.h file.
-
- If group is not `style`, will also output the defaults
- and the ENSURE_{group} texts.
- """
+ """Output this group's property functions for the propset.h file."""
t = Text()
- i_dot, grp = self.get_idot_grp()
-
- if self.name != 'style':
- t.append('static const css_computed_{0} default_{0} = {{'.format(
- self.name))
- t.indent(1)
-
- if self.name != 'page':
- t.append('.i = {')
- t.indent(1)
-
- t.append('.bits = {')
- t.indent(1)
-
- bits_ops = []
- for b in self.bits_array:
- or_ops = []
- for p in b.contents:
- or_ops.append('({} << {})'.format(p.defaults, str(p.shift))
- if p.shift else p.defaults)
- bits_ops.append(' | '.join(or_ops))
-
- t.append(',\n'.join(bits_ops).split('\n'))
- t.indent(-1)
- t.append('},')
- t.append(',\n'.join(
- self.make_value_declaration(False, True)).split('\n'))
-
- if self.name != 'page':
- t.indent(-1)
- t.append('},')
- t.append(',\n'.join(
- self.make_value_declaration(True, True) +
- [ '.next = NULL', '.count = 0', '.bin = UINT32_MAX' ]
- ).split('\n'))
-
- t.indent(-1)
- t.append('};')
-
- t.append()
- t.escape_newline()
- t.append('#define ENSURE_{} do {{'.format(self.name.upper()))
- t.indent(1)
- t.append('if (style->{}{} == NULL) {{'.format(i_dot, self.name))
- t.indent(1)
- t.append('style->{}{n} = malloc(sizeof(css_computed_{n}));'.format(
- i_dot, n=self.name))
- t.append('if (style->{}{} == NULL)'.format(i_dot, self.name))
- t.indent(1)
- t.append('return CSS_NOMEM;')
- t.indent(-1)
- t.append()
- t.append('memcpy(style->{}{n}, &default_{n}, '
- 'sizeof(css_computed_{n}));'.format(i_dot, n=self.name))
- t.indent(-1)
- t.append('}')
- t.indent(-1)
- t.append('} while(0)')
- t.escape_newline()
- t.append()
for p in sorted(self.props, key=(lambda x: x.name)):
defines, undefs = p.def_undefs
@@ -608,15 +534,26 @@ class CSSGroup:
t.append('{')
t.indent(1)
- t.append('uint32_t *bits;')
- t.append()
+ # Ensure any existing calc() values are freed
+ if p.has_calc:
+ t.append('uint32_t orig_bits = (style->i.bits[{name}_INDEX] & {name}_MASK) >> {name}_SHIFT;'.format(name=p.name.upper()))
+ t.append()
- if self.name != 'style':
- t.append('ENSURE_{};'.format(self.name.upper()))
+ type_mask, shift_list, bits_comment = p.get_bits()
+ t.append(bits_comment)
+ t.append('if ((orig_bits & {}) == {}) {{'.format(type_mask, p.condition))
+ t.indent(1)
+ for i, v in enumerate(list(reversed(shift_list))):
+ t.append('if ((orig_bits & 0x{:x}) >> {} == CSS_UNIT_CALC) {{'.format(v[2], v[1]))
+ t.indent(1)
+ t.append('lwc_string_unref(style->i.{}.calc);'.format(p.name))
+ t.indent(-1)
+ t.append('}')
+ t.indent(-1)
+ t.append('}')
t.append()
- t.append('bits = &style{}->{}bits[{}_INDEX];'.format(
- grp, i_dot, p.name.upper()))
+ t.append('uint32_t *bits = &style->i.bits[{}_INDEX];'.format(p.name.upper()))
t.append()
type_mask, shift_list, bits_comment = p.get_bits()
@@ -637,19 +574,17 @@ class CSSGroup:
old_t, old_n_shift = shift_star(v.type, old_n)
if v.name == 'string':
- t.append('{} {} = style{}->{}{};'.format(
- old_t, old_n_shift,
- grp, i_dot, p.name + v.suffix))
+ t.append('{} {} = style->i.{};'.format(
+ old_t, old_n_shift, p.name + v.suffix))
t.append()
t.append('if ({} != NULL) {{'.format(v.name + v.suffix))
t.indent(1)
- t.append('style{}->{}{} = lwc_string_ref({});'.format(
- grp, i_dot, p.name + v.suffix, v.name + v.suffix))
+ t.append('style->i.{} = lwc_string_ref({});'.format(
+ p.name + v.suffix, v.name + v.suffix))
t.indent(-1)
t.append('} else {')
t.indent(1)
- t.append('style{}->{}{} = NULL;'.format(
- grp, i_dot, p.name + v.suffix))
+ t.append('style->i.{} = NULL;'.format(p.name + v.suffix))
t.indent(-1)
t.append('}')
t.append()
@@ -661,9 +596,9 @@ class CSSGroup:
elif v.name == 'string_arr' or v.name == 'counter_arr':
iter_var = 's' if v.name == 'string_arr' else 'c'
iter_deref = '*s' if v.name == 'string_arr' else 'c->name'
- t.append('{} {} = style{}->{};'.format(
+ t.append('{} {} = style->{};'.format(
old_t, old_n_shift,
- grp, p.name + v.suffix))
+ p.name + v.suffix))
t.append('{} {};'.format(old_t,
shift_star(v.type, iter_var)[1]))
t.append()
@@ -674,8 +609,8 @@ class CSSGroup:
t.append('{0} = lwc_string_ref({0});'.format(iter_deref))
t.indent(-1)
t.append()
- t.append('style{}->{} = {};'.format(
- grp, p.name + v.suffix, v.name + v.suffix))
+ t.append('style->{} = {};'.format(
+ p.name + v.suffix, v.name + v.suffix))
t.append()
t.append('/* Free existing array */')
t.append('if ({} != NULL) {{'.format(old_n))
@@ -693,8 +628,17 @@ class CSSGroup:
t.append('}')
elif not v.is_ptr:
- t.append('style{}->{}{} = {};'.format(
- grp, i_dot, p.name + v.suffix, v.name + v.suffix))
+ if p.has_calc:
+ t.append('if (unit == CSS_UNIT_CALC) {')
+ t.append('\tstyle->i.{}.calc = lwc_string_ref({}.calc);'.format(
+ p.name + v.suffix, v.name + v.suffix))
+ t.append('} else {')
+ t.append('\tstyle->i.{}.value = {}.value;'.format(
+ p.name + v.suffix, v.name + v.suffix))
+ t.append('}')
+ else:
+ t.append('style->i.{} = {};'.format(
+ p.name + v.suffix, v.name + v.suffix))
else:
raise ValueError('Cannot handle value ' + v.name +'!')
@@ -707,23 +651,19 @@ class CSSGroup:
return t.to_string()
- def print_propget(self, t, p):
- i_dot, grp = self.get_idot_grp()
-
- vals = p.get_param_values(pointer=True)
+ def print_propget(self, t, p, only_bits=False):
+ vals = [] if only_bits else p.get_param_values(pointer=True)
params = ', '.join([ 'css_computed_style *style' ]
+ [ ' '.join(x) for x in vals ])
- t.append('static inline uint8_t get_{}(const {})'.format(
- p.name, params))
+
+ underscore_bits = '_bits' if only_bits else ''
+ t.append('static inline uint8_t get_{}{}(const {})'.format(
+ p.name, underscore_bits, params))
t.append('{')
t.indent(1)
- if self.name != 'style':
- t.append('if (style{} != NULL) {{'.format(grp))
- t.indent(1)
-
- t.append('uint32_t bits = style{}->{}bits[{}_INDEX];'.format(
- grp, i_dot, p.name.upper()))
+ t.append('uint32_t bits = style->i.bits[{}_INDEX];'.format(
+ p.name.upper()))
t.append('bits &= {}_MASK;'.format(p.name.upper()))
t.append('bits >>= {}_SHIFT;'.format(p.name.upper()))
t.append()
@@ -731,41 +671,31 @@ class CSSGroup:
type_mask, shift_list, bits_comment = p.get_bits()
t.append(bits_comment)
- if p.condition:
- t.append('if ((bits & {}) == {}) {{'.format(
- type_mask, p.condition))
- t.indent(1)
+ if only_bits == False:
+ if p.condition:
+ t.append('if ((bits & {}) == {}) {{'.format(
+ type_mask, p.condition))
+ t.indent(1)
- for v in p.values:
- this_idot = '' if v.is_ptr and v.name != 'string' else i_dot
- t.append('*{} = style{}->{}{};'.format(
- v.name + v.suffix, grp, this_idot, p.name + v.suffix))
- for i, v in enumerate(list(reversed(shift_list))):
- if i == 0:
- t.append('*{} = bits >> {};'.format(v[0], v[1]))
- else:
- t.append('*{} = (bits & 0x{:x}) >> {};'.format(
- v[0], v[2], v[1]).lower())
+ for v in p.values:
+ print(f"name: {p.name}, has_calc: {p.has_calc}, v.name: {v.name}")
+ i_dot = '' if v.is_ptr and v.name != 'string' else 'i.'
+ t.append('*{} = style->{}{};'.format(
+ v.name + v.suffix, i_dot, p.name + v.suffix))
+ for i, v in enumerate(list(reversed(shift_list))):
+ if i == 0:
+ t.append('*{} = bits >> {};'.format(v[0], v[1]))
+ else:
+ t.append('*{} = (bits & 0x{:x}) >> {};'.format(
+ v[0], v[2], v[1]).lower())
- if p.condition:
- t.indent(-1)
- t.append('}')
+ if p.condition:
+ t.indent(-1)
+ t.append('}')
+ t.append()
- t.append()
t.append('return (bits & {});'.format(type_mask))
- if self.name != 'style':
- t.indent(-1)
- t.append('}')
- t.append()
- t.append('/* Initial value */')
- for v in p.values:
- t.append('*{} = {};'.format(v.name + v.suffix, v.defaults))
- if v.bits is not None:
- t.append('*{} = {};'.format(
- v.bits['name'] + v.suffix, v.bits['defaults']))
- t.append('return {};'.format(p.defaults))
-
t.indent(-1)
t.append('}')
@@ -779,6 +709,8 @@ class CSSGroup:
t.append()
t.append(defines)
+ self.print_propget(t, p, True)
+
if p.name in overrides['get']:
t.append(overrides['get'][p.name], pre_formatted=True)
else:
@@ -788,7 +720,22 @@ class CSSGroup:
return t.to_string()
- def make_value_declaration(self, for_commented, defaults=False):
+ def print_destroy(self, t, p):
+ if p.has_calc:
+ t.append("set_{}(style, 0, (css_fixed_or_calc)0, CSS_UNIT_PX);".format(p.name))
+ else:
+ t.append("/* set_{}(style, 0, 0, CSS_UNIT_PX); */".format(p.name))
+
+ def make_destroy_inc(self):
+ """Output this group's destructors for the destroy.h file."""
+ t = Text()
+
+ for p in sorted(self.props, key=(lambda x: x.name)):
+ self.print_destroy(t, p)
+
+ return t.to_string()
+
+ def make_value_declaration(self, for_commented):
"""Output declarations of values for this group's properties.
Args:
@@ -799,13 +746,12 @@ class CSSGroup:
r = []
for p in sorted(self.props, key=(lambda x: x.name)):
if bool(p.comments) == for_commented:
+ if (p.values == None or len(p.values) == 0):
+ continue
for v in p.values:
- if defaults:
- r.append('.{}{} = {}'.format(p.name, v.suffix,
- v.defaults))
- else:
- v_type, v_name = shift_star(v.type, p.name)
- r.append('{} {}{};'.format(v_type, v_name, v.suffix))
+ or_calc = '_or_calc' if v.calc else ''
+ v_type, v_name = shift_star(v.type, p.name)
+ r.append('{} {}{};'.format(v_type + or_calc, v_name, v.suffix))
return r
def make_text(self, filename):
@@ -816,6 +762,8 @@ class CSSGroup:
return self.make_propset_h()
elif filename == 'propget.h':
return self.make_propget_h()
+ elif filename == 'destroy.inc':
+ return self.make_destroy_inc()
else:
raise ValueError()
diff --git a/src/select/unit.c b/src/select/unit.c
index 3294db3..75c33db 100644
--- a/src/select/unit.c
+++ b/src/select/unit.c
@@ -511,3 +511,16 @@ css_error css_unit_compute_absolute_font_size(
return CSS_OK;
}
+
+/* Exported function, documented in utils/unit.h. */
+css_fixed css_unit_angle2deg(const css_unit unit, const css_fixed angle)
+{
+ if (unit == CSS_UNIT_GRAD) {
+ return FMUL(angle, FLTTOFIX(0.9));
+ } else if (unit == CSS_UNIT_RAD) {
+ return FDIV(FMUL(angle, F_180), F_PI);
+ } else {
+ /* Must be degrees as DEG/RAD/GRAD are all angle kinds */
+ return angle;
+ }
+}
diff --git a/src/select/unit.h b/src/select/unit.h
index 6a677b6..8b5d905 100644
--- a/src/select/unit.h
+++ b/src/select/unit.h
@@ -39,4 +39,15 @@ css_error css_unit_compute_absolute_font_size(
css_fixed font_size_default,
css_hint *size);
+/**
+ * Convert any angle to degrees.
+ *
+ * It is invalid to call this with a unit which isn't of \ref UNIT_ANGLE
+ *
+ * \param[in] unit The unit the angle is in
+ * \param[in] angle The angle to convert
+ * \return the angle in degrees
+ */
+css_fixed css_unit_angle2deg(const css_unit unit, const css_fixed angle);
+
#endif
diff --git a/src/stylesheet.h b/src/stylesheet.h
index 070508f..673bc95 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -272,8 +272,12 @@ static inline css_error css_stylesheet_style_unset(css_style *style,
static inline css_error css_stylesheet_style_flag_value(css_style *style,
enum flag_value flag_value, opcode_t opcode)
{
+ enum flag flag = flag_value << 1;
+ if (flag == FLAG_REVERT) {
+ style->sheet->uses_revert = true;
+ }
return css__stylesheet_style_append(style,
- buildOPV(opcode, flag_value << 1, 0));
+ buildOPV(opcode, flag, 0));
}
css_error css__stylesheet_selector_create(css_stylesheet *sheet,
diff --git a/test/INDEX b/test/INDEX
index d712157..9b980c0 100644
--- a/test/INDEX
+++ b/test/INDEX
@@ -11,6 +11,7 @@ number Conversion of numbers to fixed point number
parse-auto Automated parser tests (bytecode) parse
parse2-auto Automated parser tests (om & invalid) parse2
select Automated selection engine tests select
+select2 Automated selection engine tests (resolved units) select2
# Regression tests
diff --git a/test/Makefile b/test/Makefile
index 18124ce..fdd03d8 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -2,6 +2,6 @@
DIR_TEST_ITEMS := csdetect:csdetect.c css21:css21.c lex:lex.c \
lex-auto:lex-auto.c number:number.c \
parse:parse.c parse-auto:parse-auto.c parse2-auto:parse2-auto.c \
- select:select.c
+ select:select.c select2:select2.c
include $(NSBUILD)/Makefile.subdir
diff --git a/test/data/parse2/INDEX b/test/data/parse2/INDEX
index e4a369c..59dc83b 100644
--- a/test/data/parse2/INDEX
+++ b/test/data/parse2/INDEX
@@ -24,3 +24,5 @@ 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
+calc.dat calc() tests
diff --git a/test/data/parse2/calc.dat b/test/data/parse2/calc.dat
new file mode 100644
index 0000000..f743411
--- /dev/null
+++ b/test/data/parse2/calc.dat
@@ -0,0 +1,195 @@
+#data
+* { height: calc(50vh + 10px)}
+#errors
+#expected
+| *
+| height: /* -> 0px */ calc(50vh 10px + =)
+#reset
+
+#data
+* { line-height: calc(50vh + 10px)}
+#errors
+#expected
+| *
+| line-height: /* -> 0any */ calc(50vh 10px + =)
+#reset
+
+#data
+* { line-height: calc( / 2)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { line-height: calc( + 2)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { line-height: calc(2 / 2px)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { width: calc(50vh + 10px)}
+#errors
+#expected
+| *
+| width: /* -> 0px */ calc(50vh 10px + =)
+#reset
+
+#data
+* { z-index: calc(2 * 3)}
+#errors
+#expected
+| *
+| z-index: /* -> 0number */ calc(2 3 * =)
+#reset
+
+#data
+* { z-index: calc(4 + 5 / 9)}
+#errors
+#expected
+| *
+| z-index: /* -> 0number */ calc(4 5 9 / + =)
+#reset
+
+#data
+* { z-index: calc(1 + 2 + 3 + 4)}
+#errors
+#expected
+| *
+| z-index: /* -> 0number */ calc(1 2 + 3 + 4 + =)
+#reset
+
+#data
+* { z-index: calc(1 + 2 * 3 + 4)}
+#errors
+#expected
+| *
+| z-index: /* -> 0number */ calc(1 2 3 * + 4 + =)
+#reset
+
+#data
+* { z-index: calc((1 + 2) * (3 + 4))}
+#errors
+#expected
+| *
+| z-index: /* -> 0number */ calc(1 2 + 3 4 + * =)
+#reset
+
+#data
+* { z-index: calc(1 + 2}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc(}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc (1 + 2)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc(1)}
+#errors
+#expected
+| *
+| z-index: /* -> 0number */ calc(1 =)
+#reset
+
+#data
+* { z-index: calc()}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc((1 + 2)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc(((1 + 2)))}
+#errors
+#expected
+| *
+| z-index: /* -> 0number */ calc(1 2 + =)
+#reset
+
+#data
+* { z-index: calc( ( ( 1 + 2 ) ) )}
+#errors
+#expected
+| *
+| z-index: /* -> 0number */ calc(1 2 + =)
+#reset
+
+#data
+* { z-index: calc( ( 3 / ( 1 + 2 ) ) )}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { width: calc(50vh + 10hz)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { width: calc(50% + 10px)}
+#errors
+#expected
+| *
+| width: /* -> 0px */ calc(50% 10px + =)
+#reset
+
+#data
+* { word-spacing: calc(50% + 10px)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { word-spacing: calc(0.4em + 10px)}
+#errors
+#expected
+| *
+| word-spacing: /* -> 0px */ calc(0.400em 10px + =)
+#reset
+
+#data
+* { width: calc(1em + 1px) !important }
+#errors
+#expected
+| *
+| width: /* -> 0px */ calc(1em 1px + =) !important
+#reset
diff --git a/test/data/parse2/svg.dat b/test/data/parse2/svg.dat
new file mode 100644
index 0000000..e5ee2a3
--- /dev/null
+++ b/test/data/parse2/svg.dat
@@ -0,0 +1,79 @@
+#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
+
+#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/INDEX b/test/data/select/INDEX
index c05567a..9c8aad2 100644
--- a/test/data/select/INDEX
+++ b/test/data/select/INDEX
@@ -4,3 +4,4 @@
tests1.dat Basic tests
defaulting.dat Explicit defaulting tests
+calc.dat Tests involving calc \ No newline at end of file
diff --git a/test/data/select/calc.dat b/test/data/select/calc.dat
new file mode 100644
index 0000000..928f997
--- /dev/null
+++ b/test/data/select/calc.dat
@@ -0,0 +1,112 @@
+#tree
+| div*
+#ua
+div { width: calc(10% + 16px); }
+#user
+div { width: 10px; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: 10px
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
diff --git a/test/data/select/defaulting.dat b/test/data/select/defaulting.dat
index 4242e30..9548ae8 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
@@ -91,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
@@ -161,6 +163,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -202,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
@@ -273,6 +277,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -314,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
@@ -386,6 +392,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -427,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
@@ -495,6 +503,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -536,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
@@ -608,6 +618,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -649,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
@@ -720,6 +732,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
@@ -761,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
@@ -832,6 +846,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -873,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
@@ -944,6 +960,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -985,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
@@ -1053,6 +1071,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1094,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
@@ -1165,6 +1185,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1206,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
@@ -1279,6 +1301,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
@@ -1320,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
@@ -1393,6 +1417,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1434,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 997e88e..9240ed6 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
@@ -93,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
@@ -163,6 +165,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
@@ -204,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
@@ -277,6 +281,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -318,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
@@ -395,6 +401,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -436,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
@@ -514,6 +522,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
@@ -555,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
@@ -633,6 +643,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -674,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
@@ -752,6 +764,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -793,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
@@ -861,6 +875,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -902,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
@@ -971,6 +987,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1012,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
@@ -1081,6 +1099,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1122,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
@@ -1190,6 +1210,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1231,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
@@ -1304,6 +1326,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1345,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
@@ -1418,6 +1442,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1459,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
@@ -1533,6 +1559,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1574,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
@@ -1651,6 +1679,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1692,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
@@ -1768,6 +1798,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -1809,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
@@ -1891,6 +1923,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
@@ -1932,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
@@ -2014,6 +2048,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
@@ -2055,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
@@ -2137,6 +2173,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
@@ -2178,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
@@ -2264,6 +2302,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
@@ -2305,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
@@ -2390,6 +2430,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
@@ -2431,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
@@ -2514,6 +2556,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
@@ -2555,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
@@ -2637,6 +2681,7 @@ cursor: auto
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2678,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
@@ -2760,6 +2806,7 @@ cursor: auto
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2801,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
@@ -2883,6 +2931,7 @@ cursor: auto
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -2924,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
@@ -3006,6 +3056,7 @@ cursor: crosshair
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3047,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
@@ -3129,6 +3181,7 @@ cursor: default
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3170,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
@@ -3252,6 +3306,7 @@ cursor: pointer
direction: ltr
display: table
empty-cells: hide
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3293,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
@@ -3375,6 +3431,7 @@ cursor: move
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -3416,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
@@ -3498,6 +3556,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
@@ -3539,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
@@ -3621,6 +3681,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
@@ -3662,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
@@ -3744,6 +3806,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
@@ -3785,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
@@ -3867,6 +3931,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
@@ -3908,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
@@ -3990,6 +4056,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
@@ -4031,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
@@ -4113,6 +4181,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
@@ -4154,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
@@ -4236,6 +4306,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
@@ -4277,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
@@ -4359,6 +4431,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
@@ -4400,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
@@ -4482,6 +4556,7 @@ cursor: text
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4523,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
@@ -4605,6 +4681,7 @@ cursor: wait
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4646,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
@@ -4728,6 +4806,7 @@ cursor: help
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4769,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
@@ -4851,6 +4931,7 @@ cursor: progress
direction: ltr
display: table
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -4892,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
@@ -4974,6 +5056,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
@@ -5015,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
@@ -5090,6 +5174,7 @@ cursor: auto
direction: ltr
display: none
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5131,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
@@ -5206,6 +5292,7 @@ cursor: auto
direction: ltr
display: none
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5247,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
@@ -5322,6 +5410,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5363,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
@@ -5435,6 +5525,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5476,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
@@ -5549,6 +5641,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5590,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
@@ -5663,6 +5757,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5704,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
@@ -5777,6 +5873,7 @@ cursor: auto
direction: ltr
display: block
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5818,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
@@ -5887,6 +5985,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -5928,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
@@ -5998,6 +6098,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6039,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
@@ -6108,6 +6210,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6149,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
@@ -6218,6 +6322,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6259,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
@@ -6328,6 +6434,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6369,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
@@ -6438,6 +6546,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6479,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
@@ -6548,6 +6658,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6589,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
@@ -6660,6 +6772,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6701,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
@@ -6770,6 +6884,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6811,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
@@ -6880,6 +6996,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -6921,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
@@ -6991,6 +7109,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -7032,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
@@ -7101,6 +7221,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 10px
flex-direction: row
flex-grow: 2.000
@@ -7142,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
@@ -7211,6 +7333,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 1.000
@@ -7252,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
@@ -7321,6 +7445,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -7362,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
@@ -7431,6 +7557,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 0.000
@@ -7472,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
@@ -7541,6 +7669,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 0.000
@@ -7582,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
@@ -7651,6 +7781,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 0.000
@@ -7692,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
@@ -7761,6 +7893,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 3.000
@@ -7802,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
@@ -7870,6 +8004,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3px
flex-direction: row
flex-grow: 0.000
@@ -7911,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
@@ -7979,6 +8115,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3em
flex-direction: row
flex-grow: 2.000
@@ -8020,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
@@ -8088,6 +8226,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 20.000
@@ -8129,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
@@ -8199,6 +8339,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 3.000
@@ -8240,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
@@ -8310,6 +8452,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3px
flex-direction: row
flex-grow: 3.000
@@ -8351,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
@@ -8419,6 +8563,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 0px
flex-direction: row
flex-grow: 0.000
@@ -8460,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
@@ -8530,6 +8676,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -8571,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
@@ -8641,6 +8789,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3%
flex-direction: row
flex-grow: 3.000
@@ -8682,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
@@ -8752,6 +8902,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: 3%
flex-direction: row
flex-grow: 3.000
@@ -8793,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
@@ -8861,6 +9013,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -8902,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
@@ -8970,6 +9124,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -9011,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
@@ -9079,6 +9235,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -9120,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
@@ -9188,6 +9346,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -9229,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
@@ -9297,6 +9457,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: column
flex-grow: 0.000
@@ -9338,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
@@ -9406,6 +9568,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
@@ -9447,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
@@ -9515,6 +9679,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
@@ -9556,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
@@ -9624,6 +9790,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
@@ -9665,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
@@ -9735,6 +9903,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: column
flex-grow: 0.000
@@ -9776,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
@@ -9846,6 +10016,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
@@ -9887,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
@@ -9955,6 +10127,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
@@ -9996,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
@@ -10064,6 +10238,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10105,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
@@ -10173,6 +10349,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10214,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
@@ -10282,6 +10460,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10323,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
@@ -10391,6 +10571,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10432,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
@@ -10500,6 +10682,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10541,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
@@ -10609,6 +10793,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10650,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
@@ -10720,6 +10906,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10761,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
@@ -10831,6 +11019,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10872,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
@@ -10940,6 +11130,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -10981,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
@@ -11049,6 +11241,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11090,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
@@ -11158,6 +11352,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11199,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
@@ -11269,6 +11465,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11310,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
@@ -11378,6 +11576,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
@@ -11419,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
@@ -11489,6 +11689,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
@@ -11530,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
@@ -11598,6 +11800,7 @@ cursor: auto
direction: ltr
display: flex
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11639,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
@@ -11707,6 +11911,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
@@ -11748,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
@@ -11816,6 +12022,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11857,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
@@ -11925,6 +12133,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -11966,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
@@ -12034,6 +12244,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12075,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
@@ -12143,6 +12355,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12184,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
@@ -12252,6 +12466,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12293,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
@@ -12361,6 +12577,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12402,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
@@ -12470,6 +12688,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12511,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
@@ -12579,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
@@ -12620,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
@@ -12688,6 +12910,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12729,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
@@ -12797,6 +13021,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12838,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
@@ -12906,6 +13132,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -12947,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
@@ -13015,6 +13243,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13056,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
@@ -13124,6 +13354,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13165,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
@@ -13233,6 +13465,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13274,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
@@ -13342,6 +13576,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13383,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
@@ -13451,6 +13687,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13492,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
@@ -13560,6 +13798,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13601,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
@@ -13669,6 +13909,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13710,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
@@ -13778,6 +14020,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13819,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
@@ -13887,6 +14131,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -13928,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
@@ -13996,6 +14242,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -14037,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
@@ -14124,6 +14372,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -14165,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
@@ -14233,6 +14483,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -14274,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
@@ -14342,6 +14594,7 @@ cursor: auto
direction: ltr
display: inline
empty-cells: show
+fill-opacity: 1.000
flex-basis: auto
flex-direction: row
flex-grow: 0.000
@@ -14383,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/data/select2/INDEX b/test/data/select2/INDEX
new file mode 100644
index 0000000..fbd834d
--- /dev/null
+++ b/test/data/select2/INDEX
@@ -0,0 +1,5 @@
+# Index file for automated parser tests
+#
+# Test Description
+
+calc.dat Tests involving calc
diff --git a/test/data/select2/calc.dat b/test/data/select2/calc.dat
new file mode 100644
index 0000000..b3a5ef5
--- /dev/null
+++ b/test/data/select2/calc.dat
@@ -0,0 +1,223 @@
+#tree
+| div*
+#ua
+div { width: calc(10% + 16px); }
+#user
+div { width: 10px; }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: 10 pixels
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
+
+#tree
+| div*
+#ua
+div { width: calc(10% + 16px); }
+#errors
+#expected
+align-content: stretch
+align-items: stretch
+align-self: auto
+background-attachment: scroll
+background-color: #00000000
+background-image: none
+background-position: 0% 0%
+background-repeat: repeat
+border-collapse: separate
+border-spacing: 0px 0px
+border-top-color: #ff000000
+border-right-color: #ff000000
+border-bottom-color: #ff000000
+border-left-color: #ff000000
+border-top-style: none
+border-right-style: none
+border-bottom-style: none
+border-left-style: none
+border-top-width: 2px
+border-right-width: 2px
+border-bottom-width: 2px
+border-left-width: 2px
+bottom: auto
+box-sizing: content-box
+break-after: auto
+break-before: auto
+break-inside: auto
+caption-side: top
+clear: none
+clip: auto
+color: #ff000000
+column-count: auto
+column-fill: balance
+column-gap: normal
+column-rule-color: #ff000000
+column-rule-style: none
+column-rule-width: 2px
+column-span: none
+column-width: auto
+content: normal
+counter-increment: none
+counter-reset: none
+cursor: auto
+direction: ltr
+display: inline
+empty-cells: show
+fill-opacity: 1.000
+flex-basis: auto
+flex-direction: row
+flex-grow: 0.000
+flex-shrink: 1.000
+flex-wrap: nowrap
+float: none
+font-family: sans-serif
+font-size: 16px
+font-style: normal
+font-variant: normal
+font-weight: normal
+height: auto
+justify-content: flex-start
+left: auto
+letter-spacing: normal
+line-height: normal
+list-style-image: none
+list-style-position: outside
+list-style-type: disc
+margin-top: 0px
+margin-right: 0px
+margin-bottom: 0px
+margin-left: 0px
+max-height: none
+max-width: none
+min-height: 0px
+min-width: 0px
+opacity: 1.000
+order: 0
+outline-color: invert
+outline-style: none
+outline-width: 2px
+overflow-x: visible
+overflow-y: visible
+padding-top: 0px
+padding-right: 0px
+padding-bottom: 0px
+padding-left: 0px
+position: static
+quotes: none
+right: auto
+stroke-opacity: 1.000
+table-layout: auto
+text-align: default
+text-decoration: none
+text-indent: 0px
+text-transform: none
+top: auto
+unicode-bidi: normal
+vertical-align: baseline
+visibility: visible
+white-space: normal
+width: 118 pixels
+word-spacing: normal
+writing-mode: horizontal-tb
+z-index: auto
+#reset
diff --git a/test/dump.h b/test/dump.h
index f585788..3d7038a 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -131,7 +131,7 @@ void dump_rule_media(css_rule_media *s, char **buf, size_t *buflen)
char *ptr = *buf;
css_rule *rule;
- ptr += sprintf(ptr, "| @media %s%03lx",
+ ptr += sprintf(ptr, "| @media %s%03" PRIx64,
s->media->negate_type ? "not " : "",
s->media->type);
@@ -491,6 +491,8 @@ static const char *opcode_names[] = {
"flex-wrap",
"justify-content",
"order",
+ "fill-opacity",
+ "stroke-opacity",
};
static void dump_css_fixed(css_fixed f, char **ptr)
@@ -640,6 +642,12 @@ static void dump_unit(css_fixed val, uint32_t unit, char **ptr)
case UNIT_KHZ:
*ptr += sprintf(*ptr, "kHz");
break;
+ case UNIT_CALC_ANY:
+ *ptr += sprintf(*ptr, "any");
+ break;
+ case UNIT_CALC_NUMBER:
+ *ptr += sprintf(*ptr, "number");
+ break;
}
}
@@ -796,6 +804,59 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
*ptr += sprintf(*ptr, "revert");
} else if (getFlagValue(opv) == FLAG_VALUE_UNSET) {
*ptr += sprintf(*ptr, "unset");
+ } else if (isCalc(opv)) {
+ lwc_string *calc_expr = NULL;
+ const uint8_t *codeptr = NULL;
+ css_code_t calc_opcode;
+ uint32_t unit, snum;
+ /* First entry is a unit */
+ unit = *((uint32_t *)bytecode);
+ ADVANCE(sizeof(unit));
+ /* Second entry is an lwc_string of the expression */
+ snum = *((uint32_t *)bytecode);
+ ADVANCE(sizeof(snum));
+ css__stylesheet_string_get(style->sheet, snum, &calc_expr);
+ codeptr = (const uint8_t *)lwc_string_data(calc_expr);
+ *ptr += sprintf(*ptr, "/* -> ");
+ dump_unit(0, unit, ptr);
+ *ptr += sprintf(*ptr, " */ calc(");
+ while ((calc_opcode = *((css_code_t *)(void *)codeptr)) != CALC_FINISH) {
+ codeptr += sizeof(calc_opcode);
+ switch (calc_opcode) {
+ case CALC_ADD:
+ *ptr += sprintf(*ptr, "+ ");
+ break;
+ case CALC_SUBTRACT:
+ *ptr += sprintf(*ptr, "- ");
+ break;
+ case CALC_MULTIPLY:
+ *ptr += sprintf(*ptr, "* ");
+ break;
+ case CALC_DIVIDE:
+ *ptr += sprintf(*ptr, "/ ");
+ break;
+ case CALC_PUSH_VALUE: {
+ css_fixed num = *((css_fixed *)(void *)codeptr);
+ codeptr += sizeof(num);
+ uint32_t unit = *((uint32_t *)(void *)codeptr);
+ codeptr += sizeof(unit);
+ dump_unit(num, unit, ptr);
+ *ptr += sprintf(*ptr, " ");
+ break;
+ }
+ case CALC_PUSH_NUMBER: {
+ css_fixed num = *((css_fixed *)(void *)codeptr);
+ codeptr += sizeof(num);
+ dump_number(num, ptr);
+ *ptr += sprintf(*ptr, " ");
+ break;
+ }
+ default:
+ *ptr += sprintf(*ptr, "??%d ", calc_opcode);
+ break;
+ }
+ }
+ *ptr += sprintf(*ptr, "=)");
} else {
value = getValue(opv);
@@ -1819,6 +1880,28 @@ 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_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 2ce7849..d9d5923 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -159,6 +159,9 @@ static size_t dump_css_unit(css_fixed val, css_unit unit, char *ptr, size_t len)
case CSS_UNIT_KHZ:
ret += snprintf(ptr + ret, len - ret, "kHz");
break;
+ case CSS_UNIT_CALC:
+ ret += snprintf(ptr + ret, len - ret, "calc()");
+ break;
}
return ret;
@@ -166,7 +169,7 @@ static size_t dump_css_unit(css_fixed val, css_unit unit, char *ptr, size_t len)
static void dump_computed_style(const css_computed_style *style, char *buf,
- size_t *len)
+ size_t *len, css_unit_ctx *unit_ctx)
{
char *ptr = buf;
size_t wrote = 0;
@@ -182,6 +185,11 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
const css_computed_counter *counter = NULL;
lwc_string **string_list = NULL;
int32_t integer = 0;
+#ifdef USE_DEVICE
+ int pixels = 0;
+#endif
+
+ (void)unit_ctx; /* Avoid unused argument warnings in select.c case */
/* align-content */
val = css_computed_align_content(style);
@@ -1635,6 +1643,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) {
@@ -2796,6 +2828,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) {
@@ -3090,7 +3146,11 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
*len -= wrote;
/* width */
+#ifdef USE_DEVICE
+ val = css_computed_width_px(style, unit_ctx, 1024, &pixels);
+#else
val = css_computed_width(style, &len1, &unit1);
+#endif
switch (val) {
case CSS_WIDTH_INHERIT:
wrote = snprintf(ptr, *len, "width: inherit\n");
@@ -3103,9 +3163,19 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
ptr += wrote;
*len -= wrote;
+#ifdef USE_DEVICE
+ wrote = dump_css_number(INTTOFIX(pixels), ptr, *len);
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = snprintf(ptr, *len, " pixels");
+ ptr += wrote;
+ *len -= wrote;
+#else
wrote = dump_css_unit(len1, unit1, ptr, *len);
ptr += wrote;
*len -= wrote;
+#endif
wrote = snprintf(ptr, *len, "\n");
break;
diff --git a/test/select.c b/test/select.c
index 5bc7856..4bab187 100644
--- a/test/select.c
+++ b/test/select.c
@@ -808,6 +808,7 @@ static css_error get_libcss_node_data(void *pw, void *n,
static css_unit_ctx unit_ctx = {
.font_size_default = 16 * (1 << CSS_RADIX_POINT),
+ .device_dpi = 96 * (1 << CSS_RADIX_POINT),
};
static css_select_handler select_handler = {
@@ -1306,7 +1307,7 @@ static void run_test_select_tree(css_select_ctx *select,
if (node == ctx->target) {
dump_computed_style(sr->styles[ctx->pseudo_element],
- buf, buflen);
+ buf, buflen, &unit_ctx);
}
if (node->parent == NULL) {
diff --git a/test/select2.c b/test/select2.c
new file mode 100644
index 0000000..bd9762b
--- /dev/null
+++ b/test/select2.c
@@ -0,0 +1,4 @@
+/* This is a slightly modification of the select.c behaviour */
+
+#define USE_DEVICE
+#include "select.c"