diff options
author | Lucas Neves <lcneves@gmail.com> | 2017-11-12 11:49:41 -0500 |
---|---|---|
committer | Lucas Neves <lcneves@gmail.com> | 2017-11-12 11:49:41 -0500 |
commit | 07cb2ea8b9d5259d90d13c7da34cba54056c38d0 (patch) | |
tree | 59267f20b4c972a9edc8fa569d909156dbae1c2b | |
parent | 082f3d077293f813567ac6c9a4b2a00337933238 (diff) | |
download | libcss-07cb2ea8b9d5259d90d13c7da34cba54056c38d0.tar.gz |
Select: autogen for selection properties.
-rw-r--r-- | src/select/__pycache__/overrides.cpython-36.pyc | bin | 4579 -> 5301 bytes | |||
-rw-r--r-- | src/select/__pycache__/select_config.cpython-36.pyc | bin | 6681 -> 6738 bytes | |||
-rw-r--r-- | src/select/autogenerated_computed.h | 92 | ||||
-rw-r--r-- | src/select/autogenerated_propget.h | 580 | ||||
-rw-r--r-- | src/select/autogenerated_propset.h | 893 | ||||
-rw-r--r-- | src/select/overrides.py | 33 | ||||
-rw-r--r-- | src/select/select_config.py | 17 | ||||
-rw-r--r-- | src/select/select_generator.py | 23 |
8 files changed, 995 insertions, 643 deletions
diff --git a/src/select/__pycache__/overrides.cpython-36.pyc b/src/select/__pycache__/overrides.cpython-36.pyc Binary files differindex ff0dffb..d14dace 100644 --- a/src/select/__pycache__/overrides.cpython-36.pyc +++ b/src/select/__pycache__/overrides.cpython-36.pyc diff --git a/src/select/__pycache__/select_config.cpython-36.pyc b/src/select/__pycache__/select_config.cpython-36.pyc Binary files differindex 8ecd301..d498b36 100644 --- a/src/select/__pycache__/select_config.cpython-36.pyc +++ b/src/select/__pycache__/select_config.cpython-36.pyc diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h index 09a0c19..aeb6eca 100644 --- a/src/select/autogenerated_computed.h +++ b/src/select/autogenerated_computed.h @@ -55,18 +55,18 @@ struct css_computed_uncommon_i { * * Bit allocations: * - * 0 bbbbbbbbbbbooooooooccccccccuuuuu - * border_spacing; outline_width; column_rule_width; cursor + * 0 bbbbbbbbbbbccccccccoooooooouuuuu + * border_spacing; column_rule_width; outline_width; cursor * - * 1 ccccccclllllllooooooowwwwwwwbbbb - * column_width; letter_spacing; column_gap; word_spacing; break_after + * 1 cccccccwwwwwwwlllllllooooooobbbb + * column_gap; word_spacing; letter_spacing; column_width; break_inside * - * 2 ccccccccccccccccccccccccccoooonn - * clip; column_rule_style; content + * 2 ccccccccccccccccccccccccccoooouu + * clip; column_rule_style; outline_color * - * 3 bbbbrrrrccoouuwwllmmnt.......... - * break_inside; break_before; column_count; column_rule_color; outline_color; - * writing_mode; column_fill; column_span; counter_reset; counter_increment + * 3 bbbbrrrrccoowwlluunnte.......... + * break_after; break_before; column_count; column_fill; writing_mode; + * column_rule_color; column_span; content; counter_reset; counter_increment */ uint32_t bits[4]; @@ -118,8 +118,8 @@ typedef struct css_computed_page { * * Bit allocations: * - * 0 pppaaaggwo...................... - * page_break_before; page_break_after; page_break_inside; widows; orphans + * 0 pppaaaggow...................... + * page_break_after; page_break_before; page_break_inside; orphans; widows */ uint32_t bits[1]; @@ -188,7 +188,8 @@ struct css_computed_style_i { * opacity 1 4 * order 1 4 * outline_style 4 - * overflow 3 + * overflow_x 3 + * overflow_y 3 * padding_bottom 1 + 5 4 * padding_left 1 + 5 4 * padding_right 1 + 5 4 @@ -218,52 +219,51 @@ struct css_computed_style_i { * quotes 1 sizeof(ptr) * * --- --- --- - * 329 bits 160 + 4sizeof(ptr) bytes + * 332 bits 160 + 4sizeof(ptr) bytes * =================== * 202 + 4sizeof(ptr) bytes * * Bit allocations: * * 0 bbbbbbbboooooooorrrrrrrrdddddddd - * border_top_width; border_left_width; border_right_width; border_bottom_width + * border_right_width; border_bottom_width; border_top_width; border_left_width * - * 1 tttttttbbbbbbbmmmmmmmfffffffoooo - * top; bottom; max_height; flex_basis; outline_style + * 1 hhhhhhhmmmmmmmiiiiiiiaaaaaaabbbb + * height; margin_right; min_height; max_width; border_top_style * - * 2 mmmmmmmwwwwwwwaaaaaaalllllllbbbb - * margin_bottom; width; margin_right; line_height; border_right_style + * 2 mmmmmmmaaaaaaaiiiiiiifffffffbbbb + * margin_left; margin_bottom; min_width; flex_basis; border_bottom_style * - * 3 lllllllhhhhhhhmmmmmmmiiiiiiibbbb - * left; height; margin_left; min_height; border_bottom_style + * 3 lllllllwwwwwwwmmmmmmmtttttttoooo + * line_height; width; max_height; top; outline_style * - * 4 mmmmmmmaaaaaaarrrrrrriiiiiiibbbb - * max_width; margin_top; right; min_width; border_top_style + * 4 lllllllbbbbbbbrrrrrrrmmmmmmmoooo + * left; bottom; right; margin_top; border_left_style * * 5 bbbbbbbbbbbfffffffffvvvvvvvvvaaa - * background_position; font_size; vertical_align; background_repeat - * - * 6 dddddtttttffffbbbbeeeellllcccxxx - * display; text_decoration; font_weight; border_left_style; text_align; - * list_style_type; clear; text_transform - * - * 7 ppppppttttttaaaaaaddddddiiiiiibb - * padding_top; text_indent; padding_left; padding_bottom; padding_right; - * border_left_color - * - * 8 bbaaccoorrffddllzzkkeemmuuppnntt - * box_sizing; background_color; caption_side; border_bottom_color; - * border_top_color; float; direction; flex_wrap; z_index; - * background_attachment; border_right_color; empty_cells; unicode_bidi; - * border_collapse; font_style; table_layout - * - * 9 fffjjjaaaooolllvvvpppiiiwwwssnne - * flex_direction; justify_content; align_self; font_family; align_items; - * overflow; position; align_content; white_space; visibility; font_variant; - * flex_grow - * - * 10 llfcqbior....................... - * list_style_position; flex_shrink; color; quotes; background_image; - * list_style_image; opacity; order + * background_position; font_size; vertical_align; align_items + * + * 6 dddddtttttbbbbeeeellllffffooowww + * display; text_decoration; border_right_style; text_align; list_style_type; + * font_weight; overflow_y; white_space + * + * 7 ppppppaaaaaaddddddiiiiiittttttff + * padding_top; padding_right; padding_bottom; padding_left; text_indent; + * font_style + * + * 8 aaafffbbbtttpppllljjjccceeeoooii + * align_content; font_family; background_repeat; text_transform; position; + * align_self; justify_content; clear; flex_direction; overflow_x; caption_side + * + * 9 ffbboozzaarrttvveeccnndduummiixx + * float; border_top_color; border_collapse; z_index; background_color; + * border_right_color; table_layout; visibility; empty_cells; + * background_attachment; font_variant; border_left_color; unicode_bidi; + * border_bottom_color; direction; box_sizing + * + * 10 ffllorexqcbi.................... + * flex_wrap; list_style_position; opacity; order; flex_grow; flex_shrink; + * quotes; color; background_image; list_style_image */ uint32_t bits[11]; diff --git a/src/select/autogenerated_propget.h b/src/select/autogenerated_propget.h index 6148a23..0aa25b8 100644 --- a/src/select/autogenerated_propget.h +++ b/src/select/autogenerated_propget.h @@ -29,15 +29,19 @@ static inline uint8_t get_border_spacing(const css_computed_style *style, } /* Initial value */ + *length_a = 0; + *unit_a = CSS_UNIT_PX; + *length_b = 0; + *unit_b = CSS_UNIT_PX; return CSS_BORDER_SPACING_SET; } #undef BORDER_SPACING_INDEX #undef BORDER_SPACING_SHIFT #undef BORDER_SPACING_MASK -#define BREAK_AFTER_INDEX 1 -#define BREAK_AFTER_SHIFT 0 -#define BREAK_AFTER_MASK 0xf +#define BREAK_AFTER_INDEX 3 +#define BREAK_AFTER_SHIFT 28 +#define BREAK_AFTER_MASK 0xf0000000 static inline uint8_t get_break_after(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -79,9 +83,9 @@ static inline uint8_t get_break_before(const css_computed_style *style) #undef BREAK_BEFORE_SHIFT #undef BREAK_BEFORE_MASK -#define BREAK_INSIDE_INDEX 3 -#define BREAK_INSIDE_SHIFT 28 -#define BREAK_INSIDE_MASK 0xf0000000 +#define BREAK_INSIDE_INDEX 1 +#define BREAK_INSIDE_SHIFT 0 +#define BREAK_INSIDE_MASK 0xf static inline uint8_t get_break_inside(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -166,6 +170,7 @@ static inline uint8_t get_column_count(const css_computed_style *style, int32_t } /* Initial value */ + *integer = 0; return CSS_COLUMN_COUNT_AUTO; } #undef COLUMN_COUNT_INDEX @@ -173,8 +178,8 @@ static inline uint8_t get_column_count(const css_computed_style *style, int32_t #undef COLUMN_COUNT_MASK #define COLUMN_FILL_INDEX 3 -#define COLUMN_FILL_SHIFT 14 -#define COLUMN_FILL_MASK 0xc000 +#define COLUMN_FILL_SHIFT 20 +#define COLUMN_FILL_MASK 0x300000 static inline uint8_t get_column_fill(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -195,8 +200,8 @@ static inline uint8_t get_column_fill(const css_computed_style *style) #undef COLUMN_FILL_MASK #define COLUMN_GAP_INDEX 1 -#define COLUMN_GAP_SHIFT 11 -#define COLUMN_GAP_MASK 0x3f800 +#define COLUMN_GAP_SHIFT 25 +#define COLUMN_GAP_MASK 0xfe000000 static inline uint8_t get_column_gap(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -215,6 +220,8 @@ static inline uint8_t get_column_gap(const css_computed_style *style, css_fixed } /* Initial value */ + *length = 0; + *unit = CSS_UNIT_PX; return CSS_COLUMN_GAP_NORMAL; } #undef COLUMN_GAP_INDEX @@ -222,8 +229,8 @@ static inline uint8_t get_column_gap(const css_computed_style *style, css_fixed #undef COLUMN_GAP_MASK #define COLUMN_RULE_COLOR_INDEX 3 -#define COLUMN_RULE_COLOR_SHIFT 20 -#define COLUMN_RULE_COLOR_MASK 0x300000 +#define COLUMN_RULE_COLOR_SHIFT 16 +#define COLUMN_RULE_COLOR_MASK 0x30000 static inline uint8_t get_column_rule_color(const css_computed_style *style, css_color *color) { @@ -240,6 +247,7 @@ static inline uint8_t get_column_rule_color(const css_computed_style *style, } /* Initial value */ + *color = 0; return CSS_COLUMN_RULE_COLOR_CURRENT_COLOR; } #undef COLUMN_RULE_COLOR_INDEX @@ -270,8 +278,8 @@ static inline uint8_t get_column_rule_style(const css_computed_style *style) #undef COLUMN_RULE_STYLE_MASK #define COLUMN_RULE_WIDTH_INDEX 0 -#define COLUMN_RULE_WIDTH_SHIFT 5 -#define COLUMN_RULE_WIDTH_MASK 0x1fe0 +#define COLUMN_RULE_WIDTH_SHIFT 13 +#define COLUMN_RULE_WIDTH_MASK 0x1fe000 static inline uint8_t get_column_rule_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -291,6 +299,8 @@ static inline uint8_t get_column_rule_width(const css_computed_style *style, } /* Initial value */ + *length = 0; + *unit = CSS_UNIT_PX; return CSS_COLUMN_RULE_WIDTH_MEDIUM; } #undef COLUMN_RULE_WIDTH_INDEX @@ -298,8 +308,8 @@ static inline uint8_t get_column_rule_width(const css_computed_style *style, #undef COLUMN_RULE_WIDTH_MASK #define COLUMN_SPAN_INDEX 3 -#define COLUMN_SPAN_SHIFT 12 -#define COLUMN_SPAN_MASK 0x3000 +#define COLUMN_SPAN_SHIFT 14 +#define COLUMN_SPAN_MASK 0xc000 static inline uint8_t get_column_span(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -320,8 +330,8 @@ static inline uint8_t get_column_span(const css_computed_style *style) #undef COLUMN_SPAN_MASK #define COLUMN_WIDTH_INDEX 1 -#define COLUMN_WIDTH_SHIFT 25 -#define COLUMN_WIDTH_MASK 0xfe000000 +#define COLUMN_WIDTH_SHIFT 4 +#define COLUMN_WIDTH_MASK 0x7f0 static inline uint8_t get_column_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -340,15 +350,17 @@ static inline uint8_t get_column_width(const css_computed_style *style, } /* Initial value */ + *length = 0; + *unit = CSS_UNIT_PX; return CSS_COLUMN_WIDTH_AUTO; } #undef COLUMN_WIDTH_INDEX #undef COLUMN_WIDTH_SHIFT #undef COLUMN_WIDTH_MASK -#define CONTENT_INDEX 2 -#define CONTENT_SHIFT 0 -#define CONTENT_MASK 0x3 +#define CONTENT_INDEX 3 +#define CONTENT_SHIFT 12 +#define CONTENT_MASK 0x3000 static inline uint8_t get_content(const css_computed_style *style, const css_computed_content_item **content_item) { @@ -366,6 +378,7 @@ static inline uint8_t get_content(const css_computed_style *style, const } /* Initial value */ + *content_item = NULL; return CSS_CONTENT_NORMAL; } #undef CONTENT_INDEX @@ -391,6 +404,7 @@ static inline uint8_t get_counter_increment(const css_computed_style *style, } /* Initial value */ + *counter_arr = NULL; return CSS_COUNTER_INCREMENT_NONE; } #undef COUNTER_INCREMENT_INDEX @@ -415,6 +429,7 @@ static inline uint8_t get_counter_reset(const css_computed_style *style, const } /* Initial value */ + *counter_arr = NULL; return CSS_COUNTER_RESET_NONE; } #undef COUNTER_RESET_INDEX @@ -433,23 +448,22 @@ static inline uint8_t get_cursor(const css_computed_style *style, lwc_string bits >>= CURSOR_SHIFT; /* 5bits: ttttt : type */ - if ((bits & 0x1f) == CSS_CURSOR_AUTO) { - *string_arr = style->i.uncommon->cursor; - } + *string_arr = style->i.uncommon->cursor; return (bits & 0x1f); } /* Initial value */ - return CSS_CURSOR_INHERIT; + *string_arr = NULL; + return CSS_CURSOR_AUTO; } #undef CURSOR_INDEX #undef CURSOR_SHIFT #undef CURSOR_MASK #define LETTER_SPACING_INDEX 1 -#define LETTER_SPACING_SHIFT 18 -#define LETTER_SPACING_MASK 0x1fc0000 +#define LETTER_SPACING_SHIFT 11 +#define LETTER_SPACING_MASK 0x3f800 static inline uint8_t get_letter_spacing(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -468,15 +482,17 @@ static inline uint8_t get_letter_spacing(const css_computed_style *style, } /* Initial value */ + *length = 0; + *unit = CSS_UNIT_PX; return CSS_LETTER_SPACING_NORMAL; } #undef LETTER_SPACING_INDEX #undef LETTER_SPACING_SHIFT #undef LETTER_SPACING_MASK -#define OUTLINE_COLOR_INDEX 3 -#define OUTLINE_COLOR_SHIFT 18 -#define OUTLINE_COLOR_MASK 0xc0000 +#define OUTLINE_COLOR_INDEX 2 +#define OUTLINE_COLOR_SHIFT 0 +#define OUTLINE_COLOR_MASK 0x3 static inline uint8_t get_outline_color(const css_computed_style *style, css_color *color) { @@ -494,6 +510,7 @@ static inline uint8_t get_outline_color(const css_computed_style *style, } /* Initial value */ + *color = 0; return CSS_OUTLINE_COLOR_INVERT; } #undef OUTLINE_COLOR_INDEX @@ -501,8 +518,8 @@ static inline uint8_t get_outline_color(const css_computed_style *style, #undef OUTLINE_COLOR_MASK #define OUTLINE_WIDTH_INDEX 0 -#define OUTLINE_WIDTH_SHIFT 13 -#define OUTLINE_WIDTH_MASK 0x1fe000 +#define OUTLINE_WIDTH_SHIFT 5 +#define OUTLINE_WIDTH_MASK 0x1fe0 static inline uint8_t get_outline_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -521,6 +538,8 @@ static inline uint8_t get_outline_width(const css_computed_style *style, } /* Initial value */ + *length = 0; + *unit = CSS_UNIT_PX; return CSS_OUTLINE_WIDTH_MEDIUM; } #undef OUTLINE_WIDTH_INDEX @@ -528,8 +547,8 @@ static inline uint8_t get_outline_width(const css_computed_style *style, #undef OUTLINE_WIDTH_MASK #define WORD_SPACING_INDEX 1 -#define WORD_SPACING_SHIFT 4 -#define WORD_SPACING_MASK 0x7f0 +#define WORD_SPACING_SHIFT 18 +#define WORD_SPACING_MASK 0x1fc0000 static inline uint8_t get_word_spacing(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -548,6 +567,8 @@ static inline uint8_t get_word_spacing(const css_computed_style *style, } /* Initial value */ + *length = 0; + *unit = CSS_UNIT_PX; return CSS_WORD_SPACING_NORMAL; } #undef WORD_SPACING_INDEX @@ -555,8 +576,8 @@ static inline uint8_t get_word_spacing(const css_computed_style *style, #undef WORD_SPACING_MASK #define WRITING_MODE_INDEX 3 -#define WRITING_MODE_SHIFT 16 -#define WRITING_MODE_MASK 0x30000 +#define WRITING_MODE_SHIFT 18 +#define WRITING_MODE_MASK 0xc0000 static inline uint8_t get_writing_mode(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -577,8 +598,8 @@ static inline uint8_t get_writing_mode(const css_computed_style *style) #undef WRITING_MODE_MASK #define ORPHANS_INDEX 0 -#define ORPHANS_SHIFT 22 -#define ORPHANS_MASK 0x400000 +#define ORPHANS_SHIFT 23 +#define ORPHANS_MASK 0x800000 static inline uint8_t get_orphans(const css_computed_style *style, int32_t *integer) { @@ -594,6 +615,7 @@ static inline uint8_t get_orphans(const css_computed_style *style, int32_t } /* Initial value */ + *integer = 2 << CSS_RADIX_POINT; return CSS_ORPHANS_SET; } #undef ORPHANS_INDEX @@ -601,8 +623,8 @@ static inline uint8_t get_orphans(const css_computed_style *style, int32_t #undef ORPHANS_MASK #define PAGE_BREAK_AFTER_INDEX 0 -#define PAGE_BREAK_AFTER_SHIFT 26 -#define PAGE_BREAK_AFTER_MASK 0x1c000000 +#define PAGE_BREAK_AFTER_SHIFT 29 +#define PAGE_BREAK_AFTER_MASK 0xe0000000 static inline uint8_t get_page_break_after(const css_computed_style *style) { if (style->page != NULL) { @@ -623,8 +645,8 @@ static inline uint8_t get_page_break_after(const css_computed_style *style) #undef PAGE_BREAK_AFTER_MASK #define PAGE_BREAK_BEFORE_INDEX 0 -#define PAGE_BREAK_BEFORE_SHIFT 29 -#define PAGE_BREAK_BEFORE_MASK 0xe0000000 +#define PAGE_BREAK_BEFORE_SHIFT 26 +#define PAGE_BREAK_BEFORE_MASK 0x1c000000 static inline uint8_t get_page_break_before(const css_computed_style *style) { if (style->page != NULL) { @@ -667,8 +689,8 @@ static inline uint8_t get_page_break_inside(const css_computed_style *style) #undef PAGE_BREAK_INSIDE_MASK #define WIDOWS_INDEX 0 -#define WIDOWS_SHIFT 23 -#define WIDOWS_MASK 0x800000 +#define WIDOWS_SHIFT 22 +#define WIDOWS_MASK 0x400000 static inline uint8_t get_widows(const css_computed_style *style, int32_t *integer) { @@ -684,15 +706,16 @@ static inline uint8_t get_widows(const css_computed_style *style, int32_t } /* Initial value */ + *integer = 2 << CSS_RADIX_POINT; return CSS_WIDOWS_SET; } #undef WIDOWS_INDEX #undef WIDOWS_SHIFT #undef WIDOWS_MASK -#define ALIGN_CONTENT_INDEX 9 -#define ALIGN_CONTENT_SHIFT 8 -#define ALIGN_CONTENT_MASK 0x700 +#define ALIGN_CONTENT_INDEX 8 +#define ALIGN_CONTENT_SHIFT 29 +#define ALIGN_CONTENT_MASK 0xe0000000 static inline uint8_t get_align_content(const css_computed_style *style) { uint32_t bits = style->i.bits[ALIGN_CONTENT_INDEX]; @@ -707,9 +730,9 @@ static inline uint8_t get_align_content(const css_computed_style *style) #undef ALIGN_CONTENT_SHIFT #undef ALIGN_CONTENT_MASK -#define ALIGN_ITEMS_INDEX 9 -#define ALIGN_ITEMS_SHIFT 17 -#define ALIGN_ITEMS_MASK 0xe0000 +#define ALIGN_ITEMS_INDEX 5 +#define ALIGN_ITEMS_SHIFT 0 +#define ALIGN_ITEMS_MASK 0x7 static inline uint8_t get_align_items(const css_computed_style *style) { uint32_t bits = style->i.bits[ALIGN_ITEMS_INDEX]; @@ -724,9 +747,9 @@ static inline uint8_t get_align_items(const css_computed_style *style) #undef ALIGN_ITEMS_SHIFT #undef ALIGN_ITEMS_MASK -#define ALIGN_SELF_INDEX 9 -#define ALIGN_SELF_SHIFT 23 -#define ALIGN_SELF_MASK 0x3800000 +#define ALIGN_SELF_INDEX 8 +#define ALIGN_SELF_SHIFT 14 +#define ALIGN_SELF_MASK 0x1c000 static inline uint8_t get_align_self(const css_computed_style *style) { uint32_t bits = style->i.bits[ALIGN_SELF_INDEX]; @@ -741,7 +764,7 @@ static inline uint8_t get_align_self(const css_computed_style *style) #undef ALIGN_SELF_SHIFT #undef ALIGN_SELF_MASK -#define BACKGROUND_ATTACHMENT_INDEX 8 +#define BACKGROUND_ATTACHMENT_INDEX 9 #define BACKGROUND_ATTACHMENT_SHIFT 12 #define BACKGROUND_ATTACHMENT_MASK 0x3000 static inline uint8_t get_background_attachment(const css_computed_style *style) @@ -758,9 +781,9 @@ static inline uint8_t get_background_attachment(const css_computed_style *style) #undef BACKGROUND_ATTACHMENT_SHIFT #undef BACKGROUND_ATTACHMENT_MASK -#define BACKGROUND_COLOR_INDEX 8 -#define BACKGROUND_COLOR_SHIFT 28 -#define BACKGROUND_COLOR_MASK 0x30000000 +#define BACKGROUND_COLOR_INDEX 9 +#define BACKGROUND_COLOR_SHIFT 22 +#define BACKGROUND_COLOR_MASK 0xc00000 static inline uint8_t get_background_color(const css_computed_style *style, css_color *color) { @@ -778,8 +801,8 @@ static inline uint8_t get_background_color(const css_computed_style *style, #undef BACKGROUND_COLOR_MASK #define BACKGROUND_IMAGE_INDEX 10 -#define BACKGROUND_IMAGE_SHIFT 26 -#define BACKGROUND_IMAGE_MASK 0x4000000 +#define BACKGROUND_IMAGE_SHIFT 21 +#define BACKGROUND_IMAGE_MASK 0x200000 static inline uint8_t get_background_image(const css_computed_style *style, lwc_string **string) { @@ -821,9 +844,9 @@ static inline uint8_t get_background_position(const css_computed_style *style, #undef BACKGROUND_POSITION_SHIFT #undef BACKGROUND_POSITION_MASK -#define BACKGROUND_REPEAT_INDEX 5 -#define BACKGROUND_REPEAT_SHIFT 0 -#define BACKGROUND_REPEAT_MASK 0x7 +#define BACKGROUND_REPEAT_INDEX 8 +#define BACKGROUND_REPEAT_SHIFT 23 +#define BACKGROUND_REPEAT_MASK 0x3800000 static inline uint8_t get_background_repeat(const css_computed_style *style) { uint32_t bits = style->i.bits[BACKGROUND_REPEAT_INDEX]; @@ -838,9 +861,9 @@ static inline uint8_t get_background_repeat(const css_computed_style *style) #undef BACKGROUND_REPEAT_SHIFT #undef BACKGROUND_REPEAT_MASK -#define BORDER_BOTTOM_COLOR_INDEX 8 -#define BORDER_BOTTOM_COLOR_SHIFT 24 -#define BORDER_BOTTOM_COLOR_MASK 0x3000000 +#define BORDER_BOTTOM_COLOR_INDEX 9 +#define BORDER_BOTTOM_COLOR_SHIFT 4 +#define BORDER_BOTTOM_COLOR_MASK 0x30 static inline uint8_t get_border_bottom_color(const css_computed_style *style, css_color *color) { @@ -857,7 +880,7 @@ static inline uint8_t get_border_bottom_color(const css_computed_style *style, #undef BORDER_BOTTOM_COLOR_SHIFT #undef BORDER_BOTTOM_COLOR_MASK -#define BORDER_BOTTOM_STYLE_INDEX 3 +#define BORDER_BOTTOM_STYLE_INDEX 2 #define BORDER_BOTTOM_STYLE_SHIFT 0 #define BORDER_BOTTOM_STYLE_MASK 0xf static inline uint8_t get_border_bottom_style(const css_computed_style *style) @@ -875,8 +898,8 @@ static inline uint8_t get_border_bottom_style(const css_computed_style *style) #undef BORDER_BOTTOM_STYLE_MASK #define BORDER_BOTTOM_WIDTH_INDEX 0 -#define BORDER_BOTTOM_WIDTH_SHIFT 0 -#define BORDER_BOTTOM_WIDTH_MASK 0xff +#define BORDER_BOTTOM_WIDTH_SHIFT 16 +#define BORDER_BOTTOM_WIDTH_MASK 0xff0000 static inline uint8_t get_border_bottom_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -896,9 +919,9 @@ static inline uint8_t get_border_bottom_width(const css_computed_style *style, #undef BORDER_BOTTOM_WIDTH_SHIFT #undef BORDER_BOTTOM_WIDTH_MASK -#define BORDER_COLLAPSE_INDEX 8 -#define BORDER_COLLAPSE_SHIFT 4 -#define BORDER_COLLAPSE_MASK 0x30 +#define BORDER_COLLAPSE_INDEX 9 +#define BORDER_COLLAPSE_SHIFT 26 +#define BORDER_COLLAPSE_MASK 0xc000000 static inline uint8_t get_border_collapse(const css_computed_style *style) { uint32_t bits = style->i.bits[BORDER_COLLAPSE_INDEX]; @@ -913,9 +936,9 @@ static inline uint8_t get_border_collapse(const css_computed_style *style) #undef BORDER_COLLAPSE_SHIFT #undef BORDER_COLLAPSE_MASK -#define BORDER_LEFT_COLOR_INDEX 7 -#define BORDER_LEFT_COLOR_SHIFT 0 -#define BORDER_LEFT_COLOR_MASK 0x3 +#define BORDER_LEFT_COLOR_INDEX 9 +#define BORDER_LEFT_COLOR_SHIFT 8 +#define BORDER_LEFT_COLOR_MASK 0x300 static inline uint8_t get_border_left_color(const css_computed_style *style, css_color *color) { @@ -932,9 +955,9 @@ static inline uint8_t get_border_left_color(const css_computed_style *style, #undef BORDER_LEFT_COLOR_SHIFT #undef BORDER_LEFT_COLOR_MASK -#define BORDER_LEFT_STYLE_INDEX 6 -#define BORDER_LEFT_STYLE_SHIFT 14 -#define BORDER_LEFT_STYLE_MASK 0x3c000 +#define BORDER_LEFT_STYLE_INDEX 4 +#define BORDER_LEFT_STYLE_SHIFT 0 +#define BORDER_LEFT_STYLE_MASK 0xf static inline uint8_t get_border_left_style(const css_computed_style *style) { uint32_t bits = style->i.bits[BORDER_LEFT_STYLE_INDEX]; @@ -950,8 +973,8 @@ static inline uint8_t get_border_left_style(const css_computed_style *style) #undef BORDER_LEFT_STYLE_MASK #define BORDER_LEFT_WIDTH_INDEX 0 -#define BORDER_LEFT_WIDTH_SHIFT 16 -#define BORDER_LEFT_WIDTH_MASK 0xff0000 +#define BORDER_LEFT_WIDTH_SHIFT 0 +#define BORDER_LEFT_WIDTH_MASK 0xff static inline uint8_t get_border_left_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -971,9 +994,9 @@ static inline uint8_t get_border_left_width(const css_computed_style *style, #undef BORDER_LEFT_WIDTH_SHIFT #undef BORDER_LEFT_WIDTH_MASK -#define BORDER_RIGHT_COLOR_INDEX 8 -#define BORDER_RIGHT_COLOR_SHIFT 10 -#define BORDER_RIGHT_COLOR_MASK 0xc00 +#define BORDER_RIGHT_COLOR_INDEX 9 +#define BORDER_RIGHT_COLOR_SHIFT 20 +#define BORDER_RIGHT_COLOR_MASK 0x300000 static inline uint8_t get_border_right_color(const css_computed_style *style, css_color *color) { @@ -990,9 +1013,9 @@ static inline uint8_t get_border_right_color(const css_computed_style *style, #undef BORDER_RIGHT_COLOR_SHIFT #undef BORDER_RIGHT_COLOR_MASK -#define BORDER_RIGHT_STYLE_INDEX 2 -#define BORDER_RIGHT_STYLE_SHIFT 0 -#define BORDER_RIGHT_STYLE_MASK 0xf +#define BORDER_RIGHT_STYLE_INDEX 6 +#define BORDER_RIGHT_STYLE_SHIFT 18 +#define BORDER_RIGHT_STYLE_MASK 0x3c0000 static inline uint8_t get_border_right_style(const css_computed_style *style) { uint32_t bits = style->i.bits[BORDER_RIGHT_STYLE_INDEX]; @@ -1008,8 +1031,8 @@ static inline uint8_t get_border_right_style(const css_computed_style *style) #undef BORDER_RIGHT_STYLE_MASK #define BORDER_RIGHT_WIDTH_INDEX 0 -#define BORDER_RIGHT_WIDTH_SHIFT 8 -#define BORDER_RIGHT_WIDTH_MASK 0xff00 +#define BORDER_RIGHT_WIDTH_SHIFT 24 +#define BORDER_RIGHT_WIDTH_MASK 0xff000000 static inline uint8_t get_border_right_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1029,9 +1052,9 @@ static inline uint8_t get_border_right_width(const css_computed_style *style, #undef BORDER_RIGHT_WIDTH_SHIFT #undef BORDER_RIGHT_WIDTH_MASK -#define BORDER_TOP_COLOR_INDEX 8 -#define BORDER_TOP_COLOR_SHIFT 22 -#define BORDER_TOP_COLOR_MASK 0xc00000 +#define BORDER_TOP_COLOR_INDEX 9 +#define BORDER_TOP_COLOR_SHIFT 28 +#define BORDER_TOP_COLOR_MASK 0x30000000 static inline uint8_t get_border_top_color(const css_computed_style *style, css_color *color) { @@ -1048,7 +1071,7 @@ static inline uint8_t get_border_top_color(const css_computed_style *style, #undef BORDER_TOP_COLOR_SHIFT #undef BORDER_TOP_COLOR_MASK -#define BORDER_TOP_STYLE_INDEX 4 +#define BORDER_TOP_STYLE_INDEX 1 #define BORDER_TOP_STYLE_SHIFT 0 #define BORDER_TOP_STYLE_MASK 0xf static inline uint8_t get_border_top_style(const css_computed_style *style) @@ -1066,8 +1089,8 @@ static inline uint8_t get_border_top_style(const css_computed_style *style) #undef BORDER_TOP_STYLE_MASK #define BORDER_TOP_WIDTH_INDEX 0 -#define BORDER_TOP_WIDTH_SHIFT 24 -#define BORDER_TOP_WIDTH_MASK 0xff000000 +#define BORDER_TOP_WIDTH_SHIFT 8 +#define BORDER_TOP_WIDTH_MASK 0xff00 static inline uint8_t get_border_top_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1087,31 +1110,42 @@ static inline uint8_t get_border_top_width(const css_computed_style *style, #undef BORDER_TOP_WIDTH_SHIFT #undef BORDER_TOP_WIDTH_MASK -#define BOTTOM_INDEX 1 +#define BOTTOM_INDEX 4 #define BOTTOM_SHIFT 18 #define BOTTOM_MASK 0x1fc0000 -static inline uint8_t get_bottom(const css_computed_style *style, css_fixed - *length, css_unit *unit) +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 : unit | type */ + + /* 7bits: uuuuutt : units | type */ if ((bits & 0x3) == CSS_BOTTOM_SET) { *length = style->i.bottom; *unit = bits >> 2; } - - return (bits & 0x3); + + return (bits & 0x7); } +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 */ + return bits; +} + #undef BOTTOM_INDEX #undef BOTTOM_SHIFT #undef BOTTOM_MASK - -#define BOX_SIZING_INDEX 8 -#define BOX_SIZING_SHIFT 30 -#define BOX_SIZING_MASK 0xc0000000 +#define BOX_SIZING_INDEX 9 +#define BOX_SIZING_SHIFT 0 +#define BOX_SIZING_MASK 0x3 static inline uint8_t get_box_sizing(const css_computed_style *style) { uint32_t bits = style->i.bits[BOX_SIZING_INDEX]; @@ -1127,8 +1161,8 @@ static inline uint8_t get_box_sizing(const css_computed_style *style) #undef BOX_SIZING_MASK #define CAPTION_SIDE_INDEX 8 -#define CAPTION_SIDE_SHIFT 26 -#define CAPTION_SIDE_MASK 0xc000000 +#define CAPTION_SIDE_SHIFT 0 +#define CAPTION_SIDE_MASK 0x3 static inline uint8_t get_caption_side(const css_computed_style *style) { uint32_t bits = style->i.bits[CAPTION_SIDE_INDEX]; @@ -1143,9 +1177,9 @@ static inline uint8_t get_caption_side(const css_computed_style *style) #undef CAPTION_SIDE_SHIFT #undef CAPTION_SIDE_MASK -#define CLEAR_INDEX 6 -#define CLEAR_SHIFT 3 -#define CLEAR_MASK 0x38 +#define CLEAR_INDEX 8 +#define CLEAR_SHIFT 8 +#define CLEAR_MASK 0x700 static inline uint8_t get_clear(const css_computed_style *style) { uint32_t bits = style->i.bits[CLEAR_INDEX]; @@ -1161,8 +1195,8 @@ static inline uint8_t get_clear(const css_computed_style *style) #undef CLEAR_MASK #define COLOR_INDEX 10 -#define COLOR_SHIFT 28 -#define COLOR_MASK 0x10000000 +#define COLOR_SHIFT 22 +#define COLOR_MASK 0x400000 static inline uint8_t get_color(const css_computed_style *style, css_color *color) { @@ -1179,9 +1213,9 @@ static inline uint8_t get_color(const css_computed_style *style, css_color #undef COLOR_SHIFT #undef COLOR_MASK -#define DIRECTION_INDEX 8 -#define DIRECTION_SHIFT 18 -#define DIRECTION_MASK 0xc0000 +#define DIRECTION_INDEX 9 +#define DIRECTION_SHIFT 2 +#define DIRECTION_MASK 0xc static inline uint8_t get_direction(const css_computed_style *style) { uint32_t bits = style->i.bits[DIRECTION_INDEX]; @@ -1213,9 +1247,9 @@ static inline uint8_t get_display(const css_computed_style *style) #undef DISPLAY_SHIFT #undef DISPLAY_MASK -#define EMPTY_CELLS_INDEX 8 -#define EMPTY_CELLS_SHIFT 8 -#define EMPTY_CELLS_MASK 0x300 +#define EMPTY_CELLS_INDEX 9 +#define EMPTY_CELLS_SHIFT 14 +#define EMPTY_CELLS_MASK 0xc000 static inline uint8_t get_empty_cells(const css_computed_style *style) { uint32_t bits = style->i.bits[EMPTY_CELLS_INDEX]; @@ -1230,7 +1264,7 @@ static inline uint8_t get_empty_cells(const css_computed_style *style) #undef EMPTY_CELLS_SHIFT #undef EMPTY_CELLS_MASK -#define FLEX_BASIS_INDEX 1 +#define FLEX_BASIS_INDEX 2 #define FLEX_BASIS_SHIFT 4 #define FLEX_BASIS_MASK 0x7f0 static inline uint8_t get_flex_basis(const css_computed_style *style, css_fixed @@ -1252,9 +1286,9 @@ static inline uint8_t get_flex_basis(const css_computed_style *style, css_fixed #undef FLEX_BASIS_SHIFT #undef FLEX_BASIS_MASK -#define FLEX_DIRECTION_INDEX 9 -#define FLEX_DIRECTION_SHIFT 29 -#define FLEX_DIRECTION_MASK 0xe0000000 +#define FLEX_DIRECTION_INDEX 8 +#define FLEX_DIRECTION_SHIFT 5 +#define FLEX_DIRECTION_MASK 0xe0 static inline uint8_t get_flex_direction(const css_computed_style *style) { uint32_t bits = style->i.bits[FLEX_DIRECTION_INDEX]; @@ -1269,9 +1303,9 @@ static inline uint8_t get_flex_direction(const css_computed_style *style) #undef FLEX_DIRECTION_SHIFT #undef FLEX_DIRECTION_MASK -#define FLEX_GROW_INDEX 9 -#define FLEX_GROW_SHIFT 0 -#define FLEX_GROW_MASK 0x1 +#define FLEX_GROW_INDEX 10 +#define FLEX_GROW_SHIFT 25 +#define FLEX_GROW_MASK 0x2000000 static inline uint8_t get_flex_grow(const css_computed_style *style, css_fixed *fixed) { @@ -1291,8 +1325,8 @@ static inline uint8_t get_flex_grow(const css_computed_style *style, css_fixed #undef FLEX_GROW_MASK #define FLEX_SHRINK_INDEX 10 -#define FLEX_SHRINK_SHIFT 29 -#define FLEX_SHRINK_MASK 0x20000000 +#define FLEX_SHRINK_SHIFT 24 +#define FLEX_SHRINK_MASK 0x1000000 static inline uint8_t get_flex_shrink(const css_computed_style *style, css_fixed *fixed) { @@ -1311,9 +1345,9 @@ static inline uint8_t get_flex_shrink(const css_computed_style *style, #undef FLEX_SHRINK_SHIFT #undef FLEX_SHRINK_MASK -#define FLEX_WRAP_INDEX 8 -#define FLEX_WRAP_SHIFT 16 -#define FLEX_WRAP_MASK 0x30000 +#define FLEX_WRAP_INDEX 10 +#define FLEX_WRAP_SHIFT 30 +#define FLEX_WRAP_MASK 0xc0000000 static inline uint8_t get_flex_wrap(const css_computed_style *style) { uint32_t bits = style->i.bits[FLEX_WRAP_INDEX]; @@ -1328,9 +1362,9 @@ static inline uint8_t get_flex_wrap(const css_computed_style *style) #undef FLEX_WRAP_SHIFT #undef FLEX_WRAP_MASK -#define FLOAT_INDEX 8 -#define FLOAT_SHIFT 20 -#define FLOAT_MASK 0x300000 +#define FLOAT_INDEX 9 +#define FLOAT_SHIFT 30 +#define FLOAT_MASK 0xc0000000 static inline uint8_t get_float(const css_computed_style *style) { uint32_t bits = style->i.bits[FLOAT_INDEX]; @@ -1345,9 +1379,9 @@ static inline uint8_t get_float(const css_computed_style *style) #undef FLOAT_SHIFT #undef FLOAT_MASK -#define FONT_FAMILY_INDEX 9 -#define FONT_FAMILY_SHIFT 20 -#define FONT_FAMILY_MASK 0x700000 +#define FONT_FAMILY_INDEX 8 +#define FONT_FAMILY_SHIFT 26 +#define FONT_FAMILY_MASK 0x1c000000 static inline uint8_t get_font_family(const css_computed_style *style, lwc_string ***string_arr) { @@ -1386,9 +1420,9 @@ static inline uint8_t get_font_size(const css_computed_style *style, css_fixed #undef FONT_SIZE_SHIFT #undef FONT_SIZE_MASK -#define FONT_STYLE_INDEX 8 -#define FONT_STYLE_SHIFT 2 -#define FONT_STYLE_MASK 0xc +#define FONT_STYLE_INDEX 7 +#define FONT_STYLE_SHIFT 0 +#define FONT_STYLE_MASK 0x3 static inline uint8_t get_font_style(const css_computed_style *style) { uint32_t bits = style->i.bits[FONT_STYLE_INDEX]; @@ -1404,8 +1438,8 @@ static inline uint8_t get_font_style(const css_computed_style *style) #undef FONT_STYLE_MASK #define FONT_VARIANT_INDEX 9 -#define FONT_VARIANT_SHIFT 1 -#define FONT_VARIANT_MASK 0x6 +#define FONT_VARIANT_SHIFT 10 +#define FONT_VARIANT_MASK 0xc00 static inline uint8_t get_font_variant(const css_computed_style *style) { uint32_t bits = style->i.bits[FONT_VARIANT_INDEX]; @@ -1421,8 +1455,8 @@ static inline uint8_t get_font_variant(const css_computed_style *style) #undef FONT_VARIANT_MASK #define FONT_WEIGHT_INDEX 6 -#define FONT_WEIGHT_SHIFT 18 -#define FONT_WEIGHT_MASK 0x3c0000 +#define FONT_WEIGHT_SHIFT 6 +#define FONT_WEIGHT_MASK 0x3c0 static inline uint8_t get_font_weight(const css_computed_style *style) { uint32_t bits = style->i.bits[FONT_WEIGHT_INDEX]; @@ -1437,9 +1471,9 @@ static inline uint8_t get_font_weight(const css_computed_style *style) #undef FONT_WEIGHT_SHIFT #undef FONT_WEIGHT_MASK -#define HEIGHT_INDEX 3 -#define HEIGHT_SHIFT 18 -#define HEIGHT_MASK 0x1fc0000 +#define HEIGHT_INDEX 1 +#define HEIGHT_SHIFT 25 +#define HEIGHT_MASK 0xfe000000 static inline uint8_t get_height(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1459,9 +1493,9 @@ static inline uint8_t get_height(const css_computed_style *style, css_fixed #undef HEIGHT_SHIFT #undef HEIGHT_MASK -#define JUSTIFY_CONTENT_INDEX 9 -#define JUSTIFY_CONTENT_SHIFT 26 -#define JUSTIFY_CONTENT_MASK 0x1c000000 +#define JUSTIFY_CONTENT_INDEX 8 +#define JUSTIFY_CONTENT_SHIFT 11 +#define JUSTIFY_CONTENT_MASK 0x3800 static inline uint8_t get_justify_content(const css_computed_style *style) { uint32_t bits = style->i.bits[JUSTIFY_CONTENT_INDEX]; @@ -1476,31 +1510,42 @@ static inline uint8_t get_justify_content(const css_computed_style *style) #undef JUSTIFY_CONTENT_SHIFT #undef JUSTIFY_CONTENT_MASK -#define LEFT_INDEX 3 +#define LEFT_INDEX 4 #define LEFT_SHIFT 25 #define LEFT_MASK 0xfe000000 -static inline uint8_t get_left(const css_computed_style *style, css_fixed - *length, css_unit *unit) +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 : unit | type */ + + /* 7bits: uuuuutt : units | type */ if ((bits & 0x3) == CSS_LEFT_SET) { *length = style->i.left; *unit = bits >> 2; } - - return (bits & 0x3); + + return (bits & 0x7); +} +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 */ + return bits; } + #undef LEFT_INDEX #undef LEFT_SHIFT #undef LEFT_MASK - -#define LINE_HEIGHT_INDEX 2 -#define LINE_HEIGHT_SHIFT 4 -#define LINE_HEIGHT_MASK 0x7f0 +#define LINE_HEIGHT_INDEX 3 +#define LINE_HEIGHT_SHIFT 25 +#define LINE_HEIGHT_MASK 0xfe000000 static inline uint8_t get_line_height( const css_computed_style *style, css_fixed *length, css_unit *unit) @@ -1526,8 +1571,8 @@ static inline uint8_t get_line_height( #undef LINE_HEIGHT_SHIFT #undef LINE_HEIGHT_MASK #define LIST_STYLE_IMAGE_INDEX 10 -#define LIST_STYLE_IMAGE_SHIFT 25 -#define LIST_STYLE_IMAGE_MASK 0x2000000 +#define LIST_STYLE_IMAGE_SHIFT 20 +#define LIST_STYLE_IMAGE_MASK 0x100000 static inline uint8_t get_list_style_image(const css_computed_style *style, lwc_string **string) { @@ -1545,8 +1590,8 @@ static inline uint8_t get_list_style_image(const css_computed_style *style, #undef LIST_STYLE_IMAGE_MASK #define LIST_STYLE_POSITION_INDEX 10 -#define LIST_STYLE_POSITION_SHIFT 30 -#define LIST_STYLE_POSITION_MASK 0xc0000000 +#define LIST_STYLE_POSITION_SHIFT 28 +#define LIST_STYLE_POSITION_MASK 0x30000000 static inline uint8_t get_list_style_position(const css_computed_style *style) { uint32_t bits = style->i.bits[LIST_STYLE_POSITION_INDEX]; @@ -1562,8 +1607,8 @@ static inline uint8_t get_list_style_position(const css_computed_style *style) #undef LIST_STYLE_POSITION_MASK #define LIST_STYLE_TYPE_INDEX 6 -#define LIST_STYLE_TYPE_SHIFT 6 -#define LIST_STYLE_TYPE_MASK 0x3c0 +#define LIST_STYLE_TYPE_SHIFT 10 +#define LIST_STYLE_TYPE_MASK 0x3c00 static inline uint8_t get_list_style_type(const css_computed_style *style) { uint32_t bits = style->i.bits[LIST_STYLE_TYPE_INDEX]; @@ -1579,8 +1624,8 @@ static inline uint8_t get_list_style_type(const css_computed_style *style) #undef LIST_STYLE_TYPE_MASK #define MARGIN_BOTTOM_INDEX 2 -#define MARGIN_BOTTOM_SHIFT 25 -#define MARGIN_BOTTOM_MASK 0xfe000000 +#define MARGIN_BOTTOM_SHIFT 18 +#define MARGIN_BOTTOM_MASK 0x1fc0000 static inline uint8_t get_margin_bottom(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1600,9 +1645,9 @@ static inline uint8_t get_margin_bottom(const css_computed_style *style, #undef MARGIN_BOTTOM_SHIFT #undef MARGIN_BOTTOM_MASK -#define MARGIN_LEFT_INDEX 3 -#define MARGIN_LEFT_SHIFT 11 -#define MARGIN_LEFT_MASK 0x3f800 +#define MARGIN_LEFT_INDEX 2 +#define MARGIN_LEFT_SHIFT 25 +#define MARGIN_LEFT_MASK 0xfe000000 static inline uint8_t get_margin_left(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1622,9 +1667,9 @@ static inline uint8_t get_margin_left(const css_computed_style *style, #undef MARGIN_LEFT_SHIFT #undef MARGIN_LEFT_MASK -#define MARGIN_RIGHT_INDEX 2 -#define MARGIN_RIGHT_SHIFT 11 -#define MARGIN_RIGHT_MASK 0x3f800 +#define MARGIN_RIGHT_INDEX 1 +#define MARGIN_RIGHT_SHIFT 18 +#define MARGIN_RIGHT_MASK 0x1fc0000 static inline uint8_t get_margin_right(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1645,8 +1690,8 @@ static inline uint8_t get_margin_right(const css_computed_style *style, #undef MARGIN_RIGHT_MASK #define MARGIN_TOP_INDEX 4 -#define MARGIN_TOP_SHIFT 18 -#define MARGIN_TOP_MASK 0x1fc0000 +#define MARGIN_TOP_SHIFT 4 +#define MARGIN_TOP_MASK 0x7f0 static inline uint8_t get_margin_top(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1666,7 +1711,7 @@ static inline uint8_t get_margin_top(const css_computed_style *style, css_fixed #undef MARGIN_TOP_SHIFT #undef MARGIN_TOP_MASK -#define MAX_HEIGHT_INDEX 1 +#define MAX_HEIGHT_INDEX 3 #define MAX_HEIGHT_SHIFT 11 #define MAX_HEIGHT_MASK 0x3f800 static inline uint8_t get_max_height(const css_computed_style *style, css_fixed @@ -1688,9 +1733,9 @@ static inline uint8_t get_max_height(const css_computed_style *style, css_fixed #undef MAX_HEIGHT_SHIFT #undef MAX_HEIGHT_MASK -#define MAX_WIDTH_INDEX 4 -#define MAX_WIDTH_SHIFT 25 -#define MAX_WIDTH_MASK 0xfe000000 +#define MAX_WIDTH_INDEX 1 +#define MAX_WIDTH_SHIFT 4 +#define MAX_WIDTH_MASK 0x7f0 static inline uint8_t get_max_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1710,9 +1755,9 @@ static inline uint8_t get_max_width(const css_computed_style *style, css_fixed #undef MAX_WIDTH_SHIFT #undef MAX_WIDTH_MASK -#define MIN_HEIGHT_INDEX 3 -#define MIN_HEIGHT_SHIFT 4 -#define MIN_HEIGHT_MASK 0x7f0 +#define MIN_HEIGHT_INDEX 1 +#define MIN_HEIGHT_SHIFT 11 +#define MIN_HEIGHT_MASK 0x3f800 static inline uint8_t get_min_height(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1732,9 +1777,9 @@ static inline uint8_t get_min_height(const css_computed_style *style, css_fixed #undef MIN_HEIGHT_SHIFT #undef MIN_HEIGHT_MASK -#define MIN_WIDTH_INDEX 4 -#define MIN_WIDTH_SHIFT 4 -#define MIN_WIDTH_MASK 0x7f0 +#define MIN_WIDTH_INDEX 2 +#define MIN_WIDTH_SHIFT 11 +#define MIN_WIDTH_MASK 0x3f800 static inline uint8_t get_min_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1755,8 +1800,8 @@ static inline uint8_t get_min_width(const css_computed_style *style, css_fixed #undef MIN_WIDTH_MASK #define OPACITY_INDEX 10 -#define OPACITY_SHIFT 24 -#define OPACITY_MASK 0x1000000 +#define OPACITY_SHIFT 27 +#define OPACITY_MASK 0x8000000 static inline uint8_t get_opacity(const css_computed_style *style, css_fixed *fixed) { @@ -1776,8 +1821,8 @@ static inline uint8_t get_opacity(const css_computed_style *style, css_fixed #undef OPACITY_MASK #define ORDER_INDEX 10 -#define ORDER_SHIFT 23 -#define ORDER_MASK 0x800000 +#define ORDER_SHIFT 26 +#define ORDER_MASK 0x4000000 static inline uint8_t get_order(const css_computed_style *style, int32_t *integer) { @@ -1796,7 +1841,7 @@ static inline uint8_t get_order(const css_computed_style *style, int32_t #undef ORDER_SHIFT #undef ORDER_MASK -#define OUTLINE_STYLE_INDEX 1 +#define OUTLINE_STYLE_INDEX 3 #define OUTLINE_STYLE_SHIFT 0 #define OUTLINE_STYLE_MASK 0xf static inline uint8_t get_outline_style(const css_computed_style *style) @@ -1813,26 +1858,43 @@ static inline uint8_t get_outline_style(const css_computed_style *style) #undef OUTLINE_STYLE_SHIFT #undef OUTLINE_STYLE_MASK -#define OVERFLOW_INDEX 9 -#define OVERFLOW_SHIFT 14 -#define OVERFLOW_MASK 0x1c000 -static inline uint8_t get_overflow(const css_computed_style *style) +#define OVERFLOW_X_INDEX 8 +#define OVERFLOW_X_SHIFT 2 +#define OVERFLOW_X_MASK 0x1c +static inline uint8_t get_overflow_x(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); +} +#undef OVERFLOW_X_INDEX +#undef OVERFLOW_X_SHIFT +#undef OVERFLOW_X_MASK + +#define OVERFLOW_Y_INDEX 6 +#define OVERFLOW_Y_SHIFT 3 +#define OVERFLOW_Y_MASK 0x38 +static inline uint8_t get_overflow_y(const css_computed_style *style) { - uint32_t bits = style->i.bits[OVERFLOW_INDEX]; - bits &= OVERFLOW_MASK; - bits >>= OVERFLOW_SHIFT; + uint32_t bits = style->i.bits[OVERFLOW_Y_INDEX]; + bits &= OVERFLOW_Y_MASK; + bits >>= OVERFLOW_Y_SHIFT; /* 3bits: ttt : type */ return (bits & 0x7); } -#undef OVERFLOW_INDEX -#undef OVERFLOW_SHIFT -#undef OVERFLOW_MASK +#undef OVERFLOW_Y_INDEX +#undef OVERFLOW_Y_SHIFT +#undef OVERFLOW_Y_MASK #define PADDING_BOTTOM_INDEX 7 -#define PADDING_BOTTOM_SHIFT 8 -#define PADDING_BOTTOM_MASK 0x3f00 +#define PADDING_BOTTOM_SHIFT 14 +#define PADDING_BOTTOM_MASK 0xfc000 static inline uint8_t get_padding_bottom(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1853,8 +1915,8 @@ static inline uint8_t get_padding_bottom(const css_computed_style *style, #undef PADDING_BOTTOM_MASK #define PADDING_LEFT_INDEX 7 -#define PADDING_LEFT_SHIFT 14 -#define PADDING_LEFT_MASK 0xfc000 +#define PADDING_LEFT_SHIFT 8 +#define PADDING_LEFT_MASK 0x3f00 static inline uint8_t get_padding_left(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1875,8 +1937,8 @@ static inline uint8_t get_padding_left(const css_computed_style *style, #undef PADDING_LEFT_MASK #define PADDING_RIGHT_INDEX 7 -#define PADDING_RIGHT_SHIFT 2 -#define PADDING_RIGHT_MASK 0xfc +#define PADDING_RIGHT_SHIFT 20 +#define PADDING_RIGHT_MASK 0x3f00000 static inline uint8_t get_padding_right(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1918,9 +1980,9 @@ static inline uint8_t get_padding_top(const css_computed_style *style, #undef PADDING_TOP_SHIFT #undef PADDING_TOP_MASK -#define POSITION_INDEX 9 -#define POSITION_SHIFT 11 -#define POSITION_MASK 0x3800 +#define POSITION_INDEX 8 +#define POSITION_SHIFT 17 +#define POSITION_MASK 0xe0000 static inline uint8_t get_position(const css_computed_style *style) { uint32_t bits = style->i.bits[POSITION_INDEX]; @@ -1936,8 +1998,8 @@ static inline uint8_t get_position(const css_computed_style *style) #undef POSITION_MASK #define QUOTES_INDEX 10 -#define QUOTES_SHIFT 27 -#define QUOTES_MASK 0x8000000 +#define QUOTES_SHIFT 23 +#define QUOTES_MASK 0x800000 static inline uint8_t get_quotes(const css_computed_style *style, lwc_string ***string_arr) { @@ -1957,28 +2019,39 @@ 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( + 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 : unit | type */ + + /* 7bits: uuuuutt : units | type */ if ((bits & 0x3) == CSS_RIGHT_SET) { *length = style->i.right; *unit = bits >> 2; } - - return (bits & 0x3); + + return (bits & 0x7); +} +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 */ + return bits; } + #undef RIGHT_INDEX #undef RIGHT_SHIFT #undef RIGHT_MASK - -#define TABLE_LAYOUT_INDEX 8 -#define TABLE_LAYOUT_SHIFT 0 -#define TABLE_LAYOUT_MASK 0x3 +#define TABLE_LAYOUT_INDEX 9 +#define TABLE_LAYOUT_SHIFT 18 +#define TABLE_LAYOUT_MASK 0xc0000 static inline uint8_t get_table_layout(const css_computed_style *style) { uint32_t bits = style->i.bits[TABLE_LAYOUT_INDEX]; @@ -1994,8 +2067,8 @@ static inline uint8_t get_table_layout(const css_computed_style *style) #undef TABLE_LAYOUT_MASK #define TEXT_ALIGN_INDEX 6 -#define TEXT_ALIGN_SHIFT 10 -#define TEXT_ALIGN_MASK 0x3c00 +#define TEXT_ALIGN_SHIFT 14 +#define TEXT_ALIGN_MASK 0x3c000 static inline uint8_t get_text_align(const css_computed_style *style) { uint32_t bits = style->i.bits[TEXT_ALIGN_INDEX]; @@ -2028,8 +2101,8 @@ static inline uint8_t get_text_decoration(const css_computed_style *style) #undef TEXT_DECORATION_MASK #define TEXT_INDENT_INDEX 7 -#define TEXT_INDENT_SHIFT 20 -#define TEXT_INDENT_MASK 0x3f00000 +#define TEXT_INDENT_SHIFT 2 +#define TEXT_INDENT_MASK 0xfc static inline uint8_t get_text_indent(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -2049,9 +2122,9 @@ static inline uint8_t get_text_indent(const css_computed_style *style, #undef TEXT_INDENT_SHIFT #undef TEXT_INDENT_MASK -#define TEXT_TRANSFORM_INDEX 6 -#define TEXT_TRANSFORM_SHIFT 0 -#define TEXT_TRANSFORM_MASK 0x7 +#define TEXT_TRANSFORM_INDEX 8 +#define TEXT_TRANSFORM_SHIFT 20 +#define TEXT_TRANSFORM_MASK 0x700000 static inline uint8_t get_text_transform(const css_computed_style *style) { uint32_t bits = style->i.bits[TEXT_TRANSFORM_INDEX]; @@ -2066,29 +2139,40 @@ static inline uint8_t get_text_transform(const css_computed_style *style) #undef TEXT_TRANSFORM_SHIFT #undef TEXT_TRANSFORM_MASK -#define TOP_INDEX 1 -#define TOP_SHIFT 25 -#define TOP_MASK 0xfe000000 -static inline uint8_t get_top(const css_computed_style *style, css_fixed - *length, css_unit *unit) +#define TOP_INDEX 3 +#define TOP_SHIFT 4 +#define TOP_MASK 0x7f0 +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 : unit | type */ + + /* 7bits: uuuuutt : units | type */ if ((bits & 0x3) == CSS_TOP_SET) { *length = style->i.top; *unit = bits >> 2; } - - return (bits & 0x3); + + return (bits & 0x7); } +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 */ + return bits; +} + #undef TOP_INDEX #undef TOP_SHIFT #undef TOP_MASK - -#define UNICODE_BIDI_INDEX 8 +#define UNICODE_BIDI_INDEX 9 #define UNICODE_BIDI_SHIFT 6 #define UNICODE_BIDI_MASK 0xc0 static inline uint8_t get_unicode_bidi(const css_computed_style *style) @@ -2128,8 +2212,8 @@ static inline uint8_t get_vertical_align(const css_computed_style *style, #undef VERTICAL_ALIGN_MASK #define VISIBILITY_INDEX 9 -#define VISIBILITY_SHIFT 3 -#define VISIBILITY_MASK 0x18 +#define VISIBILITY_SHIFT 16 +#define VISIBILITY_MASK 0x30000 static inline uint8_t get_visibility(const css_computed_style *style) { uint32_t bits = style->i.bits[VISIBILITY_INDEX]; @@ -2144,9 +2228,9 @@ static inline uint8_t get_visibility(const css_computed_style *style) #undef VISIBILITY_SHIFT #undef VISIBILITY_MASK -#define WHITE_SPACE_INDEX 9 -#define WHITE_SPACE_SHIFT 5 -#define WHITE_SPACE_MASK 0xe0 +#define WHITE_SPACE_INDEX 6 +#define WHITE_SPACE_SHIFT 0 +#define WHITE_SPACE_MASK 0x7 static inline uint8_t get_white_space(const css_computed_style *style) { uint32_t bits = style->i.bits[WHITE_SPACE_INDEX]; @@ -2161,7 +2245,7 @@ static inline uint8_t get_white_space(const css_computed_style *style) #undef WHITE_SPACE_SHIFT #undef WHITE_SPACE_MASK -#define WIDTH_INDEX 2 +#define WIDTH_INDEX 3 #define WIDTH_SHIFT 18 #define WIDTH_MASK 0x1fc0000 static inline uint8_t get_width(const css_computed_style *style, css_fixed @@ -2183,9 +2267,9 @@ static inline uint8_t get_width(const css_computed_style *style, css_fixed #undef WIDTH_SHIFT #undef WIDTH_MASK -#define Z_INDEX_INDEX 8 -#define Z_INDEX_SHIFT 14 -#define Z_INDEX_MASK 0xc000 +#define Z_INDEX_INDEX 9 +#define Z_INDEX_SHIFT 24 +#define Z_INDEX_MASK 0x3000000 static inline uint8_t get_z_index(const css_computed_style *style, int32_t *integer) { diff --git a/src/select/autogenerated_propset.h b/src/select/autogenerated_propset.h index 005ce0c..9a363a8 100644 --- a/src/select/autogenerated_propset.h +++ b/src/select/autogenerated_propset.h @@ -11,23 +11,23 @@ static const css_computed_uncommon default_uncommon = { .i = { .bits = { (CSS_BORDER_SPACING_SET << 21) | ( - CSS_OUTLINE_WIDTH_MEDIUM << 13) | ( - CSS_COLUMN_RULE_WIDTH_MEDIUM << 5) | - CSS_CURSOR_INHERIT, - (CSS_COLUMN_WIDTH_AUTO << 25) | ( - CSS_LETTER_SPACING_NORMAL << 18) | ( - CSS_COLUMN_GAP_NORMAL << 11) | ( - CSS_WORD_SPACING_NORMAL << 4) | - CSS_BREAK_AFTER_AUTO, + CSS_COLUMN_RULE_WIDTH_MEDIUM << 13) | ( + CSS_OUTLINE_WIDTH_MEDIUM << 5) | + CSS_CURSOR_AUTO, + (CSS_COLUMN_GAP_NORMAL << 25) | ( + CSS_WORD_SPACING_NORMAL << 18) | ( + CSS_LETTER_SPACING_NORMAL << 11) | ( + CSS_COLUMN_WIDTH_AUTO << 4) | + CSS_BREAK_INSIDE_AUTO, (CSS_CLIP_AUTO << 6) | (CSS_COLUMN_RULE_STYLE_NONE << - 2) | CSS_CONTENT_NORMAL, - (CSS_BREAK_INSIDE_AUTO << 28) | (CSS_BREAK_BEFORE_AUTO + 2) | CSS_OUTLINE_COLOR_INVERT, + (CSS_BREAK_AFTER_AUTO << 28) | (CSS_BREAK_BEFORE_AUTO << 24) | (CSS_COLUMN_COUNT_AUTO << 22) - | (CSS_COLUMN_RULE_COLOR_CURRENT_COLOR - << 20) | (CSS_OUTLINE_COLOR_INVERT << - 18) | (CSS_WRITING_MODE_HORIZONTAL_TB - << 16) | (CSS_COLUMN_FILL_BALANCE << - 14) | (CSS_COLUMN_SPAN_NONE << 12) | ( + | (CSS_COLUMN_FILL_BALANCE << 20) | ( + CSS_WRITING_MODE_HORIZONTAL_TB << 18) | + (CSS_COLUMN_RULE_COLOR_CURRENT_COLOR << + 16) | (CSS_COLUMN_SPAN_NONE << 14) | ( + CSS_CONTENT_NORMAL << 12) | ( CSS_COUNTER_RESET_NONE << 11) | ( CSS_COUNTER_INCREMENT_NONE << 10) }, @@ -76,10 +76,12 @@ 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 = &style->i.uncommon->i.bits[BORDER_SPACING_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[BORDER_SPACING_INDEX]; + /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */ *bits = (*bits & ~BORDER_SPACING_MASK) | (((type & 0x1) | (unit_b << 1) | (unit_a << 6)) << BORDER_SPACING_SHIFT); @@ -94,16 +96,18 @@ static inline css_error set_border_spacing(css_computed_style *style, uint8_t #undef BORDER_SPACING_SHIFT #undef BORDER_SPACING_MASK -#define BREAK_AFTER_INDEX 1 -#define BREAK_AFTER_SHIFT 0 -#define BREAK_AFTER_MASK 0xf +#define BREAK_AFTER_INDEX 3 +#define BREAK_AFTER_SHIFT 28 +#define BREAK_AFTER_MASK 0xf0000000 static inline css_error set_break_after(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.uncommon->i.bits[BREAK_AFTER_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[BREAK_AFTER_INDEX]; + /* 4bits: tttt : type */ *bits = (*bits & ~BREAK_AFTER_MASK) | ((type & 0xf) << BREAK_AFTER_SHIFT); @@ -121,10 +125,12 @@ 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 = &style->i.uncommon->i.bits[BREAK_BEFORE_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[BREAK_BEFORE_INDEX]; + /* 4bits: tttt : type */ *bits = (*bits & ~BREAK_BEFORE_MASK) | ((type & 0xf) << BREAK_BEFORE_SHIFT); @@ -135,17 +141,19 @@ static inline css_error set_break_before(css_computed_style *style, uint8_t #undef BREAK_BEFORE_SHIFT #undef BREAK_BEFORE_MASK -#define BREAK_INSIDE_INDEX 3 -#define BREAK_INSIDE_SHIFT 28 -#define BREAK_INSIDE_MASK 0xf0000000 +#define BREAK_INSIDE_INDEX 1 +#define BREAK_INSIDE_SHIFT 0 +#define BREAK_INSIDE_MASK 0xf static inline css_error set_break_inside(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.uncommon->i.bits[BREAK_INSIDE_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[BREAK_INSIDE_INDEX]; + /* 4bits: tttt : type */ *bits = (*bits & ~BREAK_INSIDE_MASK) | ((type & 0xf) << BREAK_INSIDE_SHIFT); @@ -208,10 +216,12 @@ static inline css_error set_clip( static inline css_error set_column_count(css_computed_style *style, uint8_t type, int32_t integer) { - uint32_t *bits = &style->i.uncommon->i.bits[COLUMN_COUNT_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COLUMN_COUNT_INDEX]; + /* 2bits: tt : type */ *bits = (*bits & ~COLUMN_COUNT_MASK) | ((type & 0x3) << COLUMN_COUNT_SHIFT); @@ -225,15 +235,17 @@ static inline css_error set_column_count(css_computed_style *style, uint8_t #undef COLUMN_COUNT_MASK #define COLUMN_FILL_INDEX 3 -#define COLUMN_FILL_SHIFT 14 -#define COLUMN_FILL_MASK 0xc000 +#define COLUMN_FILL_SHIFT 20 +#define COLUMN_FILL_MASK 0x300000 static inline css_error set_column_fill(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.uncommon->i.bits[COLUMN_FILL_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COLUMN_FILL_INDEX]; + /* 2bits: tt : type */ *bits = (*bits & ~COLUMN_FILL_MASK) | ((type & 0x3) << COLUMN_FILL_SHIFT); @@ -245,16 +257,18 @@ static inline css_error set_column_fill(css_computed_style *style, uint8_t type) #undef COLUMN_FILL_MASK #define COLUMN_GAP_INDEX 1 -#define COLUMN_GAP_SHIFT 11 -#define COLUMN_GAP_MASK 0x3f800 +#define COLUMN_GAP_SHIFT 25 +#define COLUMN_GAP_MASK 0xfe000000 static inline css_error set_column_gap(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.uncommon->i.bits[COLUMN_GAP_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COLUMN_GAP_INDEX]; + /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~COLUMN_GAP_MASK) | (((type & 0x3) | (unit << 2)) << COLUMN_GAP_SHIFT); @@ -268,16 +282,18 @@ static inline css_error set_column_gap(css_computed_style *style, uint8_t type, #undef COLUMN_GAP_MASK #define COLUMN_RULE_COLOR_INDEX 3 -#define COLUMN_RULE_COLOR_SHIFT 20 -#define COLUMN_RULE_COLOR_MASK 0x300000 +#define COLUMN_RULE_COLOR_SHIFT 16 +#define COLUMN_RULE_COLOR_MASK 0x30000 static inline css_error set_column_rule_color(css_computed_style *style, uint8_t type, css_color color) { - uint32_t *bits = &style->i.uncommon->i.bits[COLUMN_RULE_COLOR_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COLUMN_RULE_COLOR_INDEX]; + /* 2bits: tt : type */ *bits = (*bits & ~COLUMN_RULE_COLOR_MASK) | ((type & 0x3) << COLUMN_RULE_COLOR_SHIFT); @@ -297,10 +313,12 @@ 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 = &style->i.uncommon->i.bits[COLUMN_RULE_STYLE_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COLUMN_RULE_STYLE_INDEX]; + /* 4bits: tttt : type */ *bits = (*bits & ~COLUMN_RULE_STYLE_MASK) | ((type & 0xf) << COLUMN_RULE_STYLE_SHIFT); @@ -312,16 +330,18 @@ static inline css_error set_column_rule_style(css_computed_style *style, #undef COLUMN_RULE_STYLE_MASK #define COLUMN_RULE_WIDTH_INDEX 0 -#define COLUMN_RULE_WIDTH_SHIFT 5 -#define COLUMN_RULE_WIDTH_MASK 0x1fe0 +#define COLUMN_RULE_WIDTH_SHIFT 13 +#define COLUMN_RULE_WIDTH_MASK 0x1fe000 static inline css_error set_column_rule_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.uncommon->i.bits[COLUMN_RULE_WIDTH_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COLUMN_RULE_WIDTH_INDEX]; + /* 8bits: uuuuuttt : unit | type */ *bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) | (((type & 0x7) | (unit << 3)) << COLUMN_RULE_WIDTH_SHIFT); @@ -335,15 +355,17 @@ static inline css_error set_column_rule_width(css_computed_style *style, #undef COLUMN_RULE_WIDTH_MASK #define COLUMN_SPAN_INDEX 3 -#define COLUMN_SPAN_SHIFT 12 -#define COLUMN_SPAN_MASK 0x3000 +#define COLUMN_SPAN_SHIFT 14 +#define COLUMN_SPAN_MASK 0xc000 static inline css_error set_column_span(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.uncommon->i.bits[COLUMN_SPAN_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COLUMN_SPAN_INDEX]; + /* 2bits: tt : type */ *bits = (*bits & ~COLUMN_SPAN_MASK) | ((type & 0x3) << COLUMN_SPAN_SHIFT); @@ -355,16 +377,18 @@ static inline css_error set_column_span(css_computed_style *style, uint8_t type) #undef COLUMN_SPAN_MASK #define COLUMN_WIDTH_INDEX 1 -#define COLUMN_WIDTH_SHIFT 25 -#define COLUMN_WIDTH_MASK 0xfe000000 +#define COLUMN_WIDTH_SHIFT 4 +#define COLUMN_WIDTH_MASK 0x7f0 static inline css_error set_column_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.uncommon->i.bits[COLUMN_WIDTH_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COLUMN_WIDTH_INDEX]; + /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~COLUMN_WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << COLUMN_WIDTH_SHIFT); @@ -377,9 +401,9 @@ static inline css_error set_column_width(css_computed_style *style, uint8_t #undef COLUMN_WIDTH_SHIFT #undef COLUMN_WIDTH_MASK -#define CONTENT_INDEX 2 -#define CONTENT_SHIFT 0 -#define CONTENT_MASK 0x3 +#define CONTENT_INDEX 3 +#define CONTENT_SHIFT 12 +#define CONTENT_MASK 0x3000 static inline css_error set_content( css_computed_style *style, uint8_t type, css_computed_content_item *content) @@ -469,10 +493,12 @@ static inline css_error set_content( static inline css_error set_counter_increment(css_computed_style *style, uint8_t type, css_computed_counter *counter_arr) { - uint32_t *bits = &style->i.uncommon->i.bits[COUNTER_INCREMENT_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COUNTER_INCREMENT_INDEX]; + /* 1bit: t : type */ *bits = (*bits & ~COUNTER_INCREMENT_MASK) | ((type & 0x1) << COUNTER_INCREMENT_SHIFT); @@ -508,10 +534,12 @@ static inline css_error set_counter_increment(css_computed_style *style, static inline css_error set_counter_reset(css_computed_style *style, uint8_t type, css_computed_counter *counter_arr) { - uint32_t *bits = &style->i.uncommon->i.bits[COUNTER_RESET_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[COUNTER_RESET_INDEX]; + /* 1bit: t : type */ *bits = (*bits & ~COUNTER_RESET_MASK) | ((type & 0x1) << COUNTER_RESET_SHIFT); @@ -547,10 +575,12 @@ 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 = &style->i.uncommon->i.bits[CURSOR_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[CURSOR_INDEX]; + /* 5bits: ttttt : type */ *bits = (*bits & ~CURSOR_MASK) | ((type & 0x1f) << CURSOR_SHIFT); @@ -578,16 +608,18 @@ static inline css_error set_cursor(css_computed_style *style, uint8_t type, #undef CURSOR_MASK #define LETTER_SPACING_INDEX 1 -#define LETTER_SPACING_SHIFT 18 -#define LETTER_SPACING_MASK 0x1fc0000 +#define LETTER_SPACING_SHIFT 11 +#define LETTER_SPACING_MASK 0x3f800 static inline css_error set_letter_spacing(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.uncommon->i.bits[LETTER_SPACING_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[LETTER_SPACING_INDEX]; + /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~LETTER_SPACING_MASK) | (((type & 0x3) | (unit << 2)) << LETTER_SPACING_SHIFT); @@ -600,17 +632,19 @@ static inline css_error set_letter_spacing(css_computed_style *style, uint8_t #undef LETTER_SPACING_SHIFT #undef LETTER_SPACING_MASK -#define OUTLINE_COLOR_INDEX 3 -#define OUTLINE_COLOR_SHIFT 18 -#define OUTLINE_COLOR_MASK 0xc0000 +#define OUTLINE_COLOR_INDEX 2 +#define OUTLINE_COLOR_SHIFT 0 +#define OUTLINE_COLOR_MASK 0x3 static inline css_error set_outline_color(css_computed_style *style, uint8_t type, css_color color) { - uint32_t *bits = &style->i.uncommon->i.bits[OUTLINE_COLOR_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[OUTLINE_COLOR_INDEX]; + /* 2bits: tt : type */ *bits = (*bits & ~OUTLINE_COLOR_MASK) | ((type & 0x3) << OUTLINE_COLOR_SHIFT); @@ -624,16 +658,18 @@ static inline css_error set_outline_color(css_computed_style *style, uint8_t #undef OUTLINE_COLOR_MASK #define OUTLINE_WIDTH_INDEX 0 -#define OUTLINE_WIDTH_SHIFT 13 -#define OUTLINE_WIDTH_MASK 0x1fe000 +#define OUTLINE_WIDTH_SHIFT 5 +#define OUTLINE_WIDTH_MASK 0x1fe0 static inline css_error set_outline_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.uncommon->i.bits[OUTLINE_WIDTH_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[OUTLINE_WIDTH_INDEX]; + /* 8bits: uuuuuttt : unit | type */ *bits = (*bits & ~OUTLINE_WIDTH_MASK) | (((type & 0x7) | (unit << 3)) << OUTLINE_WIDTH_SHIFT); @@ -647,16 +683,18 @@ static inline css_error set_outline_width(css_computed_style *style, uint8_t #undef OUTLINE_WIDTH_MASK #define WORD_SPACING_INDEX 1 -#define WORD_SPACING_SHIFT 4 -#define WORD_SPACING_MASK 0x7f0 +#define WORD_SPACING_SHIFT 18 +#define WORD_SPACING_MASK 0x1fc0000 static inline css_error set_word_spacing(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.uncommon->i.bits[WORD_SPACING_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[WORD_SPACING_INDEX]; + /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~WORD_SPACING_MASK) | (((type & 0x3) | (unit << 2)) << WORD_SPACING_SHIFT); @@ -670,16 +708,18 @@ static inline css_error set_word_spacing(css_computed_style *style, uint8_t #undef WORD_SPACING_MASK #define WRITING_MODE_INDEX 3 -#define WRITING_MODE_SHIFT 16 -#define WRITING_MODE_MASK 0x30000 +#define WRITING_MODE_SHIFT 18 +#define WRITING_MODE_MASK 0xc0000 static inline css_error set_writing_mode(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.uncommon->i.bits[WRITING_MODE_INDEX]; + uint32_t *bits; ENSURE_UNCOMMON; + bits = &style->i.uncommon->i.bits[WRITING_MODE_INDEX]; + /* 2bits: tt : type */ *bits = (*bits & ~WRITING_MODE_MASK) | ((type & 0x3) << WRITING_MODE_SHIFT); @@ -692,9 +732,9 @@ static inline css_error set_writing_mode(css_computed_style *style, uint8_t static const css_computed_page default_page = { .bits = { - (CSS_PAGE_BREAK_BEFORE_AUTO << 29) | (CSS_PAGE_BREAK_AFTER_AUTO + (CSS_PAGE_BREAK_AFTER_AUTO << 29) | (CSS_PAGE_BREAK_BEFORE_AUTO << 26) | (CSS_PAGE_BREAK_INSIDE_AUTO << 24) | ( - CSS_WIDOWS_SET << 23) | (CSS_ORPHANS_SET << 22) + CSS_ORPHANS_SET << 23) | (CSS_WIDOWS_SET << 22) }, .orphans = 2 << CSS_RADIX_POINT, .widows = 2 << CSS_RADIX_POINT @@ -712,16 +752,18 @@ static const css_computed_page default_page = { } while(0) \ #define ORPHANS_INDEX 0 -#define ORPHANS_SHIFT 22 -#define ORPHANS_MASK 0x400000 +#define ORPHANS_SHIFT 23 +#define ORPHANS_MASK 0x800000 static inline css_error set_orphans(css_computed_style *style, uint8_t type, int32_t integer) { - uint32_t *bits = &style->page->bits[ORPHANS_INDEX]; + uint32_t *bits; ENSURE_PAGE; + bits = &style->page->bits[ORPHANS_INDEX]; + /* 1bit: t : type */ *bits = (*bits & ~ORPHANS_MASK) | ((type & 0x1) << ORPHANS_SHIFT); @@ -734,16 +776,18 @@ static inline css_error set_orphans(css_computed_style *style, uint8_t type, #undef ORPHANS_MASK #define PAGE_BREAK_AFTER_INDEX 0 -#define PAGE_BREAK_AFTER_SHIFT 26 -#define PAGE_BREAK_AFTER_MASK 0x1c000000 +#define PAGE_BREAK_AFTER_SHIFT 29 +#define PAGE_BREAK_AFTER_MASK 0xe0000000 static inline css_error set_page_break_after(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->page->bits[PAGE_BREAK_AFTER_INDEX]; + uint32_t *bits; ENSURE_PAGE; + bits = &style->page->bits[PAGE_BREAK_AFTER_INDEX]; + /* 3bits: ttt : type */ *bits = (*bits & ~PAGE_BREAK_AFTER_MASK) | ((type & 0x7) << PAGE_BREAK_AFTER_SHIFT); @@ -755,16 +799,18 @@ static inline css_error set_page_break_after(css_computed_style *style, uint8_t #undef PAGE_BREAK_AFTER_MASK #define PAGE_BREAK_BEFORE_INDEX 0 -#define PAGE_BREAK_BEFORE_SHIFT 29 -#define PAGE_BREAK_BEFORE_MASK 0xe0000000 +#define PAGE_BREAK_BEFORE_SHIFT 26 +#define PAGE_BREAK_BEFORE_MASK 0x1c000000 static inline css_error set_page_break_before(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX]; + uint32_t *bits; ENSURE_PAGE; + bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX]; + /* 3bits: ttt : type */ *bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) | ((type & 0x7) << PAGE_BREAK_BEFORE_SHIFT); @@ -782,10 +828,12 @@ 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 = &style->page->bits[PAGE_BREAK_INSIDE_INDEX]; + uint32_t *bits; ENSURE_PAGE; + bits = &style->page->bits[PAGE_BREAK_INSIDE_INDEX]; + /* 2bits: tt : type */ *bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) | ((type & 0x3) << PAGE_BREAK_INSIDE_SHIFT); @@ -797,16 +845,18 @@ static inline css_error set_page_break_inside(css_computed_style *style, #undef PAGE_BREAK_INSIDE_MASK #define WIDOWS_INDEX 0 -#define WIDOWS_SHIFT 23 -#define WIDOWS_MASK 0x800000 +#define WIDOWS_SHIFT 22 +#define WIDOWS_MASK 0x400000 static inline css_error set_widows(css_computed_style *style, uint8_t type, int32_t integer) { - uint32_t *bits = &style->page->bits[WIDOWS_INDEX]; + uint32_t *bits; ENSURE_PAGE; + bits = &style->page->bits[WIDOWS_INDEX]; + /* 1bit: t : type */ *bits = (*bits & ~WIDOWS_MASK) | ((type & 0x1) << WIDOWS_SHIFT); @@ -818,14 +868,16 @@ static inline css_error set_widows(css_computed_style *style, uint8_t type, #undef WIDOWS_SHIFT #undef WIDOWS_MASK -#define ALIGN_CONTENT_INDEX 9 -#define ALIGN_CONTENT_SHIFT 8 -#define ALIGN_CONTENT_MASK 0x700 +#define ALIGN_CONTENT_INDEX 8 +#define ALIGN_CONTENT_SHIFT 29 +#define ALIGN_CONTENT_MASK 0xe0000000 static inline css_error set_align_content(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[ALIGN_CONTENT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[ALIGN_CONTENT_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~ALIGN_CONTENT_MASK) | ((type & 0x7) << @@ -837,13 +889,15 @@ static inline css_error set_align_content(css_computed_style *style, uint8_t #undef ALIGN_CONTENT_SHIFT #undef ALIGN_CONTENT_MASK -#define ALIGN_ITEMS_INDEX 9 -#define ALIGN_ITEMS_SHIFT 17 -#define ALIGN_ITEMS_MASK 0xe0000 +#define ALIGN_ITEMS_INDEX 5 +#define ALIGN_ITEMS_SHIFT 0 +#define ALIGN_ITEMS_MASK 0x7 static inline css_error set_align_items(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[ALIGN_ITEMS_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[ALIGN_ITEMS_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~ALIGN_ITEMS_MASK) | ((type & 0x7) << @@ -855,13 +909,15 @@ static inline css_error set_align_items(css_computed_style *style, uint8_t type) #undef ALIGN_ITEMS_SHIFT #undef ALIGN_ITEMS_MASK -#define ALIGN_SELF_INDEX 9 -#define ALIGN_SELF_SHIFT 23 -#define ALIGN_SELF_MASK 0x3800000 +#define ALIGN_SELF_INDEX 8 +#define ALIGN_SELF_SHIFT 14 +#define ALIGN_SELF_MASK 0x1c000 static inline css_error set_align_self(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[ALIGN_SELF_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[ALIGN_SELF_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~ALIGN_SELF_MASK) | ((type & 0x7) << ALIGN_SELF_SHIFT); @@ -872,14 +928,16 @@ static inline css_error set_align_self(css_computed_style *style, uint8_t type) #undef ALIGN_SELF_SHIFT #undef ALIGN_SELF_MASK -#define BACKGROUND_ATTACHMENT_INDEX 8 +#define BACKGROUND_ATTACHMENT_INDEX 9 #define BACKGROUND_ATTACHMENT_SHIFT 12 #define BACKGROUND_ATTACHMENT_MASK 0x3000 static inline css_error set_background_attachment(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) | ((type & 0x3) << @@ -891,14 +949,16 @@ static inline css_error set_background_attachment(css_computed_style *style, #undef BACKGROUND_ATTACHMENT_SHIFT #undef BACKGROUND_ATTACHMENT_MASK -#define BACKGROUND_COLOR_INDEX 8 -#define BACKGROUND_COLOR_SHIFT 28 -#define BACKGROUND_COLOR_MASK 0x30000000 +#define BACKGROUND_COLOR_INDEX 9 +#define BACKGROUND_COLOR_SHIFT 22 +#define BACKGROUND_COLOR_MASK 0xc00000 static inline css_error set_background_color(css_computed_style *style, uint8_t type, css_color color) { - uint32_t *bits = &style->i.bits[BACKGROUND_COLOR_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BACKGROUND_COLOR_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~BACKGROUND_COLOR_MASK) | ((type & 0x3) << @@ -913,13 +973,15 @@ static inline css_error set_background_color(css_computed_style *style, uint8_t #undef BACKGROUND_COLOR_MASK #define BACKGROUND_IMAGE_INDEX 10 -#define BACKGROUND_IMAGE_SHIFT 26 -#define BACKGROUND_IMAGE_MASK 0x4000000 +#define BACKGROUND_IMAGE_SHIFT 21 +#define BACKGROUND_IMAGE_MASK 0x200000 static inline css_error set_background_image(css_computed_style *style, uint8_t type, lwc_string *string) { - uint32_t *bits = &style->i.bits[BACKGROUND_IMAGE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BACKGROUND_IMAGE_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~BACKGROUND_IMAGE_MASK) | ((type & 0x1) << @@ -950,7 +1012,9 @@ 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 = &style->i.bits[BACKGROUND_POSITION_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BACKGROUND_POSITION_INDEX]; /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */ *bits = (*bits & ~BACKGROUND_POSITION_MASK) | (((type & 0x1) | (unit_b @@ -966,14 +1030,16 @@ static inline css_error set_background_position(css_computed_style *style, #undef BACKGROUND_POSITION_SHIFT #undef BACKGROUND_POSITION_MASK -#define BACKGROUND_REPEAT_INDEX 5 -#define BACKGROUND_REPEAT_SHIFT 0 -#define BACKGROUND_REPEAT_MASK 0x7 +#define BACKGROUND_REPEAT_INDEX 8 +#define BACKGROUND_REPEAT_SHIFT 23 +#define BACKGROUND_REPEAT_MASK 0x3800000 static inline css_error set_background_repeat(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[BACKGROUND_REPEAT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BACKGROUND_REPEAT_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~BACKGROUND_REPEAT_MASK) | ((type & 0x7) << @@ -985,14 +1051,16 @@ static inline css_error set_background_repeat(css_computed_style *style, #undef BACKGROUND_REPEAT_SHIFT #undef BACKGROUND_REPEAT_MASK -#define BORDER_BOTTOM_COLOR_INDEX 8 -#define BORDER_BOTTOM_COLOR_SHIFT 24 -#define BORDER_BOTTOM_COLOR_MASK 0x3000000 +#define BORDER_BOTTOM_COLOR_INDEX 9 +#define BORDER_BOTTOM_COLOR_SHIFT 4 +#define BORDER_BOTTOM_COLOR_MASK 0x30 static inline css_error set_border_bottom_color(css_computed_style *style, uint8_t type, css_color color) { - uint32_t *bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) | ((type & 0x3) << @@ -1006,14 +1074,16 @@ static inline css_error set_border_bottom_color(css_computed_style *style, #undef BORDER_BOTTOM_COLOR_SHIFT #undef BORDER_BOTTOM_COLOR_MASK -#define BORDER_BOTTOM_STYLE_INDEX 3 +#define BORDER_BOTTOM_STYLE_INDEX 2 #define BORDER_BOTTOM_STYLE_SHIFT 0 #define BORDER_BOTTOM_STYLE_MASK 0xf static inline css_error set_border_bottom_style(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX]; /* 4bits: tttt : type */ *bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) | ((type & 0xf) << @@ -1026,13 +1096,15 @@ static inline css_error set_border_bottom_style(css_computed_style *style, #undef BORDER_BOTTOM_STYLE_MASK #define BORDER_BOTTOM_WIDTH_INDEX 0 -#define BORDER_BOTTOM_WIDTH_SHIFT 0 -#define BORDER_BOTTOM_WIDTH_MASK 0xff +#define BORDER_BOTTOM_WIDTH_SHIFT 16 +#define BORDER_BOTTOM_WIDTH_MASK 0xff0000 static inline css_error set_border_bottom_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX]; /* 8bits: uuuuuttt : unit | type */ *bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) | (((type & 0x7) | (unit << @@ -1046,14 +1118,16 @@ static inline css_error set_border_bottom_width(css_computed_style *style, #undef BORDER_BOTTOM_WIDTH_SHIFT #undef BORDER_BOTTOM_WIDTH_MASK -#define BORDER_COLLAPSE_INDEX 8 -#define BORDER_COLLAPSE_SHIFT 4 -#define BORDER_COLLAPSE_MASK 0x30 +#define BORDER_COLLAPSE_INDEX 9 +#define BORDER_COLLAPSE_SHIFT 26 +#define BORDER_COLLAPSE_MASK 0xc000000 static inline css_error set_border_collapse(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[BORDER_COLLAPSE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_COLLAPSE_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~BORDER_COLLAPSE_MASK) | ((type & 0x3) << @@ -1065,14 +1139,16 @@ static inline css_error set_border_collapse(css_computed_style *style, uint8_t #undef BORDER_COLLAPSE_SHIFT #undef BORDER_COLLAPSE_MASK -#define BORDER_LEFT_COLOR_INDEX 7 -#define BORDER_LEFT_COLOR_SHIFT 0 -#define BORDER_LEFT_COLOR_MASK 0x3 +#define BORDER_LEFT_COLOR_INDEX 9 +#define BORDER_LEFT_COLOR_SHIFT 8 +#define BORDER_LEFT_COLOR_MASK 0x300 static inline css_error set_border_left_color(css_computed_style *style, uint8_t type, css_color color) { - uint32_t *bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~BORDER_LEFT_COLOR_MASK) | ((type & 0x3) << @@ -1086,14 +1162,16 @@ static inline css_error set_border_left_color(css_computed_style *style, #undef BORDER_LEFT_COLOR_SHIFT #undef BORDER_LEFT_COLOR_MASK -#define BORDER_LEFT_STYLE_INDEX 6 -#define BORDER_LEFT_STYLE_SHIFT 14 -#define BORDER_LEFT_STYLE_MASK 0x3c000 +#define BORDER_LEFT_STYLE_INDEX 4 +#define BORDER_LEFT_STYLE_SHIFT 0 +#define BORDER_LEFT_STYLE_MASK 0xf static inline css_error set_border_left_style(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX]; /* 4bits: tttt : type */ *bits = (*bits & ~BORDER_LEFT_STYLE_MASK) | ((type & 0xf) << @@ -1106,13 +1184,15 @@ static inline css_error set_border_left_style(css_computed_style *style, #undef BORDER_LEFT_STYLE_MASK #define BORDER_LEFT_WIDTH_INDEX 0 -#define BORDER_LEFT_WIDTH_SHIFT 16 -#define BORDER_LEFT_WIDTH_MASK 0xff0000 +#define BORDER_LEFT_WIDTH_SHIFT 0 +#define BORDER_LEFT_WIDTH_MASK 0xff static inline css_error set_border_left_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX]; /* 8bits: uuuuuttt : unit | type */ *bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) | (((type & 0x7) | (unit << @@ -1126,14 +1206,16 @@ static inline css_error set_border_left_width(css_computed_style *style, #undef BORDER_LEFT_WIDTH_SHIFT #undef BORDER_LEFT_WIDTH_MASK -#define BORDER_RIGHT_COLOR_INDEX 8 -#define BORDER_RIGHT_COLOR_SHIFT 10 -#define BORDER_RIGHT_COLOR_MASK 0xc00 +#define BORDER_RIGHT_COLOR_INDEX 9 +#define BORDER_RIGHT_COLOR_SHIFT 20 +#define BORDER_RIGHT_COLOR_MASK 0x300000 static inline css_error set_border_right_color(css_computed_style *style, uint8_t type, css_color color) { - uint32_t *bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) | ((type & 0x3) << @@ -1147,14 +1229,16 @@ static inline css_error set_border_right_color(css_computed_style *style, #undef BORDER_RIGHT_COLOR_SHIFT #undef BORDER_RIGHT_COLOR_MASK -#define BORDER_RIGHT_STYLE_INDEX 2 -#define BORDER_RIGHT_STYLE_SHIFT 0 -#define BORDER_RIGHT_STYLE_MASK 0xf +#define BORDER_RIGHT_STYLE_INDEX 6 +#define BORDER_RIGHT_STYLE_SHIFT 18 +#define BORDER_RIGHT_STYLE_MASK 0x3c0000 static inline css_error set_border_right_style(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX]; /* 4bits: tttt : type */ *bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) | ((type & 0xf) << @@ -1167,13 +1251,15 @@ static inline css_error set_border_right_style(css_computed_style *style, #undef BORDER_RIGHT_STYLE_MASK #define BORDER_RIGHT_WIDTH_INDEX 0 -#define BORDER_RIGHT_WIDTH_SHIFT 8 -#define BORDER_RIGHT_WIDTH_MASK 0xff00 +#define BORDER_RIGHT_WIDTH_SHIFT 24 +#define BORDER_RIGHT_WIDTH_MASK 0xff000000 static inline css_error set_border_right_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX]; /* 8bits: uuuuuttt : unit | type */ *bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) | (((type & 0x7) | (unit << @@ -1187,14 +1273,16 @@ static inline css_error set_border_right_width(css_computed_style *style, #undef BORDER_RIGHT_WIDTH_SHIFT #undef BORDER_RIGHT_WIDTH_MASK -#define BORDER_TOP_COLOR_INDEX 8 -#define BORDER_TOP_COLOR_SHIFT 22 -#define BORDER_TOP_COLOR_MASK 0xc00000 +#define BORDER_TOP_COLOR_INDEX 9 +#define BORDER_TOP_COLOR_SHIFT 28 +#define BORDER_TOP_COLOR_MASK 0x30000000 static inline css_error set_border_top_color(css_computed_style *style, uint8_t type, css_color color) { - uint32_t *bits = &style->i.bits[BORDER_TOP_COLOR_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_TOP_COLOR_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~BORDER_TOP_COLOR_MASK) | ((type & 0x3) << @@ -1208,14 +1296,16 @@ static inline css_error set_border_top_color(css_computed_style *style, uint8_t #undef BORDER_TOP_COLOR_SHIFT #undef BORDER_TOP_COLOR_MASK -#define BORDER_TOP_STYLE_INDEX 4 +#define BORDER_TOP_STYLE_INDEX 1 #define BORDER_TOP_STYLE_SHIFT 0 #define BORDER_TOP_STYLE_MASK 0xf static inline css_error set_border_top_style(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[BORDER_TOP_STYLE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_TOP_STYLE_INDEX]; /* 4bits: tttt : type */ *bits = (*bits & ~BORDER_TOP_STYLE_MASK) | ((type & 0xf) << @@ -1228,13 +1318,15 @@ static inline css_error set_border_top_style(css_computed_style *style, uint8_t #undef BORDER_TOP_STYLE_MASK #define BORDER_TOP_WIDTH_INDEX 0 -#define BORDER_TOP_WIDTH_SHIFT 24 -#define BORDER_TOP_WIDTH_MASK 0xff000000 +#define BORDER_TOP_WIDTH_SHIFT 8 +#define BORDER_TOP_WIDTH_MASK 0xff00 static inline css_error set_border_top_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX]; /* 8bits: uuuuuttt : unit | type */ *bits = (*bits & ~BORDER_TOP_WIDTH_MASK) | (((type & 0x7) | (unit << @@ -1248,14 +1340,16 @@ static inline css_error set_border_top_width(css_computed_style *style, uint8_t #undef BORDER_TOP_WIDTH_SHIFT #undef BORDER_TOP_WIDTH_MASK -#define BOTTOM_INDEX 1 +#define BOTTOM_INDEX 4 #define BOTTOM_SHIFT 18 #define BOTTOM_MASK 0x1fc0000 static inline css_error set_bottom(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[BOTTOM_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BOTTOM_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~BOTTOM_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1269,13 +1363,15 @@ static inline css_error set_bottom(css_computed_style *style, uint8_t type, #undef BOTTOM_SHIFT #undef BOTTOM_MASK -#define BOX_SIZING_INDEX 8 -#define BOX_SIZING_SHIFT 30 -#define BOX_SIZING_MASK 0xc0000000 +#define BOX_SIZING_INDEX 9 +#define BOX_SIZING_SHIFT 0 +#define BOX_SIZING_MASK 0x3 static inline css_error set_box_sizing(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[BOX_SIZING_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[BOX_SIZING_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~BOX_SIZING_MASK) | ((type & 0x3) << BOX_SIZING_SHIFT); @@ -1287,13 +1383,15 @@ static inline css_error set_box_sizing(css_computed_style *style, uint8_t type) #undef BOX_SIZING_MASK #define CAPTION_SIDE_INDEX 8 -#define CAPTION_SIDE_SHIFT 26 -#define CAPTION_SIDE_MASK 0xc000000 +#define CAPTION_SIDE_SHIFT 0 +#define CAPTION_SIDE_MASK 0x3 static inline css_error set_caption_side(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[CAPTION_SIDE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[CAPTION_SIDE_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~CAPTION_SIDE_MASK) | ((type & 0x3) << @@ -1305,13 +1403,15 @@ static inline css_error set_caption_side(css_computed_style *style, uint8_t #undef CAPTION_SIDE_SHIFT #undef CAPTION_SIDE_MASK -#define CLEAR_INDEX 6 -#define CLEAR_SHIFT 3 -#define CLEAR_MASK 0x38 +#define CLEAR_INDEX 8 +#define CLEAR_SHIFT 8 +#define CLEAR_MASK 0x700 static inline css_error set_clear(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[CLEAR_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[CLEAR_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~CLEAR_MASK) | ((type & 0x7) << CLEAR_SHIFT); @@ -1323,13 +1423,15 @@ static inline css_error set_clear(css_computed_style *style, uint8_t type) #undef CLEAR_MASK #define COLOR_INDEX 10 -#define COLOR_SHIFT 28 -#define COLOR_MASK 0x10000000 +#define COLOR_SHIFT 22 +#define COLOR_MASK 0x400000 static inline css_error set_color(css_computed_style *style, uint8_t type, css_color color) { - uint32_t *bits = &style->i.bits[COLOR_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[COLOR_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~COLOR_MASK) | ((type & 0x1) << COLOR_SHIFT); @@ -1342,13 +1444,15 @@ static inline css_error set_color(css_computed_style *style, uint8_t type, #undef COLOR_SHIFT #undef COLOR_MASK -#define DIRECTION_INDEX 8 -#define DIRECTION_SHIFT 18 -#define DIRECTION_MASK 0xc0000 +#define DIRECTION_INDEX 9 +#define DIRECTION_SHIFT 2 +#define DIRECTION_MASK 0xc static inline css_error set_direction(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[DIRECTION_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[DIRECTION_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~DIRECTION_MASK) | ((type & 0x3) << DIRECTION_SHIFT); @@ -1365,7 +1469,9 @@ 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 = &style->i.bits[DISPLAY_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[DISPLAY_INDEX]; /* 5bits: ttttt : type */ *bits = (*bits & ~DISPLAY_MASK) | ((type & 0x1f) << DISPLAY_SHIFT); @@ -1376,13 +1482,15 @@ static inline css_error set_display(css_computed_style *style, uint8_t type) #undef DISPLAY_SHIFT #undef DISPLAY_MASK -#define EMPTY_CELLS_INDEX 8 -#define EMPTY_CELLS_SHIFT 8 -#define EMPTY_CELLS_MASK 0x300 +#define EMPTY_CELLS_INDEX 9 +#define EMPTY_CELLS_SHIFT 14 +#define EMPTY_CELLS_MASK 0xc000 static inline css_error set_empty_cells(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[EMPTY_CELLS_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[EMPTY_CELLS_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~EMPTY_CELLS_MASK) | ((type & 0x3) << @@ -1394,14 +1502,16 @@ static inline css_error set_empty_cells(css_computed_style *style, uint8_t type) #undef EMPTY_CELLS_SHIFT #undef EMPTY_CELLS_MASK -#define FLEX_BASIS_INDEX 1 +#define FLEX_BASIS_INDEX 2 #define FLEX_BASIS_SHIFT 4 #define FLEX_BASIS_MASK 0x7f0 static inline css_error set_flex_basis(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[FLEX_BASIS_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FLEX_BASIS_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~FLEX_BASIS_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1415,14 +1525,16 @@ static inline css_error set_flex_basis(css_computed_style *style, uint8_t type, #undef FLEX_BASIS_SHIFT #undef FLEX_BASIS_MASK -#define FLEX_DIRECTION_INDEX 9 -#define FLEX_DIRECTION_SHIFT 29 -#define FLEX_DIRECTION_MASK 0xe0000000 +#define FLEX_DIRECTION_INDEX 8 +#define FLEX_DIRECTION_SHIFT 5 +#define FLEX_DIRECTION_MASK 0xe0 static inline css_error set_flex_direction(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[FLEX_DIRECTION_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FLEX_DIRECTION_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~FLEX_DIRECTION_MASK) | ((type & 0x7) << @@ -1434,14 +1546,16 @@ static inline css_error set_flex_direction(css_computed_style *style, uint8_t #undef FLEX_DIRECTION_SHIFT #undef FLEX_DIRECTION_MASK -#define FLEX_GROW_INDEX 9 -#define FLEX_GROW_SHIFT 0 -#define FLEX_GROW_MASK 0x1 +#define FLEX_GROW_INDEX 10 +#define FLEX_GROW_SHIFT 25 +#define FLEX_GROW_MASK 0x2000000 static inline css_error set_flex_grow(css_computed_style *style, uint8_t type, css_fixed fixed) { - uint32_t *bits = &style->i.bits[FLEX_GROW_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FLEX_GROW_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~FLEX_GROW_MASK) | ((type & 0x1) << FLEX_GROW_SHIFT); @@ -1455,13 +1569,15 @@ static inline css_error set_flex_grow(css_computed_style *style, uint8_t type, #undef FLEX_GROW_MASK #define FLEX_SHRINK_INDEX 10 -#define FLEX_SHRINK_SHIFT 29 -#define FLEX_SHRINK_MASK 0x20000000 +#define FLEX_SHRINK_SHIFT 24 +#define FLEX_SHRINK_MASK 0x1000000 static inline css_error set_flex_shrink(css_computed_style *style, uint8_t type, css_fixed fixed) { - uint32_t *bits = &style->i.bits[FLEX_SHRINK_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FLEX_SHRINK_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~FLEX_SHRINK_MASK) | ((type & 0x1) << @@ -1475,13 +1591,15 @@ static inline css_error set_flex_shrink(css_computed_style *style, uint8_t #undef FLEX_SHRINK_SHIFT #undef FLEX_SHRINK_MASK -#define FLEX_WRAP_INDEX 8 -#define FLEX_WRAP_SHIFT 16 -#define FLEX_WRAP_MASK 0x30000 +#define FLEX_WRAP_INDEX 10 +#define FLEX_WRAP_SHIFT 30 +#define FLEX_WRAP_MASK 0xc0000000 static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[FLEX_WRAP_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FLEX_WRAP_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~FLEX_WRAP_MASK) | ((type & 0x3) << FLEX_WRAP_SHIFT); @@ -1492,13 +1610,15 @@ static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type) #undef FLEX_WRAP_SHIFT #undef FLEX_WRAP_MASK -#define FLOAT_INDEX 8 -#define FLOAT_SHIFT 20 -#define FLOAT_MASK 0x300000 +#define FLOAT_INDEX 9 +#define FLOAT_SHIFT 30 +#define FLOAT_MASK 0xc0000000 static inline css_error set_float(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[FLOAT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FLOAT_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~FLOAT_MASK) | ((type & 0x3) << FLOAT_SHIFT); @@ -1509,14 +1629,16 @@ static inline css_error set_float(css_computed_style *style, uint8_t type) #undef FLOAT_SHIFT #undef FLOAT_MASK -#define FONT_FAMILY_INDEX 9 -#define FONT_FAMILY_SHIFT 20 -#define FONT_FAMILY_MASK 0x700000 +#define FONT_FAMILY_INDEX 8 +#define FONT_FAMILY_SHIFT 26 +#define FONT_FAMILY_MASK 0x1c000000 static inline css_error set_font_family(css_computed_style *style, uint8_t type, lwc_string **string_arr) { - uint32_t *bits = &style->i.bits[FONT_FAMILY_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FONT_FAMILY_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~FONT_FAMILY_MASK) | ((type & 0x7) << @@ -1552,7 +1674,9 @@ 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 = &style->i.bits[FONT_SIZE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FONT_SIZE_INDEX]; /* 9bits: uuuuutttt : unit | type */ *bits = (*bits & ~FONT_SIZE_MASK) | (((type & 0xf) | (unit << 4)) << @@ -1566,13 +1690,15 @@ static inline css_error set_font_size(css_computed_style *style, uint8_t type, #undef FONT_SIZE_SHIFT #undef FONT_SIZE_MASK -#define FONT_STYLE_INDEX 8 -#define FONT_STYLE_SHIFT 2 -#define FONT_STYLE_MASK 0xc +#define FONT_STYLE_INDEX 7 +#define FONT_STYLE_SHIFT 0 +#define FONT_STYLE_MASK 0x3 static inline css_error set_font_style(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[FONT_STYLE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FONT_STYLE_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~FONT_STYLE_MASK) | ((type & 0x3) << FONT_STYLE_SHIFT); @@ -1584,13 +1710,15 @@ static inline css_error set_font_style(css_computed_style *style, uint8_t type) #undef FONT_STYLE_MASK #define FONT_VARIANT_INDEX 9 -#define FONT_VARIANT_SHIFT 1 -#define FONT_VARIANT_MASK 0x6 +#define FONT_VARIANT_SHIFT 10 +#define FONT_VARIANT_MASK 0xc00 static inline css_error set_font_variant(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[FONT_VARIANT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FONT_VARIANT_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~FONT_VARIANT_MASK) | ((type & 0x3) << @@ -1603,12 +1731,14 @@ static inline css_error set_font_variant(css_computed_style *style, uint8_t #undef FONT_VARIANT_MASK #define FONT_WEIGHT_INDEX 6 -#define FONT_WEIGHT_SHIFT 18 -#define FONT_WEIGHT_MASK 0x3c0000 +#define FONT_WEIGHT_SHIFT 6 +#define FONT_WEIGHT_MASK 0x3c0 static inline css_error set_font_weight(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[FONT_WEIGHT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[FONT_WEIGHT_INDEX]; /* 4bits: tttt : type */ *bits = (*bits & ~FONT_WEIGHT_MASK) | ((type & 0xf) << @@ -1620,14 +1750,16 @@ static inline css_error set_font_weight(css_computed_style *style, uint8_t type) #undef FONT_WEIGHT_SHIFT #undef FONT_WEIGHT_MASK -#define HEIGHT_INDEX 3 -#define HEIGHT_SHIFT 18 -#define HEIGHT_MASK 0x1fc0000 +#define HEIGHT_INDEX 1 +#define HEIGHT_SHIFT 25 +#define HEIGHT_MASK 0xfe000000 static inline css_error set_height(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[HEIGHT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[HEIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1641,14 +1773,16 @@ static inline css_error set_height(css_computed_style *style, uint8_t type, #undef HEIGHT_SHIFT #undef HEIGHT_MASK -#define JUSTIFY_CONTENT_INDEX 9 -#define JUSTIFY_CONTENT_SHIFT 26 -#define JUSTIFY_CONTENT_MASK 0x1c000000 +#define JUSTIFY_CONTENT_INDEX 8 +#define JUSTIFY_CONTENT_SHIFT 11 +#define JUSTIFY_CONTENT_MASK 0x3800 static inline css_error set_justify_content(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[JUSTIFY_CONTENT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[JUSTIFY_CONTENT_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~JUSTIFY_CONTENT_MASK) | ((type & 0x7) << @@ -1660,14 +1794,16 @@ static inline css_error set_justify_content(css_computed_style *style, uint8_t #undef JUSTIFY_CONTENT_SHIFT #undef JUSTIFY_CONTENT_MASK -#define LEFT_INDEX 3 +#define LEFT_INDEX 4 #define LEFT_SHIFT 25 #define LEFT_MASK 0xfe000000 static inline css_error set_left(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[LEFT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[LEFT_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~LEFT_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1681,14 +1817,16 @@ static inline css_error set_left(css_computed_style *style, uint8_t type, #undef LEFT_SHIFT #undef LEFT_MASK -#define LINE_HEIGHT_INDEX 2 -#define LINE_HEIGHT_SHIFT 4 -#define LINE_HEIGHT_MASK 0x7f0 +#define LINE_HEIGHT_INDEX 3 +#define LINE_HEIGHT_SHIFT 25 +#define LINE_HEIGHT_MASK 0xfe000000 static inline css_error set_line_height(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[LINE_HEIGHT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[LINE_HEIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~LINE_HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1703,13 +1841,15 @@ static inline css_error set_line_height(css_computed_style *style, uint8_t #undef LINE_HEIGHT_MASK #define LIST_STYLE_IMAGE_INDEX 10 -#define LIST_STYLE_IMAGE_SHIFT 25 -#define LIST_STYLE_IMAGE_MASK 0x2000000 +#define LIST_STYLE_IMAGE_SHIFT 20 +#define LIST_STYLE_IMAGE_MASK 0x100000 static inline css_error set_list_style_image(css_computed_style *style, uint8_t type, lwc_string *string) { - uint32_t *bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~LIST_STYLE_IMAGE_MASK) | ((type & 0x1) << @@ -1733,13 +1873,15 @@ static inline css_error set_list_style_image(css_computed_style *style, uint8_t #undef LIST_STYLE_IMAGE_MASK #define LIST_STYLE_POSITION_INDEX 10 -#define LIST_STYLE_POSITION_SHIFT 30 -#define LIST_STYLE_POSITION_MASK 0xc0000000 +#define LIST_STYLE_POSITION_SHIFT 28 +#define LIST_STYLE_POSITION_MASK 0x30000000 static inline css_error set_list_style_position(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[LIST_STYLE_POSITION_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[LIST_STYLE_POSITION_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~LIST_STYLE_POSITION_MASK) | ((type & 0x3) << @@ -1752,13 +1894,15 @@ static inline css_error set_list_style_position(css_computed_style *style, #undef LIST_STYLE_POSITION_MASK #define LIST_STYLE_TYPE_INDEX 6 -#define LIST_STYLE_TYPE_SHIFT 6 -#define LIST_STYLE_TYPE_MASK 0x3c0 +#define LIST_STYLE_TYPE_SHIFT 10 +#define LIST_STYLE_TYPE_MASK 0x3c00 static inline css_error set_list_style_type(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[LIST_STYLE_TYPE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[LIST_STYLE_TYPE_INDEX]; /* 4bits: tttt : type */ *bits = (*bits & ~LIST_STYLE_TYPE_MASK) | ((type & 0xf) << @@ -1771,13 +1915,15 @@ static inline css_error set_list_style_type(css_computed_style *style, uint8_t #undef LIST_STYLE_TYPE_MASK #define MARGIN_BOTTOM_INDEX 2 -#define MARGIN_BOTTOM_SHIFT 25 -#define MARGIN_BOTTOM_MASK 0xfe000000 +#define MARGIN_BOTTOM_SHIFT 18 +#define MARGIN_BOTTOM_MASK 0x1fc0000 static inline css_error set_margin_bottom(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[MARGIN_BOTTOM_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[MARGIN_BOTTOM_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~MARGIN_BOTTOM_MASK) | (((type & 0x3) | (unit << 2)) @@ -1791,14 +1937,16 @@ static inline css_error set_margin_bottom(css_computed_style *style, uint8_t #undef MARGIN_BOTTOM_SHIFT #undef MARGIN_BOTTOM_MASK -#define MARGIN_LEFT_INDEX 3 -#define MARGIN_LEFT_SHIFT 11 -#define MARGIN_LEFT_MASK 0x3f800 +#define MARGIN_LEFT_INDEX 2 +#define MARGIN_LEFT_SHIFT 25 +#define MARGIN_LEFT_MASK 0xfe000000 static inline css_error set_margin_left(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[MARGIN_LEFT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[MARGIN_LEFT_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~MARGIN_LEFT_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1812,14 +1960,16 @@ static inline css_error set_margin_left(css_computed_style *style, uint8_t #undef MARGIN_LEFT_SHIFT #undef MARGIN_LEFT_MASK -#define MARGIN_RIGHT_INDEX 2 -#define MARGIN_RIGHT_SHIFT 11 -#define MARGIN_RIGHT_MASK 0x3f800 +#define MARGIN_RIGHT_INDEX 1 +#define MARGIN_RIGHT_SHIFT 18 +#define MARGIN_RIGHT_MASK 0x1fc0000 static inline css_error set_margin_right(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[MARGIN_RIGHT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[MARGIN_RIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~MARGIN_RIGHT_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1834,13 +1984,15 @@ static inline css_error set_margin_right(css_computed_style *style, uint8_t #undef MARGIN_RIGHT_MASK #define MARGIN_TOP_INDEX 4 -#define MARGIN_TOP_SHIFT 18 -#define MARGIN_TOP_MASK 0x1fc0000 +#define MARGIN_TOP_SHIFT 4 +#define MARGIN_TOP_MASK 0x7f0 static inline css_error set_margin_top(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[MARGIN_TOP_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[MARGIN_TOP_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~MARGIN_TOP_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1854,14 +2006,16 @@ static inline css_error set_margin_top(css_computed_style *style, uint8_t type, #undef MARGIN_TOP_SHIFT #undef MARGIN_TOP_MASK -#define MAX_HEIGHT_INDEX 1 +#define MAX_HEIGHT_INDEX 3 #define MAX_HEIGHT_SHIFT 11 #define MAX_HEIGHT_MASK 0x3f800 static inline css_error set_max_height(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[MAX_HEIGHT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[MAX_HEIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~MAX_HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1875,14 +2029,16 @@ static inline css_error set_max_height(css_computed_style *style, uint8_t type, #undef MAX_HEIGHT_SHIFT #undef MAX_HEIGHT_MASK -#define MAX_WIDTH_INDEX 4 -#define MAX_WIDTH_SHIFT 25 -#define MAX_WIDTH_MASK 0xfe000000 +#define MAX_WIDTH_INDEX 1 +#define MAX_WIDTH_SHIFT 4 +#define MAX_WIDTH_MASK 0x7f0 static inline css_error set_max_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[MAX_WIDTH_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[MAX_WIDTH_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~MAX_WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1896,14 +2052,16 @@ static inline css_error set_max_width(css_computed_style *style, uint8_t type, #undef MAX_WIDTH_SHIFT #undef MAX_WIDTH_MASK -#define MIN_HEIGHT_INDEX 3 -#define MIN_HEIGHT_SHIFT 4 -#define MIN_HEIGHT_MASK 0x7f0 +#define MIN_HEIGHT_INDEX 1 +#define MIN_HEIGHT_SHIFT 11 +#define MIN_HEIGHT_MASK 0x3f800 static inline css_error set_min_height(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[MIN_HEIGHT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[MIN_HEIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~MIN_HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1917,14 +2075,16 @@ static inline css_error set_min_height(css_computed_style *style, uint8_t type, #undef MIN_HEIGHT_SHIFT #undef MIN_HEIGHT_MASK -#define MIN_WIDTH_INDEX 4 -#define MIN_WIDTH_SHIFT 4 -#define MIN_WIDTH_MASK 0x7f0 +#define MIN_WIDTH_INDEX 2 +#define MIN_WIDTH_SHIFT 11 +#define MIN_WIDTH_MASK 0x3f800 static inline css_error set_min_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[MIN_WIDTH_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[MIN_WIDTH_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~MIN_WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << @@ -1939,13 +2099,15 @@ static inline css_error set_min_width(css_computed_style *style, uint8_t type, #undef MIN_WIDTH_MASK #define OPACITY_INDEX 10 -#define OPACITY_SHIFT 24 -#define OPACITY_MASK 0x1000000 +#define OPACITY_SHIFT 27 +#define OPACITY_MASK 0x8000000 static inline css_error set_opacity(css_computed_style *style, uint8_t type, css_fixed fixed) { - uint32_t *bits = &style->i.bits[OPACITY_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[OPACITY_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~OPACITY_MASK) | ((type & 0x1) << OPACITY_SHIFT); @@ -1959,13 +2121,15 @@ static inline css_error set_opacity(css_computed_style *style, uint8_t type, #undef OPACITY_MASK #define ORDER_INDEX 10 -#define ORDER_SHIFT 23 -#define ORDER_MASK 0x800000 +#define ORDER_SHIFT 26 +#define ORDER_MASK 0x4000000 static inline css_error set_order(css_computed_style *style, uint8_t type, int32_t integer) { - uint32_t *bits = &style->i.bits[ORDER_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[ORDER_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~ORDER_MASK) | ((type & 0x1) << ORDER_SHIFT); @@ -1978,14 +2142,16 @@ static inline css_error set_order(css_computed_style *style, uint8_t type, #undef ORDER_SHIFT #undef ORDER_MASK -#define OUTLINE_STYLE_INDEX 1 +#define OUTLINE_STYLE_INDEX 3 #define OUTLINE_STYLE_SHIFT 0 #define OUTLINE_STYLE_MASK 0xf static inline css_error set_outline_style(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[OUTLINE_STYLE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[OUTLINE_STYLE_INDEX]; /* 4bits: tttt : type */ *bits = (*bits & ~OUTLINE_STYLE_MASK) | ((type & 0xf) << @@ -1997,31 +2163,54 @@ static inline css_error set_outline_style(css_computed_style *style, uint8_t #undef OUTLINE_STYLE_SHIFT #undef OUTLINE_STYLE_MASK -#define OVERFLOW_INDEX 9 -#define OVERFLOW_SHIFT 14 -#define OVERFLOW_MASK 0x1c000 +#define OVERFLOW_X_INDEX 8 +#define OVERFLOW_X_SHIFT 2 +#define OVERFLOW_X_MASK 0x1c -static inline css_error set_overflow(css_computed_style *style, uint8_t type) +static inline css_error set_overflow_x(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[OVERFLOW_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[OVERFLOW_X_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~OVERFLOW_MASK) | ((type & 0x7) << OVERFLOW_SHIFT); + *bits = (*bits & ~OVERFLOW_X_MASK) | ((type & 0x7) << OVERFLOW_X_SHIFT); return CSS_OK; } -#undef OVERFLOW_INDEX -#undef OVERFLOW_SHIFT -#undef OVERFLOW_MASK +#undef OVERFLOW_X_INDEX +#undef OVERFLOW_X_SHIFT +#undef OVERFLOW_X_MASK + +#define OVERFLOW_Y_INDEX 6 +#define OVERFLOW_Y_SHIFT 3 +#define OVERFLOW_Y_MASK 0x38 + +static inline css_error set_overflow_y(css_computed_style *style, uint8_t type) +{ + uint32_t *bits; + + bits = &style->i.bits[OVERFLOW_Y_INDEX]; + + /* 3bits: ttt : type */ + *bits = (*bits & ~OVERFLOW_Y_MASK) | ((type & 0x7) << OVERFLOW_Y_SHIFT); + + return CSS_OK; +} +#undef OVERFLOW_Y_INDEX +#undef OVERFLOW_Y_SHIFT +#undef OVERFLOW_Y_MASK #define PADDING_BOTTOM_INDEX 7 -#define PADDING_BOTTOM_SHIFT 8 -#define PADDING_BOTTOM_MASK 0x3f00 +#define PADDING_BOTTOM_SHIFT 14 +#define PADDING_BOTTOM_MASK 0xfc000 static inline css_error set_padding_bottom(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[PADDING_BOTTOM_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[PADDING_BOTTOM_INDEX]; /* 6bits: uuuuut : unit | type */ *bits = (*bits & ~PADDING_BOTTOM_MASK) | (((type & 0x1) | (unit << 1)) @@ -2036,13 +2225,15 @@ static inline css_error set_padding_bottom(css_computed_style *style, uint8_t #undef PADDING_BOTTOM_MASK #define PADDING_LEFT_INDEX 7 -#define PADDING_LEFT_SHIFT 14 -#define PADDING_LEFT_MASK 0xfc000 +#define PADDING_LEFT_SHIFT 8 +#define PADDING_LEFT_MASK 0x3f00 static inline css_error set_padding_left(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[PADDING_LEFT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[PADDING_LEFT_INDEX]; /* 6bits: uuuuut : unit | type */ *bits = (*bits & ~PADDING_LEFT_MASK) | (((type & 0x1) | (unit << 1)) << @@ -2057,13 +2248,15 @@ static inline css_error set_padding_left(css_computed_style *style, uint8_t #undef PADDING_LEFT_MASK #define PADDING_RIGHT_INDEX 7 -#define PADDING_RIGHT_SHIFT 2 -#define PADDING_RIGHT_MASK 0xfc +#define PADDING_RIGHT_SHIFT 20 +#define PADDING_RIGHT_MASK 0x3f00000 static inline css_error set_padding_right(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[PADDING_RIGHT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[PADDING_RIGHT_INDEX]; /* 6bits: uuuuut : unit | type */ *bits = (*bits & ~PADDING_RIGHT_MASK) | (((type & 0x1) | (unit << 1)) @@ -2084,7 +2277,9 @@ 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 = &style->i.bits[PADDING_TOP_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[PADDING_TOP_INDEX]; /* 6bits: uuuuut : unit | type */ *bits = (*bits & ~PADDING_TOP_MASK) | (((type & 0x1) | (unit << 1)) << @@ -2098,13 +2293,15 @@ static inline css_error set_padding_top(css_computed_style *style, uint8_t #undef PADDING_TOP_SHIFT #undef PADDING_TOP_MASK -#define POSITION_INDEX 9 -#define POSITION_SHIFT 11 -#define POSITION_MASK 0x3800 +#define POSITION_INDEX 8 +#define POSITION_SHIFT 17 +#define POSITION_MASK 0xe0000 static inline css_error set_position(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[POSITION_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[POSITION_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~POSITION_MASK) | ((type & 0x7) << POSITION_SHIFT); @@ -2116,13 +2313,15 @@ static inline css_error set_position(css_computed_style *style, uint8_t type) #undef POSITION_MASK #define QUOTES_INDEX 10 -#define QUOTES_SHIFT 27 -#define QUOTES_MASK 0x8000000 +#define QUOTES_SHIFT 23 +#define QUOTES_MASK 0x800000 static inline css_error set_quotes(css_computed_style *style, uint8_t type, lwc_string **string_arr) { - uint32_t *bits = &style->i.bits[QUOTES_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[QUOTES_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~QUOTES_MASK) | ((type & 0x1) << QUOTES_SHIFT); @@ -2157,7 +2356,9 @@ 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 = &style->i.bits[RIGHT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[RIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~RIGHT_MASK) | (((type & 0x3) | (unit << 2)) << @@ -2171,14 +2372,16 @@ static inline css_error set_right(css_computed_style *style, uint8_t type, #undef RIGHT_SHIFT #undef RIGHT_MASK -#define TABLE_LAYOUT_INDEX 8 -#define TABLE_LAYOUT_SHIFT 0 -#define TABLE_LAYOUT_MASK 0x3 +#define TABLE_LAYOUT_INDEX 9 +#define TABLE_LAYOUT_SHIFT 18 +#define TABLE_LAYOUT_MASK 0xc0000 static inline css_error set_table_layout(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[TABLE_LAYOUT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[TABLE_LAYOUT_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~TABLE_LAYOUT_MASK) | ((type & 0x3) << @@ -2191,12 +2394,14 @@ static inline css_error set_table_layout(css_computed_style *style, uint8_t #undef TABLE_LAYOUT_MASK #define TEXT_ALIGN_INDEX 6 -#define TEXT_ALIGN_SHIFT 10 -#define TEXT_ALIGN_MASK 0x3c00 +#define TEXT_ALIGN_SHIFT 14 +#define TEXT_ALIGN_MASK 0x3c000 static inline css_error set_text_align(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[TEXT_ALIGN_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[TEXT_ALIGN_INDEX]; /* 4bits: tttt : type */ *bits = (*bits & ~TEXT_ALIGN_MASK) | ((type & 0xf) << TEXT_ALIGN_SHIFT); @@ -2214,7 +2419,9 @@ 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 = &style->i.bits[TEXT_DECORATION_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[TEXT_DECORATION_INDEX]; /* 5bits: ttttt : type */ *bits = (*bits & ~TEXT_DECORATION_MASK) | ((type & 0x1f) << @@ -2227,13 +2434,15 @@ static inline css_error set_text_decoration(css_computed_style *style, uint8_t #undef TEXT_DECORATION_MASK #define TEXT_INDENT_INDEX 7 -#define TEXT_INDENT_SHIFT 20 -#define TEXT_INDENT_MASK 0x3f00000 +#define TEXT_INDENT_SHIFT 2 +#define TEXT_INDENT_MASK 0xfc static inline css_error set_text_indent(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[TEXT_INDENT_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[TEXT_INDENT_INDEX]; /* 6bits: uuuuut : unit | type */ *bits = (*bits & ~TEXT_INDENT_MASK) | (((type & 0x1) | (unit << 1)) << @@ -2247,14 +2456,16 @@ static inline css_error set_text_indent(css_computed_style *style, uint8_t #undef TEXT_INDENT_SHIFT #undef TEXT_INDENT_MASK -#define TEXT_TRANSFORM_INDEX 6 -#define TEXT_TRANSFORM_SHIFT 0 -#define TEXT_TRANSFORM_MASK 0x7 +#define TEXT_TRANSFORM_INDEX 8 +#define TEXT_TRANSFORM_SHIFT 20 +#define TEXT_TRANSFORM_MASK 0x700000 static inline css_error set_text_transform(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[TEXT_TRANSFORM_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[TEXT_TRANSFORM_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~TEXT_TRANSFORM_MASK) | ((type & 0x7) << @@ -2266,14 +2477,16 @@ static inline css_error set_text_transform(css_computed_style *style, uint8_t #undef TEXT_TRANSFORM_SHIFT #undef TEXT_TRANSFORM_MASK -#define TOP_INDEX 1 -#define TOP_SHIFT 25 -#define TOP_MASK 0xfe000000 +#define TOP_INDEX 3 +#define TOP_SHIFT 4 +#define TOP_MASK 0x7f0 static inline css_error set_top(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[TOP_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[TOP_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~TOP_MASK) | (((type & 0x3) | (unit << 2)) << @@ -2287,14 +2500,16 @@ static inline css_error set_top(css_computed_style *style, uint8_t type, #undef TOP_SHIFT #undef TOP_MASK -#define UNICODE_BIDI_INDEX 8 +#define UNICODE_BIDI_INDEX 9 #define UNICODE_BIDI_SHIFT 6 #define UNICODE_BIDI_MASK 0xc0 static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[UNICODE_BIDI_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[UNICODE_BIDI_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~UNICODE_BIDI_MASK) | ((type & 0x3) << @@ -2313,7 +2528,9 @@ 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 = &style->i.bits[VERTICAL_ALIGN_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[VERTICAL_ALIGN_INDEX]; /* 9bits: uuuuutttt : unit | type */ *bits = (*bits & ~VERTICAL_ALIGN_MASK) | (((type & 0xf) | (unit << 4)) @@ -2328,12 +2545,14 @@ static inline css_error set_vertical_align(css_computed_style *style, uint8_t #undef VERTICAL_ALIGN_MASK #define VISIBILITY_INDEX 9 -#define VISIBILITY_SHIFT 3 -#define VISIBILITY_MASK 0x18 +#define VISIBILITY_SHIFT 16 +#define VISIBILITY_MASK 0x30000 static inline css_error set_visibility(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[VISIBILITY_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[VISIBILITY_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~VISIBILITY_MASK) | ((type & 0x3) << VISIBILITY_SHIFT); @@ -2344,13 +2563,15 @@ static inline css_error set_visibility(css_computed_style *style, uint8_t type) #undef VISIBILITY_SHIFT #undef VISIBILITY_MASK -#define WHITE_SPACE_INDEX 9 -#define WHITE_SPACE_SHIFT 5 -#define WHITE_SPACE_MASK 0xe0 +#define WHITE_SPACE_INDEX 6 +#define WHITE_SPACE_SHIFT 0 +#define WHITE_SPACE_MASK 0x7 static inline css_error set_white_space(css_computed_style *style, uint8_t type) { - uint32_t *bits = &style->i.bits[WHITE_SPACE_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[WHITE_SPACE_INDEX]; /* 3bits: ttt : type */ *bits = (*bits & ~WHITE_SPACE_MASK) | ((type & 0x7) << @@ -2362,14 +2583,16 @@ static inline css_error set_white_space(css_computed_style *style, uint8_t type) #undef WHITE_SPACE_SHIFT #undef WHITE_SPACE_MASK -#define WIDTH_INDEX 2 +#define WIDTH_INDEX 3 #define WIDTH_SHIFT 18 #define WIDTH_MASK 0x1fc0000 static inline css_error set_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { - uint32_t *bits = &style->i.bits[WIDTH_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[WIDTH_INDEX]; /* 7bits: uuuuutt : unit | type */ *bits = (*bits & ~WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << @@ -2383,14 +2606,16 @@ static inline css_error set_width(css_computed_style *style, uint8_t type, #undef WIDTH_SHIFT #undef WIDTH_MASK -#define Z_INDEX_INDEX 8 -#define Z_INDEX_SHIFT 14 -#define Z_INDEX_MASK 0xc000 +#define Z_INDEX_INDEX 9 +#define Z_INDEX_SHIFT 24 +#define Z_INDEX_MASK 0x3000000 static inline css_error set_z_index(css_computed_style *style, uint8_t type, int32_t integer) { - uint32_t *bits = &style->i.bits[Z_INDEX_INDEX]; + uint32_t *bits; + + bits = &style->i.bits[Z_INDEX_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~Z_INDEX_MASK) | ((type & 0x3) << Z_INDEX_SHIFT); diff --git a/src/select/overrides.py b/src/select/overrides.py index 31f2f7c..6c8d6eb 100644 --- a/src/select/overrides.py +++ b/src/select/overrides.py @@ -196,3 +196,36 @@ 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 & 0x7); +}} +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/select_config.py b/src/select/select_config.py index 294ffd1..86d815d 100644 --- a/src/select/select_config.py +++ b/src/select/select_config.py @@ -6,7 +6,7 @@ # Configuration of CSS values values = { ('length', 'css_fixed', 4, '0', - 'unit', 'css_unit', 5, ('0', 'CSS_UNIT_PX')), + 'unit', 'css_unit', 5, 'CSS_UNIT_PX'), ('integer', 'int32_t', 4, '0'), ('fixed', 'css_fixed', 4, '0'), ('color', 'css_color', 4, '0'), @@ -44,7 +44,8 @@ style = { ('justify_content', 3), ('list_style_position', 2), ('list_style_type', 4), - ('overflow', 3), + ('overflow_x', 3), + ('overflow_y', 3), ('outline_style', 4), ('position', 3), ('table_layout', 2), @@ -67,17 +68,17 @@ style = { ('border_right_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'), ('border_bottom_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'), ('border_left_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'), - ('top', 2, 'length', 'CSS_TOP_SET'), - ('right', 2, 'length', 'CSS_RIGHT_SET'), - ('bottom', 2, 'length', 'CSS_BOTTOM_SET'), - ('left', 2, 'length', 'CSS_LEFT_SET'), + ('top', 2, 'length', 'CSS_TOP_SET', None, None, ('get',)), + ('right', 2, 'length', 'CSS_RIGHT_SET', None, None, ('get',)), + ('bottom', 2, 'length', 'CSS_BOTTOM_SET', None, None, ('get',)), + ('left', 2, 'length', 'CSS_LEFT_SET', None, None, ('get',)), ('color', 1, 'color'), ('flex_basis', 2, 'length', 'CSS_FLEX_BASIS_SET'), ('flex_grow', 1, 'fixed', 'CSS_FLEX_GROW_SET'), ('flex_shrink', 1, 'fixed', 'CSS_FLEX_SHRINK_SET'), ('font_size', 4, 'length', 'CSS_FONT_SIZE_DIMENSION'), ('height', 2, 'length', 'CSS_HEIGHT_SET'), - ('line_height', 2, 'length', None, None, None, ('get')), + ('line_height', 2, 'length', None, None, None, ('get',)), ('list_style_image', 1, 'string'), ('margin_top', 2, 'length', 'CSS_MARGIN_SET'), ('margin_right', 2, 'length', 'CSS_MARGIN_SET'), @@ -154,7 +155,7 @@ uncommon = { ('counter_reset', 1, 'counter_arr', None, 'CSS_COUNTER_RESET_NONE', 'Encode counter_reset as an array of name, value pairs, ' 'terminated with a blank entry.'), - ('cursor', 5, 'string_arr', 'CSS_CURSOR_AUTO', 'CSS_CURSOR_INHERIT', + ('cursor', 5, 'string_arr', None, 'CSS_CURSOR_AUTO', 'Encode cursor uri(s) as an array of string objects, terminated ' 'with a blank entry'), ('content', 2, 'content_item', 'CSS_CONTENT_NORMAL', 'CSS_CONTENT_NORMAL', diff --git a/src/select/select_generator.py b/src/select/select_generator.py index a953fbb..75d2e3b 100644 --- a/src/select/select_generator.py +++ b/src/select/select_generator.py @@ -124,17 +124,17 @@ class CSSValue: 'Values to be associated with properties.' def __init__(self, name, css_type, size=None, defaults='NULL', bits_name=None, bits_type=None, - bits_size=None, bits_default='0'): + bits_size=None, bits_defaults='0'): self.name = name self.type = css_type self.size = size # `None` means sizeof(ptr) - self.defaults = get_tuple(defaults) + self.defaults = defaults self.suffix = '' self.bits = None if bits_size is None else { 'name': bits_name, 'type': bits_type, 'size': bits_size, - 'default': bits_default + 'defaults': bits_defaults } @property @@ -165,7 +165,7 @@ class CSSProperty: if x[0] == v[0]: value = CSSValue(*x) if len(v) is 2: - value.defaults = get_tuple(v[1]) + value.defaults = v[1] if len(vals) > 1: value.suffix = '_' + string.ascii_lowercase[i] val_list.append(value) @@ -502,13 +502,17 @@ class CSSGroup: p.name, params)) t.append('{') t.indent(1) - t.append('uint32_t *bits = &style{}->{}bits[{}_INDEX];'.format( - grp, i_dot, p.name.upper())) + t.append('uint32_t *bits;') t.append() + if self.name is not 'style': t.append('ENSURE_{};'.format(self.name.upper())) t.append() + t.append('bits = &style{}->{}bits[{}_INDEX];'.format( + grp, i_dot, p.name.upper())) + t.append() + type_mask, shift_list, bits_comment = p.get_bits() t.append(bits_comment) type_mask = '(type & {})'.format(type_mask) @@ -661,6 +665,11 @@ class CSSGroup: 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) @@ -677,7 +686,7 @@ class CSSGroup: for v in p.values: if defaults: r.append('.{}{} = {}'.format(p.name, v.suffix, - v.defaults[0])) + v.defaults)) else: v_type, v_name = shift_star(v.type, p.name) r.append('{} {}{};'.format(v_type, v_name, v.suffix)) |