From 2f7718d8de04be49dead46665489585cc2a323cb Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 28 Jul 2018 15:23:25 +0100 Subject: Select generator: Squash undefined behaviour in generated code. uint8_t is promoted to int instead of unsigned, so it can't hold the values we try to store. Reran `make select_generator` to update generated code. --- src/select/autogenerated_computed.h | 76 ++-- src/select/autogenerated_propget.h | 404 ++++++++++---------- src/select/autogenerated_propset.h | 742 ++++++++++++++++++------------------ src/select/select_generator.py | 2 +- 4 files changed, 621 insertions(+), 603 deletions(-) (limited to 'src/select') diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h index 11f4808..0c2dff1 100644 --- a/src/select/autogenerated_computed.h +++ b/src/select/autogenerated_computed.h @@ -55,19 +55,18 @@ struct css_computed_uncommon_i { * * Bit allocations: * - * 0 bbbbbbbbbbbccccccccoooooooouuuuu - * border_spacing; column_rule_width; outline_width; cursor + * 0 bbbbbbbbbbbooooooooccccccccuuuuu + * border_spacing; outline_width; column_rule_width; cursor * - * 1 lllllllcccccccooooooowwwwwwwbbbb - * letter_spacing; column_gap; column_width; word_spacing; break_after + * 1 cccccccooooooolllllllwwwwwwwbbbb + * column_width; column_gap; letter_spacing; word_spacing; break_before * - * 2 ccccccccccccccccccccccccccbbbboo - * clip; break_before; column_count + * 2 ccccccccccccccccccccccccccooooll + * clip; column_rule_style; column_rule_color * - * 3 bbbbccccwwoolluunnmmte.......... - * break_inside; column_rule_style; writing_mode; column_span; - * column_rule_color; outline_color; content; column_fill; counter_increment; - * counter_reset + * 3 bbbbrrrrccwwoolluuttne.......... + * break_after; break_inside; content; writing_mode; column_fill; column_span; + * column_count; outline_color; counter_increment; counter_reset */ uint32_t bits[4]; @@ -227,44 +226,45 @@ struct css_computed_style_i { * Bit allocations: * * 0 bbbbbbbboooooooorrrrrrrrdddddddd - * border_bottom_width; border_left_width; border_top_width; border_right_width + * border_top_width; border_bottom_width; border_right_width; border_left_width * - * 1 mmmmmmmaaaaaaawwwwwwwfffffffbbbb - * margin_right; max_width; width; flex_basis; border_top_style + * 1 lllllllrrrrrrrmmmmmmmaaaaaaaoooo + * line_height; right; min_width; margin_left; outline_style * - * 2 mmmmmmmiiiiiiilllllllhhhhhhhbbbb - * margin_bottom; min_width; line_height; height; border_right_style + * 2 mmmmmmmaaaaaaafffffffxxxxxxxtttt + * max_width; margin_right; flex_basis; max_height; text_align * - * 3 lllllllbbbbbbbmmmmmmmiiiiiiissss - * left; bottom; max_height; min_height; list_style_type + * 3 tttttttmmmmmmmiiiiiiiaaaaaaaffff + * top; margin_top; min_height; margin_bottom; font_weight * - * 4 rrrrrrrmmmmmmmtttttttaaaaaaaffff - * right; margin_top; top; margin_left; font_weight + * 4 lllllllwwwwwwwbbbbbbbhhhhhhhoooo + * left; width; bottom; height; border_left_style * - * 5 bbbbbbbbbbbvvvvvvvvvfffffffffwww - * background_position; vertical_align; font_size; white_space + * 5 bbbbbbbbbbbvvvvvvvvvfffffffffppp + * background_position; vertical_align; font_size; position * - * 6 dddddtttttbbbbooooeeeeuuuuaaafff - * display; text_decoration; border_bottom_style; border_left_style; - * text_align; outline_style; background_repeat; flex_direction + * 6 dddddtttttllllbbbboooorrrreeewww + * display; text_decoration; list_style_type; border_right_style; + * border_top_style; border_bottom_style; text_transform; white_space * - * 7 ppppppaaaaaaddddddttttttiiiiiibb - * padding_top; padding_left; padding_right; text_indent; padding_bottom; - * background_color + * 7 ppppppaaaaaaddddddiiiiiittttttff + * padding_left; padding_bottom; padding_top; padding_right; text_indent; + * font_style * - * 8 tttfffoooaaalllpppccciiijjjvvvdd - * text_transform; font_family; overflow_y; align_self; align_items; position; - * clear; align_content; justify_content; overflow_x; direction + * 8 ooofffaaalllbbbiiieeejjjvvvcccrr + * overflow_y; font_family; align_items; align_self; background_repeat; + * align_content; flex_direction; justify_content; overflow_x; clear; + * border_top_color * - * 9 ttbbaazzffllvvooFFeeccrrnnuuxxii - * table_layout; border_right_color; background_attachment; z_index; - * font_style; flex_wrap; visibility; border_top_color; float; empty_cells; - * caption_side; border_bottom_color; font_variant; unicode_bidi; box_sizing; - * list_style_position + * 9 bbffoorrddcceeuuaaxxnnllkkttiiyy + * border_right_color; flex_wrap; border_collapse; border_left_color; + * direction; caption_side; empty_cells; unicode_bidi; background_color; + * box_sizing; font_variant; float; background_attachment; border_bottom_color; + * list_style_position; table_layout * - * 10 bbooaclqfrpe.................... - * border_left_color; border_collapse; background_image; color; - * list_style_image; quotes; flex_grow; order; opacity; flex_shrink + * 10 zzvvolbcfpeq.................... + * z_index; visibility; order; list_style_image; background_image; color; + * flex_shrink; opacity; flex_grow; quotes */ uint32_t bits[11]; diff --git a/src/select/autogenerated_propget.h b/src/select/autogenerated_propget.h index 202f7de..5c63c5e 100644 --- a/src/select/autogenerated_propget.h +++ b/src/select/autogenerated_propget.h @@ -40,9 +40,9 @@ static inline uint8_t get_border_spacing(const css_computed_style *style, #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) { @@ -62,9 +62,9 @@ static inline uint8_t get_break_after(const css_computed_style *style) #undef BREAK_AFTER_SHIFT #undef BREAK_AFTER_MASK -#define BREAK_BEFORE_INDEX 2 -#define BREAK_BEFORE_SHIFT 2 -#define BREAK_BEFORE_MASK 0x3c +#define BREAK_BEFORE_INDEX 1 +#define BREAK_BEFORE_SHIFT 0 +#define BREAK_BEFORE_MASK 0xf static inline uint8_t get_break_before(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -85,8 +85,8 @@ static inline uint8_t get_break_before(const css_computed_style *style) #undef BREAK_BEFORE_MASK #define BREAK_INSIDE_INDEX 3 -#define BREAK_INSIDE_SHIFT 28 -#define BREAK_INSIDE_MASK 0xf0000000 +#define BREAK_INSIDE_SHIFT 24 +#define BREAK_INSIDE_MASK 0xf000000 static inline uint8_t get_break_inside(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -153,9 +153,9 @@ static inline uint8_t get_clip( #undef CLIP_SHIFT #undef CLIP_MASK -#define COLUMN_COUNT_INDEX 2 -#define COLUMN_COUNT_SHIFT 0 -#define COLUMN_COUNT_MASK 0x3 +#define COLUMN_COUNT_INDEX 3 +#define COLUMN_COUNT_SHIFT 14 +#define COLUMN_COUNT_MASK 0xc000 static inline uint8_t get_column_count(const css_computed_style *style, int32_t *integer) { @@ -179,8 +179,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 12 -#define COLUMN_FILL_MASK 0x3000 +#define COLUMN_FILL_SHIFT 18 +#define COLUMN_FILL_MASK 0xc0000 static inline uint8_t get_column_fill(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -229,9 +229,9 @@ static inline uint8_t get_column_gap(const css_computed_style *style, css_fixed #undef COLUMN_GAP_SHIFT #undef COLUMN_GAP_MASK -#define COLUMN_RULE_COLOR_INDEX 3 -#define COLUMN_RULE_COLOR_SHIFT 18 -#define COLUMN_RULE_COLOR_MASK 0xc0000 +#define COLUMN_RULE_COLOR_INDEX 2 +#define COLUMN_RULE_COLOR_SHIFT 0 +#define COLUMN_RULE_COLOR_MASK 0x3 static inline uint8_t get_column_rule_color(const css_computed_style *style, css_color *color) { @@ -255,9 +255,9 @@ static inline uint8_t get_column_rule_color(const css_computed_style *style, #undef COLUMN_RULE_COLOR_SHIFT #undef COLUMN_RULE_COLOR_MASK -#define COLUMN_RULE_STYLE_INDEX 3 -#define COLUMN_RULE_STYLE_SHIFT 24 -#define COLUMN_RULE_STYLE_MASK 0xf000000 +#define COLUMN_RULE_STYLE_INDEX 2 +#define COLUMN_RULE_STYLE_SHIFT 2 +#define COLUMN_RULE_STYLE_MASK 0x3c static inline uint8_t get_column_rule_style(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -279,8 +279,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 13 -#define COLUMN_RULE_WIDTH_MASK 0x1fe000 +#define COLUMN_RULE_WIDTH_SHIFT 5 +#define COLUMN_RULE_WIDTH_MASK 0x1fe0 static inline uint8_t get_column_rule_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -309,8 +309,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 20 -#define COLUMN_SPAN_MASK 0x300000 +#define COLUMN_SPAN_SHIFT 16 +#define COLUMN_SPAN_MASK 0x30000 static inline uint8_t get_column_span(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -331,8 +331,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 11 -#define COLUMN_WIDTH_MASK 0x3f800 +#define COLUMN_WIDTH_SHIFT 25 +#define COLUMN_WIDTH_MASK 0xfe000000 static inline uint8_t get_column_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -360,8 +360,8 @@ static inline uint8_t get_column_width(const css_computed_style *style, #undef COLUMN_WIDTH_MASK #define CONTENT_INDEX 3 -#define CONTENT_SHIFT 14 -#define CONTENT_MASK 0xc000 +#define CONTENT_SHIFT 22 +#define CONTENT_MASK 0xc00000 static inline uint8_t get_content(const css_computed_style *style, const css_computed_content_item **content_item) { @@ -463,8 +463,8 @@ static inline uint8_t get_cursor(const css_computed_style *style, lwc_string #undef CURSOR_MASK #define LETTER_SPACING_INDEX 1 -#define LETTER_SPACING_SHIFT 25 -#define LETTER_SPACING_MASK 0xfe000000 +#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) { @@ -492,8 +492,8 @@ static inline uint8_t get_letter_spacing(const css_computed_style *style, #undef LETTER_SPACING_MASK #define OUTLINE_COLOR_INDEX 3 -#define OUTLINE_COLOR_SHIFT 16 -#define OUTLINE_COLOR_MASK 0x30000 +#define OUTLINE_COLOR_SHIFT 12 +#define OUTLINE_COLOR_MASK 0x3000 static inline uint8_t get_outline_color(const css_computed_style *style, css_color *color) { @@ -519,8 +519,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 5 -#define OUTLINE_WIDTH_MASK 0x1fe0 +#define OUTLINE_WIDTH_SHIFT 13 +#define OUTLINE_WIDTH_MASK 0x1fe000 static inline uint8_t get_outline_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -577,8 +577,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 22 -#define WRITING_MODE_MASK 0xc00000 +#define WRITING_MODE_SHIFT 20 +#define WRITING_MODE_MASK 0x300000 static inline uint8_t get_writing_mode(const css_computed_style *style) { if (style->i.uncommon != NULL) { @@ -715,8 +715,8 @@ static inline uint8_t get_widows(const css_computed_style *style, int32_t #undef WIDOWS_MASK #define ALIGN_CONTENT_INDEX 8 -#define ALIGN_CONTENT_SHIFT 8 -#define ALIGN_CONTENT_MASK 0x700 +#define ALIGN_CONTENT_SHIFT 14 +#define ALIGN_CONTENT_MASK 0x1c000 static inline uint8_t get_align_content(const css_computed_style *style) { uint32_t bits = style->i.bits[ALIGN_CONTENT_INDEX]; @@ -732,8 +732,8 @@ static inline uint8_t get_align_content(const css_computed_style *style) #undef ALIGN_CONTENT_MASK #define ALIGN_ITEMS_INDEX 8 -#define ALIGN_ITEMS_SHIFT 17 -#define ALIGN_ITEMS_MASK 0xe0000 +#define ALIGN_ITEMS_SHIFT 23 +#define ALIGN_ITEMS_MASK 0x3800000 static inline uint8_t get_align_items(const css_computed_style *style) { uint32_t bits = style->i.bits[ALIGN_ITEMS_INDEX]; @@ -766,8 +766,8 @@ static inline uint8_t get_align_self(const css_computed_style *style) #undef ALIGN_SELF_MASK #define BACKGROUND_ATTACHMENT_INDEX 9 -#define BACKGROUND_ATTACHMENT_SHIFT 26 -#define BACKGROUND_ATTACHMENT_MASK 0xc000000 +#define BACKGROUND_ATTACHMENT_SHIFT 6 +#define BACKGROUND_ATTACHMENT_MASK 0xc0 static inline uint8_t get_background_attachment(const css_computed_style *style) { uint32_t bits = style->i.bits[BACKGROUND_ATTACHMENT_INDEX]; @@ -782,9 +782,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 7 -#define BACKGROUND_COLOR_SHIFT 0 -#define BACKGROUND_COLOR_MASK 0x3 +#define BACKGROUND_COLOR_INDEX 9 +#define BACKGROUND_COLOR_SHIFT 14 +#define BACKGROUND_COLOR_MASK 0xc000 static inline uint8_t get_background_color(const css_computed_style *style, css_color *color) { @@ -802,8 +802,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 27 -#define BACKGROUND_IMAGE_MASK 0x8000000 +#define BACKGROUND_IMAGE_SHIFT 25 +#define BACKGROUND_IMAGE_MASK 0x2000000 static inline uint8_t get_background_image(const css_computed_style *style, lwc_string **string) { @@ -845,9 +845,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 6 -#define BACKGROUND_REPEAT_SHIFT 3 -#define BACKGROUND_REPEAT_MASK 0x38 +#define BACKGROUND_REPEAT_INDEX 8 +#define BACKGROUND_REPEAT_SHIFT 17 +#define BACKGROUND_REPEAT_MASK 0xe0000 static inline uint8_t get_background_repeat(const css_computed_style *style) { uint32_t bits = style->i.bits[BACKGROUND_REPEAT_INDEX]; @@ -863,8 +863,8 @@ static inline uint8_t get_background_repeat(const css_computed_style *style) #undef BACKGROUND_REPEAT_MASK #define BORDER_BOTTOM_COLOR_INDEX 9 -#define BORDER_BOTTOM_COLOR_SHIFT 8 -#define BORDER_BOTTOM_COLOR_MASK 0x300 +#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) { @@ -882,8 +882,8 @@ static inline uint8_t get_border_bottom_color(const css_computed_style *style, #undef BORDER_BOTTOM_COLOR_MASK #define BORDER_BOTTOM_STYLE_INDEX 6 -#define BORDER_BOTTOM_STYLE_SHIFT 18 -#define BORDER_BOTTOM_STYLE_MASK 0x3c0000 +#define BORDER_BOTTOM_STYLE_SHIFT 6 +#define BORDER_BOTTOM_STYLE_MASK 0x3c0 static inline uint8_t get_border_bottom_style(const css_computed_style *style) { uint32_t bits = style->i.bits[BORDER_BOTTOM_STYLE_INDEX]; @@ -899,8 +899,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 24 -#define BORDER_BOTTOM_WIDTH_MASK 0xff000000 +#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) { @@ -920,9 +920,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 10 -#define BORDER_COLLAPSE_SHIFT 28 -#define BORDER_COLLAPSE_MASK 0x30000000 +#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]; @@ -937,9 +937,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 10 -#define BORDER_LEFT_COLOR_SHIFT 30 -#define BORDER_LEFT_COLOR_MASK 0xc0000000 +#define BORDER_LEFT_COLOR_INDEX 9 +#define BORDER_LEFT_COLOR_SHIFT 24 +#define BORDER_LEFT_COLOR_MASK 0x3000000 static inline uint8_t get_border_left_color(const css_computed_style *style, css_color *color) { @@ -956,9 +956,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]; @@ -974,8 +974,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) { @@ -996,8 +996,8 @@ static inline uint8_t get_border_left_width(const css_computed_style *style, #undef BORDER_LEFT_WIDTH_MASK #define BORDER_RIGHT_COLOR_INDEX 9 -#define BORDER_RIGHT_COLOR_SHIFT 28 -#define BORDER_RIGHT_COLOR_MASK 0x30000000 +#define BORDER_RIGHT_COLOR_SHIFT 30 +#define BORDER_RIGHT_COLOR_MASK 0xc0000000 static inline uint8_t get_border_right_color(const css_computed_style *style, css_color *color) { @@ -1014,9 +1014,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 14 +#define BORDER_RIGHT_STYLE_MASK 0x3c000 static inline uint8_t get_border_right_style(const css_computed_style *style) { uint32_t bits = style->i.bits[BORDER_RIGHT_STYLE_INDEX]; @@ -1032,8 +1032,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 0 -#define BORDER_RIGHT_WIDTH_MASK 0xff +#define BORDER_RIGHT_WIDTH_SHIFT 8 +#define BORDER_RIGHT_WIDTH_MASK 0xff00 static inline uint8_t get_border_right_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1053,9 +1053,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 9 -#define BORDER_TOP_COLOR_SHIFT 16 -#define BORDER_TOP_COLOR_MASK 0x30000 +#define BORDER_TOP_COLOR_INDEX 8 +#define BORDER_TOP_COLOR_SHIFT 0 +#define BORDER_TOP_COLOR_MASK 0x3 static inline uint8_t get_border_top_color(const css_computed_style *style, css_color *color) { @@ -1072,9 +1072,9 @@ 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 1 -#define BORDER_TOP_STYLE_SHIFT 0 -#define BORDER_TOP_STYLE_MASK 0xf +#define BORDER_TOP_STYLE_INDEX 6 +#define BORDER_TOP_STYLE_SHIFT 10 +#define BORDER_TOP_STYLE_MASK 0x3c00 static inline uint8_t get_border_top_style(const css_computed_style *style) { uint32_t bits = style->i.bits[BORDER_TOP_STYLE_INDEX]; @@ -1090,8 +1090,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 8 -#define BORDER_TOP_WIDTH_MASK 0xff00 +#define BORDER_TOP_WIDTH_SHIFT 24 +#define BORDER_TOP_WIDTH_MASK 0xff000000 static inline uint8_t get_border_top_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1111,9 +1111,9 @@ 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 3 -#define BOTTOM_SHIFT 18 -#define BOTTOM_MASK 0x1fc0000 +#define BOTTOM_INDEX 4 +#define BOTTOM_SHIFT 11 +#define BOTTOM_MASK 0x3f800 static inline uint8_t get_bottom( const css_computed_style *style, css_fixed *length, css_unit *unit) @@ -1145,8 +1145,8 @@ static inline uint8_t get_bottom_bits( #undef BOTTOM_MASK #define BOX_SIZING_INDEX 9 -#define BOX_SIZING_SHIFT 2 -#define BOX_SIZING_MASK 0xc +#define BOX_SIZING_SHIFT 12 +#define BOX_SIZING_MASK 0x3000 static inline uint8_t get_box_sizing(const css_computed_style *style) { uint32_t bits = style->i.bits[BOX_SIZING_INDEX]; @@ -1162,8 +1162,8 @@ static inline uint8_t get_box_sizing(const css_computed_style *style) #undef BOX_SIZING_MASK #define CAPTION_SIDE_INDEX 9 -#define CAPTION_SIDE_SHIFT 10 -#define CAPTION_SIDE_MASK 0xc00 +#define CAPTION_SIDE_SHIFT 20 +#define CAPTION_SIDE_MASK 0x300000 static inline uint8_t get_caption_side(const css_computed_style *style) { uint32_t bits = style->i.bits[CAPTION_SIDE_INDEX]; @@ -1179,8 +1179,8 @@ static inline uint8_t get_caption_side(const css_computed_style *style) #undef CAPTION_SIDE_MASK #define CLEAR_INDEX 8 -#define CLEAR_SHIFT 11 -#define CLEAR_MASK 0x3800 +#define CLEAR_SHIFT 2 +#define CLEAR_MASK 0x1c static inline uint8_t get_clear(const css_computed_style *style) { uint32_t bits = style->i.bits[CLEAR_INDEX]; @@ -1196,8 +1196,8 @@ static inline uint8_t get_clear(const css_computed_style *style) #undef CLEAR_MASK #define COLOR_INDEX 10 -#define COLOR_SHIFT 26 -#define COLOR_MASK 0x4000000 +#define COLOR_SHIFT 24 +#define COLOR_MASK 0x1000000 static inline uint8_t get_color(const css_computed_style *style, css_color *color) { @@ -1214,9 +1214,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 0 -#define DIRECTION_MASK 0x3 +#define DIRECTION_INDEX 9 +#define DIRECTION_SHIFT 22 +#define DIRECTION_MASK 0xc00000 static inline uint8_t get_direction(const css_computed_style *style) { uint32_t bits = style->i.bits[DIRECTION_INDEX]; @@ -1249,8 +1249,8 @@ static inline uint8_t get_display(const css_computed_style *style) #undef DISPLAY_MASK #define EMPTY_CELLS_INDEX 9 -#define EMPTY_CELLS_SHIFT 12 -#define EMPTY_CELLS_MASK 0x3000 +#define EMPTY_CELLS_SHIFT 18 +#define EMPTY_CELLS_MASK 0xc0000 static inline uint8_t get_empty_cells(const css_computed_style *style) { uint32_t bits = style->i.bits[EMPTY_CELLS_INDEX]; @@ -1265,9 +1265,9 @@ 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_SHIFT 4 -#define FLEX_BASIS_MASK 0x7f0 +#define FLEX_BASIS_INDEX 2 +#define FLEX_BASIS_SHIFT 11 +#define FLEX_BASIS_MASK 0x3f800 static inline uint8_t get_flex_basis(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1287,9 +1287,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 6 -#define FLEX_DIRECTION_SHIFT 0 -#define FLEX_DIRECTION_MASK 0x7 +#define FLEX_DIRECTION_INDEX 8 +#define FLEX_DIRECTION_SHIFT 11 +#define FLEX_DIRECTION_MASK 0x3800 static inline uint8_t get_flex_direction(const css_computed_style *style) { uint32_t bits = style->i.bits[FLEX_DIRECTION_INDEX]; @@ -1305,8 +1305,8 @@ static inline uint8_t get_flex_direction(const css_computed_style *style) #undef FLEX_DIRECTION_MASK #define FLEX_GROW_INDEX 10 -#define FLEX_GROW_SHIFT 23 -#define FLEX_GROW_MASK 0x800000 +#define FLEX_GROW_SHIFT 21 +#define FLEX_GROW_MASK 0x200000 static inline uint8_t get_flex_grow(const css_computed_style *style, css_fixed *fixed) { @@ -1326,8 +1326,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 20 -#define FLEX_SHRINK_MASK 0x100000 +#define FLEX_SHRINK_SHIFT 23 +#define FLEX_SHRINK_MASK 0x800000 static inline uint8_t get_flex_shrink(const css_computed_style *style, css_fixed *fixed) { @@ -1347,8 +1347,8 @@ static inline uint8_t get_flex_shrink(const css_computed_style *style, #undef FLEX_SHRINK_MASK #define FLEX_WRAP_INDEX 9 -#define FLEX_WRAP_SHIFT 20 -#define FLEX_WRAP_MASK 0x300000 +#define FLEX_WRAP_SHIFT 28 +#define FLEX_WRAP_MASK 0x30000000 static inline uint8_t get_flex_wrap(const css_computed_style *style) { uint32_t bits = style->i.bits[FLEX_WRAP_INDEX]; @@ -1364,8 +1364,8 @@ static inline uint8_t get_flex_wrap(const css_computed_style *style) #undef FLEX_WRAP_MASK #define FLOAT_INDEX 9 -#define FLOAT_SHIFT 14 -#define FLOAT_MASK 0xc000 +#define FLOAT_SHIFT 8 +#define FLOAT_MASK 0x300 static inline uint8_t get_float(const css_computed_style *style) { uint32_t bits = style->i.bits[FLOAT_INDEX]; @@ -1421,9 +1421,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 9 -#define FONT_STYLE_SHIFT 22 -#define FONT_STYLE_MASK 0xc00000 +#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]; @@ -1439,8 +1439,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 6 -#define FONT_VARIANT_MASK 0xc0 +#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]; @@ -1455,7 +1455,7 @@ static inline uint8_t get_font_variant(const css_computed_style *style) #undef FONT_VARIANT_SHIFT #undef FONT_VARIANT_MASK -#define FONT_WEIGHT_INDEX 4 +#define FONT_WEIGHT_INDEX 3 #define FONT_WEIGHT_SHIFT 0 #define FONT_WEIGHT_MASK 0xf static inline uint8_t get_font_weight(const css_computed_style *style) @@ -1472,7 +1472,7 @@ static inline uint8_t get_font_weight(const css_computed_style *style) #undef FONT_WEIGHT_SHIFT #undef FONT_WEIGHT_MASK -#define HEIGHT_INDEX 2 +#define HEIGHT_INDEX 4 #define HEIGHT_SHIFT 4 #define HEIGHT_MASK 0x7f0 static inline uint8_t get_height(const css_computed_style *style, css_fixed @@ -1495,8 +1495,8 @@ static inline uint8_t get_height(const css_computed_style *style, css_fixed #undef HEIGHT_MASK #define JUSTIFY_CONTENT_INDEX 8 -#define JUSTIFY_CONTENT_SHIFT 5 -#define JUSTIFY_CONTENT_MASK 0xe0 +#define JUSTIFY_CONTENT_SHIFT 8 +#define JUSTIFY_CONTENT_MASK 0x700 static inline uint8_t get_justify_content(const css_computed_style *style) { uint32_t bits = style->i.bits[JUSTIFY_CONTENT_INDEX]; @@ -1511,7 +1511,7 @@ 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( @@ -1544,9 +1544,9 @@ static inline uint8_t get_left_bits( #undef LEFT_SHIFT #undef LEFT_MASK -#define LINE_HEIGHT_INDEX 2 -#define LINE_HEIGHT_SHIFT 11 -#define LINE_HEIGHT_MASK 0x3f800 +#define LINE_HEIGHT_INDEX 1 +#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) @@ -1572,8 +1572,8 @@ static inline uint8_t get_line_height( #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 26 +#define LIST_STYLE_IMAGE_MASK 0x4000000 static inline uint8_t get_list_style_image(const css_computed_style *style, lwc_string **string) { @@ -1591,8 +1591,8 @@ static inline uint8_t get_list_style_image(const css_computed_style *style, #undef LIST_STYLE_IMAGE_MASK #define LIST_STYLE_POSITION_INDEX 9 -#define LIST_STYLE_POSITION_SHIFT 0 -#define LIST_STYLE_POSITION_MASK 0x3 +#define LIST_STYLE_POSITION_SHIFT 2 +#define LIST_STYLE_POSITION_MASK 0xc static inline uint8_t get_list_style_position(const css_computed_style *style) { uint32_t bits = style->i.bits[LIST_STYLE_POSITION_INDEX]; @@ -1607,9 +1607,9 @@ static inline uint8_t get_list_style_position(const css_computed_style *style) #undef LIST_STYLE_POSITION_SHIFT #undef LIST_STYLE_POSITION_MASK -#define LIST_STYLE_TYPE_INDEX 3 -#define LIST_STYLE_TYPE_SHIFT 0 -#define LIST_STYLE_TYPE_MASK 0xf +#define LIST_STYLE_TYPE_INDEX 6 +#define LIST_STYLE_TYPE_SHIFT 18 +#define LIST_STYLE_TYPE_MASK 0x3c0000 static inline uint8_t get_list_style_type(const css_computed_style *style) { uint32_t bits = style->i.bits[LIST_STYLE_TYPE_INDEX]; @@ -1624,9 +1624,9 @@ static inline uint8_t get_list_style_type(const css_computed_style *style) #undef LIST_STYLE_TYPE_SHIFT #undef LIST_STYLE_TYPE_MASK -#define MARGIN_BOTTOM_INDEX 2 -#define MARGIN_BOTTOM_SHIFT 25 -#define MARGIN_BOTTOM_MASK 0xfe000000 +#define MARGIN_BOTTOM_INDEX 3 +#define MARGIN_BOTTOM_SHIFT 4 +#define MARGIN_BOTTOM_MASK 0x7f0 static inline uint8_t get_margin_bottom(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1646,7 +1646,7 @@ static inline uint8_t get_margin_bottom(const css_computed_style *style, #undef MARGIN_BOTTOM_SHIFT #undef MARGIN_BOTTOM_MASK -#define MARGIN_LEFT_INDEX 4 +#define MARGIN_LEFT_INDEX 1 #define MARGIN_LEFT_SHIFT 4 #define MARGIN_LEFT_MASK 0x7f0 static inline uint8_t get_margin_left(const css_computed_style *style, @@ -1668,9 +1668,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 1 -#define MARGIN_RIGHT_SHIFT 25 -#define MARGIN_RIGHT_MASK 0xfe000000 +#define MARGIN_RIGHT_INDEX 2 +#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) { @@ -1690,7 +1690,7 @@ static inline uint8_t get_margin_right(const css_computed_style *style, #undef MARGIN_RIGHT_SHIFT #undef MARGIN_RIGHT_MASK -#define MARGIN_TOP_INDEX 4 +#define MARGIN_TOP_INDEX 3 #define MARGIN_TOP_SHIFT 18 #define MARGIN_TOP_MASK 0x1fc0000 static inline uint8_t get_margin_top(const css_computed_style *style, css_fixed @@ -1712,9 +1712,9 @@ 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 3 -#define MAX_HEIGHT_SHIFT 11 -#define MAX_HEIGHT_MASK 0x3f800 +#define MAX_HEIGHT_INDEX 2 +#define MAX_HEIGHT_SHIFT 4 +#define MAX_HEIGHT_MASK 0x7f0 static inline uint8_t get_max_height(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1734,9 +1734,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 1 -#define MAX_WIDTH_SHIFT 18 -#define MAX_WIDTH_MASK 0x1fc0000 +#define MAX_WIDTH_INDEX 2 +#define MAX_WIDTH_SHIFT 25 +#define MAX_WIDTH_MASK 0xfe000000 static inline uint8_t get_max_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1757,8 +1757,8 @@ static inline uint8_t get_max_width(const css_computed_style *style, css_fixed #undef MAX_WIDTH_MASK #define MIN_HEIGHT_INDEX 3 -#define MIN_HEIGHT_SHIFT 4 -#define MIN_HEIGHT_MASK 0x7f0 +#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) { @@ -1778,9 +1778,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 2 -#define MIN_WIDTH_SHIFT 18 -#define MIN_WIDTH_MASK 0x1fc0000 +#define MIN_WIDTH_INDEX 1 +#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) { @@ -1801,8 +1801,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 21 -#define OPACITY_MASK 0x200000 +#define OPACITY_SHIFT 22 +#define OPACITY_MASK 0x400000 static inline uint8_t get_opacity(const css_computed_style *style, css_fixed *fixed) { @@ -1822,8 +1822,8 @@ static inline uint8_t get_opacity(const css_computed_style *style, css_fixed #undef OPACITY_MASK #define ORDER_INDEX 10 -#define ORDER_SHIFT 22 -#define ORDER_MASK 0x400000 +#define ORDER_SHIFT 27 +#define ORDER_MASK 0x8000000 static inline uint8_t get_order(const css_computed_style *style, int32_t *integer) { @@ -1842,9 +1842,9 @@ static inline uint8_t get_order(const css_computed_style *style, int32_t #undef ORDER_SHIFT #undef ORDER_MASK -#define OUTLINE_STYLE_INDEX 6 -#define OUTLINE_STYLE_SHIFT 6 -#define OUTLINE_STYLE_MASK 0x3c0 +#define OUTLINE_STYLE_INDEX 1 +#define OUTLINE_STYLE_SHIFT 0 +#define OUTLINE_STYLE_MASK 0xf static inline uint8_t get_outline_style(const css_computed_style *style) { uint32_t bits = style->i.bits[OUTLINE_STYLE_INDEX]; @@ -1860,8 +1860,8 @@ static inline uint8_t get_outline_style(const css_computed_style *style) #undef OUTLINE_STYLE_MASK #define OVERFLOW_X_INDEX 8 -#define OVERFLOW_X_SHIFT 2 -#define OVERFLOW_X_MASK 0x1c +#define OVERFLOW_X_SHIFT 5 +#define OVERFLOW_X_MASK 0xe0 static inline uint8_t get_overflow_x(const css_computed_style *style) { uint32_t bits = style->i.bits[OVERFLOW_X_INDEX]; @@ -1877,8 +1877,8 @@ static inline uint8_t get_overflow_x(const css_computed_style *style) #undef OVERFLOW_X_MASK #define OVERFLOW_Y_INDEX 8 -#define OVERFLOW_Y_SHIFT 23 -#define OVERFLOW_Y_MASK 0x3800000 +#define OVERFLOW_Y_SHIFT 29 +#define OVERFLOW_Y_MASK 0xe0000000 static inline uint8_t get_overflow_y(const css_computed_style *style) { uint32_t bits = style->i.bits[OVERFLOW_Y_INDEX]; @@ -1894,8 +1894,8 @@ static inline uint8_t get_overflow_y(const css_computed_style *style) #undef OVERFLOW_Y_MASK #define PADDING_BOTTOM_INDEX 7 -#define PADDING_BOTTOM_SHIFT 2 -#define PADDING_BOTTOM_MASK 0xfc +#define PADDING_BOTTOM_SHIFT 20 +#define PADDING_BOTTOM_MASK 0x3f00000 static inline uint8_t get_padding_bottom(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1916,8 +1916,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 20 -#define PADDING_LEFT_MASK 0x3f00000 +#define PADDING_LEFT_SHIFT 26 +#define PADDING_LEFT_MASK 0xfc000000 static inline uint8_t get_padding_left(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1938,8 +1938,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 14 -#define PADDING_RIGHT_MASK 0xfc000 +#define PADDING_RIGHT_SHIFT 8 +#define PADDING_RIGHT_MASK 0x3f00 static inline uint8_t get_padding_right(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1960,8 +1960,8 @@ static inline uint8_t get_padding_right(const css_computed_style *style, #undef PADDING_RIGHT_MASK #define PADDING_TOP_INDEX 7 -#define PADDING_TOP_SHIFT 26 -#define PADDING_TOP_MASK 0xfc000000 +#define PADDING_TOP_SHIFT 14 +#define PADDING_TOP_MASK 0xfc000 static inline uint8_t get_padding_top(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -1981,9 +1981,9 @@ static inline uint8_t get_padding_top(const css_computed_style *style, #undef PADDING_TOP_SHIFT #undef PADDING_TOP_MASK -#define POSITION_INDEX 8 -#define POSITION_SHIFT 14 -#define POSITION_MASK 0x1c000 +#define POSITION_INDEX 5 +#define POSITION_SHIFT 0 +#define POSITION_MASK 0x7 static inline uint8_t get_position(const css_computed_style *style) { uint32_t bits = style->i.bits[POSITION_INDEX]; @@ -1999,8 +1999,8 @@ static inline uint8_t get_position(const css_computed_style *style) #undef POSITION_MASK #define QUOTES_INDEX 10 -#define QUOTES_SHIFT 24 -#define QUOTES_MASK 0x1000000 +#define QUOTES_SHIFT 20 +#define QUOTES_MASK 0x100000 static inline uint8_t get_quotes(const css_computed_style *style, lwc_string ***string_arr) { @@ -2017,9 +2017,9 @@ static inline uint8_t get_quotes(const css_computed_style *style, lwc_string #undef QUOTES_SHIFT #undef QUOTES_MASK -#define RIGHT_INDEX 4 -#define RIGHT_SHIFT 25 -#define RIGHT_MASK 0xfe000000 +#define RIGHT_INDEX 1 +#define RIGHT_SHIFT 18 +#define RIGHT_MASK 0x1fc0000 static inline uint8_t get_right( const css_computed_style *style, css_fixed *length, css_unit *unit) @@ -2051,8 +2051,8 @@ static inline uint8_t get_right_bits( #undef RIGHT_MASK #define TABLE_LAYOUT_INDEX 9 -#define TABLE_LAYOUT_SHIFT 30 -#define TABLE_LAYOUT_MASK 0xc0000000 +#define TABLE_LAYOUT_SHIFT 0 +#define TABLE_LAYOUT_MASK 0x3 static inline uint8_t get_table_layout(const css_computed_style *style) { uint32_t bits = style->i.bits[TABLE_LAYOUT_INDEX]; @@ -2067,9 +2067,9 @@ static inline uint8_t get_table_layout(const css_computed_style *style) #undef TABLE_LAYOUT_SHIFT #undef TABLE_LAYOUT_MASK -#define TEXT_ALIGN_INDEX 6 -#define TEXT_ALIGN_SHIFT 10 -#define TEXT_ALIGN_MASK 0x3c00 +#define TEXT_ALIGN_INDEX 2 +#define TEXT_ALIGN_SHIFT 0 +#define TEXT_ALIGN_MASK 0xf static inline uint8_t get_text_align(const css_computed_style *style) { uint32_t bits = style->i.bits[TEXT_ALIGN_INDEX]; @@ -2102,8 +2102,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 8 -#define TEXT_INDENT_MASK 0x3f00 +#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) { @@ -2123,9 +2123,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 8 -#define TEXT_TRANSFORM_SHIFT 29 -#define TEXT_TRANSFORM_MASK 0xe0000000 +#define TEXT_TRANSFORM_INDEX 6 +#define TEXT_TRANSFORM_SHIFT 3 +#define TEXT_TRANSFORM_MASK 0x38 static inline uint8_t get_text_transform(const css_computed_style *style) { uint32_t bits = style->i.bits[TEXT_TRANSFORM_INDEX]; @@ -2140,9 +2140,9 @@ static inline uint8_t get_text_transform(const css_computed_style *style) #undef TEXT_TRANSFORM_SHIFT #undef TEXT_TRANSFORM_MASK -#define TOP_INDEX 4 -#define TOP_SHIFT 11 -#define TOP_MASK 0x3f800 +#define TOP_INDEX 3 +#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) @@ -2174,8 +2174,8 @@ static inline uint8_t get_top_bits( #undef TOP_MASK #define UNICODE_BIDI_INDEX 9 -#define UNICODE_BIDI_SHIFT 4 -#define UNICODE_BIDI_MASK 0x30 +#define UNICODE_BIDI_SHIFT 16 +#define UNICODE_BIDI_MASK 0x30000 static inline uint8_t get_unicode_bidi(const css_computed_style *style) { uint32_t bits = style->i.bits[UNICODE_BIDI_INDEX]; @@ -2212,9 +2212,9 @@ static inline uint8_t get_vertical_align(const css_computed_style *style, #undef VERTICAL_ALIGN_SHIFT #undef VERTICAL_ALIGN_MASK -#define VISIBILITY_INDEX 9 -#define VISIBILITY_SHIFT 18 -#define VISIBILITY_MASK 0xc0000 +#define VISIBILITY_INDEX 10 +#define VISIBILITY_SHIFT 28 +#define VISIBILITY_MASK 0x30000000 static inline uint8_t get_visibility(const css_computed_style *style) { uint32_t bits = style->i.bits[VISIBILITY_INDEX]; @@ -2229,7 +2229,7 @@ static inline uint8_t get_visibility(const css_computed_style *style) #undef VISIBILITY_SHIFT #undef VISIBILITY_MASK -#define WHITE_SPACE_INDEX 5 +#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) @@ -2246,9 +2246,9 @@ static inline uint8_t get_white_space(const css_computed_style *style) #undef WHITE_SPACE_SHIFT #undef WHITE_SPACE_MASK -#define WIDTH_INDEX 1 -#define WIDTH_SHIFT 11 -#define WIDTH_MASK 0x3f800 +#define WIDTH_INDEX 4 +#define WIDTH_SHIFT 18 +#define WIDTH_MASK 0x1fc0000 static inline uint8_t get_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { @@ -2268,9 +2268,9 @@ static inline uint8_t get_width(const css_computed_style *style, css_fixed #undef WIDTH_SHIFT #undef WIDTH_MASK -#define Z_INDEX_INDEX 9 -#define Z_INDEX_SHIFT 24 -#define Z_INDEX_MASK 0x3000000 +#define Z_INDEX_INDEX 10 +#define Z_INDEX_SHIFT 30 +#define Z_INDEX_MASK 0xc0000000 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 41acaa8..94fc887 100644 --- a/src/select/autogenerated_propset.h +++ b/src/select/autogenerated_propset.h @@ -11,24 +11,23 @@ static const css_computed_uncommon default_uncommon = { .i = { .bits = { (CSS_BORDER_SPACING_SET << 21) | ( - CSS_COLUMN_RULE_WIDTH_MEDIUM << 13) | ( - CSS_OUTLINE_WIDTH_MEDIUM << 5) | + CSS_OUTLINE_WIDTH_MEDIUM << 13) | ( + CSS_COLUMN_RULE_WIDTH_MEDIUM << 5) | CSS_CURSOR_AUTO, - (CSS_LETTER_SPACING_NORMAL << 25) | ( - CSS_COLUMN_GAP_NORMAL << 18) | ( - CSS_COLUMN_WIDTH_AUTO << 11) | ( - CSS_WORD_SPACING_NORMAL << 4) | - CSS_BREAK_AFTER_AUTO, - (CSS_CLIP_AUTO << 6) | (CSS_BREAK_BEFORE_AUTO << 2) | - CSS_COLUMN_COUNT_AUTO, - (CSS_BREAK_INSIDE_AUTO << 28) | ( - CSS_COLUMN_RULE_STYLE_NONE << 24) | ( - CSS_WRITING_MODE_HORIZONTAL_TB << 22) | - (CSS_COLUMN_SPAN_NONE << 20) | ( - CSS_COLUMN_RULE_COLOR_CURRENT_COLOR << - 18) | (CSS_OUTLINE_COLOR_INVERT << 16) - | (CSS_CONTENT_NORMAL << 14) | ( - CSS_COLUMN_FILL_BALANCE << 12) | ( + (CSS_COLUMN_WIDTH_AUTO << 25) | (CSS_COLUMN_GAP_NORMAL + << 18) | (CSS_LETTER_SPACING_NORMAL << + 11) | (CSS_WORD_SPACING_NORMAL << 4) | + CSS_BREAK_BEFORE_AUTO, + (CSS_CLIP_AUTO << 6) | (CSS_COLUMN_RULE_STYLE_NONE << + 2) | + CSS_COLUMN_RULE_COLOR_CURRENT_COLOR, + (CSS_BREAK_AFTER_AUTO << 28) | (CSS_BREAK_INSIDE_AUTO + << 24) | (CSS_CONTENT_NORMAL << 22) | ( + CSS_WRITING_MODE_HORIZONTAL_TB << 20) | + (CSS_COLUMN_FILL_BALANCE << 18) | ( + CSS_COLUMN_SPAN_NONE << 16) | ( + CSS_COLUMN_COUNT_AUTO << 14) | ( + CSS_OUTLINE_COLOR_INVERT << 12) | ( CSS_COUNTER_INCREMENT_NONE << 11) | ( CSS_COUNTER_RESET_NONE << 10) }, @@ -85,8 +84,8 @@ static inline css_error set_border_spacing(css_computed_style *style, uint8_t 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); + *bits = (*bits & ~BORDER_SPACING_MASK) | ((((uint32_t)type & 0x1) | ( + unit_b << 1) | (unit_a << 6)) << BORDER_SPACING_SHIFT); style->i.uncommon->i.border_spacing_a = length_a; @@ -98,9 +97,9 @@ 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) { @@ -111,7 +110,7 @@ static inline css_error set_break_after(css_computed_style *style, uint8_t type) bits = &style->i.uncommon->i.bits[BREAK_AFTER_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~BREAK_AFTER_MASK) | ((type & 0xf) << + *bits = (*bits & ~BREAK_AFTER_MASK) | (((uint32_t)type & 0xf) << BREAK_AFTER_SHIFT); return CSS_OK; @@ -120,9 +119,9 @@ static inline css_error set_break_after(css_computed_style *style, uint8_t type) #undef BREAK_AFTER_SHIFT #undef BREAK_AFTER_MASK -#define BREAK_BEFORE_INDEX 2 -#define BREAK_BEFORE_SHIFT 2 -#define BREAK_BEFORE_MASK 0x3c +#define BREAK_BEFORE_INDEX 1 +#define BREAK_BEFORE_SHIFT 0 +#define BREAK_BEFORE_MASK 0xf static inline css_error set_break_before(css_computed_style *style, uint8_t type) @@ -134,7 +133,7 @@ static inline css_error set_break_before(css_computed_style *style, uint8_t bits = &style->i.uncommon->i.bits[BREAK_BEFORE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~BREAK_BEFORE_MASK) | ((type & 0xf) << + *bits = (*bits & ~BREAK_BEFORE_MASK) | (((uint32_t)type & 0xf) << BREAK_BEFORE_SHIFT); return CSS_OK; @@ -144,8 +143,8 @@ static inline css_error set_break_before(css_computed_style *style, uint8_t #undef BREAK_BEFORE_MASK #define BREAK_INSIDE_INDEX 3 -#define BREAK_INSIDE_SHIFT 28 -#define BREAK_INSIDE_MASK 0xf0000000 +#define BREAK_INSIDE_SHIFT 24 +#define BREAK_INSIDE_MASK 0xf000000 static inline css_error set_break_inside(css_computed_style *style, uint8_t type) @@ -157,7 +156,7 @@ static inline css_error set_break_inside(css_computed_style *style, uint8_t bits = &style->i.uncommon->i.bits[BREAK_INSIDE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~BREAK_INSIDE_MASK) | ((type & 0xf) << + *bits = (*bits & ~BREAK_INSIDE_MASK) | (((uint32_t)type & 0xf) << BREAK_INSIDE_SHIFT); return CSS_OK; @@ -211,9 +210,9 @@ static inline css_error set_clip( #undef CLIP_SHIFT #undef CLIP_MASK -#define COLUMN_COUNT_INDEX 2 -#define COLUMN_COUNT_SHIFT 0 -#define COLUMN_COUNT_MASK 0x3 +#define COLUMN_COUNT_INDEX 3 +#define COLUMN_COUNT_SHIFT 14 +#define COLUMN_COUNT_MASK 0xc000 static inline css_error set_column_count(css_computed_style *style, uint8_t type, int32_t integer) @@ -225,7 +224,7 @@ static inline css_error set_column_count(css_computed_style *style, uint8_t bits = &style->i.uncommon->i.bits[COLUMN_COUNT_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~COLUMN_COUNT_MASK) | ((type & 0x3) << + *bits = (*bits & ~COLUMN_COUNT_MASK) | (((uint32_t)type & 0x3) << COLUMN_COUNT_SHIFT); style->i.uncommon->i.column_count = integer; @@ -237,8 +236,8 @@ 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 12 -#define COLUMN_FILL_MASK 0x3000 +#define COLUMN_FILL_SHIFT 18 +#define COLUMN_FILL_MASK 0xc0000 static inline css_error set_column_fill(css_computed_style *style, uint8_t type) { @@ -249,7 +248,7 @@ static inline css_error set_column_fill(css_computed_style *style, uint8_t type) bits = &style->i.uncommon->i.bits[COLUMN_FILL_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~COLUMN_FILL_MASK) | ((type & 0x3) << + *bits = (*bits & ~COLUMN_FILL_MASK) | (((uint32_t)type & 0x3) << COLUMN_FILL_SHIFT); return CSS_OK; @@ -272,8 +271,8 @@ static inline css_error set_column_gap(css_computed_style *style, uint8_t type, 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); + *bits = (*bits & ~COLUMN_GAP_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << COLUMN_GAP_SHIFT); style->i.uncommon->i.column_gap = length; @@ -283,9 +282,9 @@ static inline css_error set_column_gap(css_computed_style *style, uint8_t type, #undef COLUMN_GAP_SHIFT #undef COLUMN_GAP_MASK -#define COLUMN_RULE_COLOR_INDEX 3 -#define COLUMN_RULE_COLOR_SHIFT 18 -#define COLUMN_RULE_COLOR_MASK 0xc0000 +#define COLUMN_RULE_COLOR_INDEX 2 +#define COLUMN_RULE_COLOR_SHIFT 0 +#define COLUMN_RULE_COLOR_MASK 0x3 static inline css_error set_column_rule_color(css_computed_style *style, uint8_t type, css_color color) @@ -297,7 +296,7 @@ static inline css_error set_column_rule_color(css_computed_style *style, bits = &style->i.uncommon->i.bits[COLUMN_RULE_COLOR_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~COLUMN_RULE_COLOR_MASK) | ((type & 0x3) << + *bits = (*bits & ~COLUMN_RULE_COLOR_MASK) | (((uint32_t)type & 0x3) << COLUMN_RULE_COLOR_SHIFT); style->i.uncommon->i.column_rule_color = color; @@ -308,9 +307,9 @@ static inline css_error set_column_rule_color(css_computed_style *style, #undef COLUMN_RULE_COLOR_SHIFT #undef COLUMN_RULE_COLOR_MASK -#define COLUMN_RULE_STYLE_INDEX 3 -#define COLUMN_RULE_STYLE_SHIFT 24 -#define COLUMN_RULE_STYLE_MASK 0xf000000 +#define COLUMN_RULE_STYLE_INDEX 2 +#define COLUMN_RULE_STYLE_SHIFT 2 +#define COLUMN_RULE_STYLE_MASK 0x3c static inline css_error set_column_rule_style(css_computed_style *style, uint8_t type) @@ -322,7 +321,7 @@ static inline css_error set_column_rule_style(css_computed_style *style, bits = &style->i.uncommon->i.bits[COLUMN_RULE_STYLE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~COLUMN_RULE_STYLE_MASK) | ((type & 0xf) << + *bits = (*bits & ~COLUMN_RULE_STYLE_MASK) | (((uint32_t)type & 0xf) << COLUMN_RULE_STYLE_SHIFT); return CSS_OK; @@ -332,8 +331,8 @@ 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 13 -#define COLUMN_RULE_WIDTH_MASK 0x1fe000 +#define COLUMN_RULE_WIDTH_SHIFT 5 +#define COLUMN_RULE_WIDTH_MASK 0x1fe0 static inline css_error set_column_rule_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -345,8 +344,8 @@ static inline css_error set_column_rule_width(css_computed_style *style, 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); + *bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) | ((((uint32_t)type & 0x7) | ( + unit << 3)) << COLUMN_RULE_WIDTH_SHIFT); style->i.uncommon->i.column_rule_width = length; @@ -357,8 +356,8 @@ 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 20 -#define COLUMN_SPAN_MASK 0x300000 +#define COLUMN_SPAN_SHIFT 16 +#define COLUMN_SPAN_MASK 0x30000 static inline css_error set_column_span(css_computed_style *style, uint8_t type) { @@ -369,7 +368,7 @@ static inline css_error set_column_span(css_computed_style *style, uint8_t type) bits = &style->i.uncommon->i.bits[COLUMN_SPAN_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~COLUMN_SPAN_MASK) | ((type & 0x3) << + *bits = (*bits & ~COLUMN_SPAN_MASK) | (((uint32_t)type & 0x3) << COLUMN_SPAN_SHIFT); return CSS_OK; @@ -379,8 +378,8 @@ 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 11 -#define COLUMN_WIDTH_MASK 0x3f800 +#define COLUMN_WIDTH_SHIFT 25 +#define COLUMN_WIDTH_MASK 0xfe000000 static inline css_error set_column_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -392,8 +391,8 @@ static inline css_error set_column_width(css_computed_style *style, uint8_t 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); + *bits = (*bits & ~COLUMN_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << COLUMN_WIDTH_SHIFT); style->i.uncommon->i.column_width = length; @@ -404,8 +403,8 @@ static inline css_error set_column_width(css_computed_style *style, uint8_t #undef COLUMN_WIDTH_MASK #define CONTENT_INDEX 3 -#define CONTENT_SHIFT 14 -#define CONTENT_MASK 0xc000 +#define CONTENT_SHIFT 22 +#define CONTENT_MASK 0xc00000 static inline css_error set_content( css_computed_style *style, uint8_t type, css_computed_content_item *content) @@ -502,7 +501,7 @@ static inline css_error set_counter_increment(css_computed_style *style, bits = &style->i.uncommon->i.bits[COUNTER_INCREMENT_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~COUNTER_INCREMENT_MASK) | ((type & 0x1) << + *bits = (*bits & ~COUNTER_INCREMENT_MASK) | (((uint32_t)type & 0x1) << COUNTER_INCREMENT_SHIFT); css_computed_counter *old_counter_arr = @@ -543,7 +542,7 @@ static inline css_error set_counter_reset(css_computed_style *style, uint8_t bits = &style->i.uncommon->i.bits[COUNTER_RESET_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~COUNTER_RESET_MASK) | ((type & 0x1) << + *bits = (*bits & ~COUNTER_RESET_MASK) | (((uint32_t)type & 0x1) << COUNTER_RESET_SHIFT); css_computed_counter *old_counter_arr = @@ -584,7 +583,8 @@ static inline css_error set_cursor(css_computed_style *style, uint8_t type, bits = &style->i.uncommon->i.bits[CURSOR_INDEX]; /* 5bits: ttttt : type */ - *bits = (*bits & ~CURSOR_MASK) | ((type & 0x1f) << CURSOR_SHIFT); + *bits = (*bits & ~CURSOR_MASK) | (((uint32_t)type & 0x1f) << + CURSOR_SHIFT); lwc_string **old_string_arr = style->i.uncommon->cursor; lwc_string **s; @@ -610,8 +610,8 @@ 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 25 -#define LETTER_SPACING_MASK 0xfe000000 +#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) @@ -623,8 +623,8 @@ static inline css_error set_letter_spacing(css_computed_style *style, uint8_t 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); + *bits = (*bits & ~LETTER_SPACING_MASK) | ((((uint32_t)type & 0x3) | ( + unit << 2)) << LETTER_SPACING_SHIFT); style->i.uncommon->i.letter_spacing = length; @@ -635,8 +635,8 @@ static inline css_error set_letter_spacing(css_computed_style *style, uint8_t #undef LETTER_SPACING_MASK #define OUTLINE_COLOR_INDEX 3 -#define OUTLINE_COLOR_SHIFT 16 -#define OUTLINE_COLOR_MASK 0x30000 +#define OUTLINE_COLOR_SHIFT 12 +#define OUTLINE_COLOR_MASK 0x3000 static inline css_error set_outline_color(css_computed_style *style, uint8_t type, css_color color) @@ -648,7 +648,7 @@ static inline css_error set_outline_color(css_computed_style *style, uint8_t bits = &style->i.uncommon->i.bits[OUTLINE_COLOR_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~OUTLINE_COLOR_MASK) | ((type & 0x3) << + *bits = (*bits & ~OUTLINE_COLOR_MASK) | (((uint32_t)type & 0x3) << OUTLINE_COLOR_SHIFT); style->i.uncommon->i.outline_color = color; @@ -660,8 +660,8 @@ 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 5 -#define OUTLINE_WIDTH_MASK 0x1fe0 +#define OUTLINE_WIDTH_SHIFT 13 +#define OUTLINE_WIDTH_MASK 0x1fe000 static inline css_error set_outline_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -673,8 +673,8 @@ static inline css_error set_outline_width(css_computed_style *style, uint8_t 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); + *bits = (*bits & ~OUTLINE_WIDTH_MASK) | ((((uint32_t)type & 0x7) | ( + unit << 3)) << OUTLINE_WIDTH_SHIFT); style->i.uncommon->i.outline_width = length; @@ -698,8 +698,8 @@ static inline css_error set_word_spacing(css_computed_style *style, uint8_t 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); + *bits = (*bits & ~WORD_SPACING_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << WORD_SPACING_SHIFT); style->i.uncommon->i.word_spacing = length; @@ -710,8 +710,8 @@ 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 22 -#define WRITING_MODE_MASK 0xc00000 +#define WRITING_MODE_SHIFT 20 +#define WRITING_MODE_MASK 0x300000 static inline css_error set_writing_mode(css_computed_style *style, uint8_t type) @@ -723,7 +723,7 @@ static inline css_error set_writing_mode(css_computed_style *style, uint8_t bits = &style->i.uncommon->i.bits[WRITING_MODE_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~WRITING_MODE_MASK) | ((type & 0x3) << + *bits = (*bits & ~WRITING_MODE_MASK) | (((uint32_t)type & 0x3) << WRITING_MODE_SHIFT); return CSS_OK; @@ -767,7 +767,8 @@ static inline css_error set_orphans(css_computed_style *style, uint8_t type, bits = &style->page->bits[ORPHANS_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~ORPHANS_MASK) | ((type & 0x1) << ORPHANS_SHIFT); + *bits = (*bits & ~ORPHANS_MASK) | (((uint32_t)type & 0x1) << + ORPHANS_SHIFT); style->page->orphans = integer; @@ -791,7 +792,7 @@ static inline css_error set_page_break_after(css_computed_style *style, uint8_t bits = &style->page->bits[PAGE_BREAK_AFTER_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~PAGE_BREAK_AFTER_MASK) | ((type & 0x7) << + *bits = (*bits & ~PAGE_BREAK_AFTER_MASK) | (((uint32_t)type & 0x7) << PAGE_BREAK_AFTER_SHIFT); return CSS_OK; @@ -814,7 +815,7 @@ static inline css_error set_page_break_before(css_computed_style *style, bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) | ((type & 0x7) << + *bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) | (((uint32_t)type & 0x7) << PAGE_BREAK_BEFORE_SHIFT); return CSS_OK; @@ -837,7 +838,7 @@ static inline css_error set_page_break_inside(css_computed_style *style, bits = &style->page->bits[PAGE_BREAK_INSIDE_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) | ((type & 0x3) << + *bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) | (((uint32_t)type & 0x3) << PAGE_BREAK_INSIDE_SHIFT); return CSS_OK; @@ -860,7 +861,8 @@ static inline css_error set_widows(css_computed_style *style, uint8_t type, bits = &style->page->bits[WIDOWS_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~WIDOWS_MASK) | ((type & 0x1) << WIDOWS_SHIFT); + *bits = (*bits & ~WIDOWS_MASK) | (((uint32_t)type & 0x1) << + WIDOWS_SHIFT); style->page->widows = integer; @@ -871,8 +873,8 @@ static inline css_error set_widows(css_computed_style *style, uint8_t type, #undef WIDOWS_MASK #define ALIGN_CONTENT_INDEX 8 -#define ALIGN_CONTENT_SHIFT 8 -#define ALIGN_CONTENT_MASK 0x700 +#define ALIGN_CONTENT_SHIFT 14 +#define ALIGN_CONTENT_MASK 0x1c000 static inline css_error set_align_content(css_computed_style *style, uint8_t type) @@ -882,7 +884,7 @@ static inline css_error set_align_content(css_computed_style *style, uint8_t bits = &style->i.bits[ALIGN_CONTENT_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~ALIGN_CONTENT_MASK) | ((type & 0x7) << + *bits = (*bits & ~ALIGN_CONTENT_MASK) | (((uint32_t)type & 0x7) << ALIGN_CONTENT_SHIFT); return CSS_OK; @@ -892,8 +894,8 @@ static inline css_error set_align_content(css_computed_style *style, uint8_t #undef ALIGN_CONTENT_MASK #define ALIGN_ITEMS_INDEX 8 -#define ALIGN_ITEMS_SHIFT 17 -#define ALIGN_ITEMS_MASK 0xe0000 +#define ALIGN_ITEMS_SHIFT 23 +#define ALIGN_ITEMS_MASK 0x3800000 static inline css_error set_align_items(css_computed_style *style, uint8_t type) { @@ -902,7 +904,7 @@ static inline css_error set_align_items(css_computed_style *style, uint8_t type) bits = &style->i.bits[ALIGN_ITEMS_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~ALIGN_ITEMS_MASK) | ((type & 0x7) << + *bits = (*bits & ~ALIGN_ITEMS_MASK) | (((uint32_t)type & 0x7) << ALIGN_ITEMS_SHIFT); return CSS_OK; @@ -922,7 +924,8 @@ static inline css_error set_align_self(css_computed_style *style, uint8_t type) bits = &style->i.bits[ALIGN_SELF_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~ALIGN_SELF_MASK) | ((type & 0x7) << ALIGN_SELF_SHIFT); + *bits = (*bits & ~ALIGN_SELF_MASK) | (((uint32_t)type & 0x7) << + ALIGN_SELF_SHIFT); return CSS_OK; } @@ -931,8 +934,8 @@ static inline css_error set_align_self(css_computed_style *style, uint8_t type) #undef ALIGN_SELF_MASK #define BACKGROUND_ATTACHMENT_INDEX 9 -#define BACKGROUND_ATTACHMENT_SHIFT 26 -#define BACKGROUND_ATTACHMENT_MASK 0xc000000 +#define BACKGROUND_ATTACHMENT_SHIFT 6 +#define BACKGROUND_ATTACHMENT_MASK 0xc0 static inline css_error set_background_attachment(css_computed_style *style, uint8_t type) @@ -942,8 +945,8 @@ static inline css_error set_background_attachment(css_computed_style *style, bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) | ((type & 0x3) << - BACKGROUND_ATTACHMENT_SHIFT); + *bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) | (((uint32_t)type & 0x3) + << BACKGROUND_ATTACHMENT_SHIFT); return CSS_OK; } @@ -951,9 +954,9 @@ static inline css_error set_background_attachment(css_computed_style *style, #undef BACKGROUND_ATTACHMENT_SHIFT #undef BACKGROUND_ATTACHMENT_MASK -#define BACKGROUND_COLOR_INDEX 7 -#define BACKGROUND_COLOR_SHIFT 0 -#define BACKGROUND_COLOR_MASK 0x3 +#define BACKGROUND_COLOR_INDEX 9 +#define BACKGROUND_COLOR_SHIFT 14 +#define BACKGROUND_COLOR_MASK 0xc000 static inline css_error set_background_color(css_computed_style *style, uint8_t type, css_color color) @@ -963,7 +966,7 @@ static inline css_error set_background_color(css_computed_style *style, uint8_t bits = &style->i.bits[BACKGROUND_COLOR_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~BACKGROUND_COLOR_MASK) | ((type & 0x3) << + *bits = (*bits & ~BACKGROUND_COLOR_MASK) | (((uint32_t)type & 0x3) << BACKGROUND_COLOR_SHIFT); style->i.background_color = color; @@ -975,8 +978,8 @@ 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 27 -#define BACKGROUND_IMAGE_MASK 0x8000000 +#define BACKGROUND_IMAGE_SHIFT 25 +#define BACKGROUND_IMAGE_MASK 0x2000000 static inline css_error set_background_image(css_computed_style *style, uint8_t type, lwc_string *string) @@ -986,7 +989,7 @@ static inline css_error set_background_image(css_computed_style *style, uint8_t bits = &style->i.bits[BACKGROUND_IMAGE_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~BACKGROUND_IMAGE_MASK) | ((type & 0x1) << + *bits = (*bits & ~BACKGROUND_IMAGE_MASK) | (((uint32_t)type & 0x1) << BACKGROUND_IMAGE_SHIFT); lwc_string *old_string = style->i.background_image; @@ -1019,8 +1022,9 @@ static inline css_error set_background_position(css_computed_style *style, bits = &style->i.bits[BACKGROUND_POSITION_INDEX]; /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */ - *bits = (*bits & ~BACKGROUND_POSITION_MASK) | (((type & 0x1) | (unit_b - << 1) | (unit_a << 6)) << BACKGROUND_POSITION_SHIFT); + *bits = (*bits & ~BACKGROUND_POSITION_MASK) | ((((uint32_t)type & 0x1) + | (unit_b << 1) | (unit_a << 6)) << + BACKGROUND_POSITION_SHIFT); style->i.background_position_a = length_a; @@ -1032,9 +1036,9 @@ static inline css_error set_background_position(css_computed_style *style, #undef BACKGROUND_POSITION_SHIFT #undef BACKGROUND_POSITION_MASK -#define BACKGROUND_REPEAT_INDEX 6 -#define BACKGROUND_REPEAT_SHIFT 3 -#define BACKGROUND_REPEAT_MASK 0x38 +#define BACKGROUND_REPEAT_INDEX 8 +#define BACKGROUND_REPEAT_SHIFT 17 +#define BACKGROUND_REPEAT_MASK 0xe0000 static inline css_error set_background_repeat(css_computed_style *style, uint8_t type) @@ -1044,7 +1048,7 @@ static inline css_error set_background_repeat(css_computed_style *style, bits = &style->i.bits[BACKGROUND_REPEAT_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~BACKGROUND_REPEAT_MASK) | ((type & 0x7) << + *bits = (*bits & ~BACKGROUND_REPEAT_MASK) | (((uint32_t)type & 0x7) << BACKGROUND_REPEAT_SHIFT); return CSS_OK; @@ -1054,8 +1058,8 @@ static inline css_error set_background_repeat(css_computed_style *style, #undef BACKGROUND_REPEAT_MASK #define BORDER_BOTTOM_COLOR_INDEX 9 -#define BORDER_BOTTOM_COLOR_SHIFT 8 -#define BORDER_BOTTOM_COLOR_MASK 0x300 +#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) @@ -1065,8 +1069,8 @@ static inline css_error set_border_bottom_color(css_computed_style *style, bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) | ((type & 0x3) << - BORDER_BOTTOM_COLOR_SHIFT); + *bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) | (((uint32_t)type & 0x3) + << BORDER_BOTTOM_COLOR_SHIFT); style->i.border_bottom_color = color; @@ -1077,8 +1081,8 @@ static inline css_error set_border_bottom_color(css_computed_style *style, #undef BORDER_BOTTOM_COLOR_MASK #define BORDER_BOTTOM_STYLE_INDEX 6 -#define BORDER_BOTTOM_STYLE_SHIFT 18 -#define BORDER_BOTTOM_STYLE_MASK 0x3c0000 +#define BORDER_BOTTOM_STYLE_SHIFT 6 +#define BORDER_BOTTOM_STYLE_MASK 0x3c0 static inline css_error set_border_bottom_style(css_computed_style *style, uint8_t type) @@ -1088,8 +1092,8 @@ static inline css_error set_border_bottom_style(css_computed_style *style, bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) | ((type & 0xf) << - BORDER_BOTTOM_STYLE_SHIFT); + *bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) | (((uint32_t)type & 0xf) + << BORDER_BOTTOM_STYLE_SHIFT); return CSS_OK; } @@ -1098,8 +1102,8 @@ 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 24 -#define BORDER_BOTTOM_WIDTH_MASK 0xff000000 +#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) @@ -1109,8 +1113,8 @@ static inline css_error set_border_bottom_width(css_computed_style *style, bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX]; /* 8bits: uuuuuttt : unit | type */ - *bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) | (((type & 0x7) | (unit << - 3)) << BORDER_BOTTOM_WIDTH_SHIFT); + *bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) | ((((uint32_t)type & 0x7) + | (unit << 3)) << BORDER_BOTTOM_WIDTH_SHIFT); style->i.border_bottom_width = length; @@ -1120,9 +1124,9 @@ 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 10 -#define BORDER_COLLAPSE_SHIFT 28 -#define BORDER_COLLAPSE_MASK 0x30000000 +#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) @@ -1132,7 +1136,7 @@ static inline css_error set_border_collapse(css_computed_style *style, uint8_t bits = &style->i.bits[BORDER_COLLAPSE_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~BORDER_COLLAPSE_MASK) | ((type & 0x3) << + *bits = (*bits & ~BORDER_COLLAPSE_MASK) | (((uint32_t)type & 0x3) << BORDER_COLLAPSE_SHIFT); return CSS_OK; @@ -1141,9 +1145,9 @@ 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 10 -#define BORDER_LEFT_COLOR_SHIFT 30 -#define BORDER_LEFT_COLOR_MASK 0xc0000000 +#define BORDER_LEFT_COLOR_INDEX 9 +#define BORDER_LEFT_COLOR_SHIFT 24 +#define BORDER_LEFT_COLOR_MASK 0x3000000 static inline css_error set_border_left_color(css_computed_style *style, uint8_t type, css_color color) @@ -1153,7 +1157,7 @@ static inline css_error set_border_left_color(css_computed_style *style, bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~BORDER_LEFT_COLOR_MASK) | ((type & 0x3) << + *bits = (*bits & ~BORDER_LEFT_COLOR_MASK) | (((uint32_t)type & 0x3) << BORDER_LEFT_COLOR_SHIFT); style->i.border_left_color = color; @@ -1164,9 +1168,9 @@ 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) @@ -1176,7 +1180,7 @@ static inline css_error set_border_left_style(css_computed_style *style, bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~BORDER_LEFT_STYLE_MASK) | ((type & 0xf) << + *bits = (*bits & ~BORDER_LEFT_STYLE_MASK) | (((uint32_t)type & 0xf) << BORDER_LEFT_STYLE_SHIFT); return CSS_OK; @@ -1186,8 +1190,8 @@ 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) @@ -1197,8 +1201,8 @@ static inline css_error set_border_left_width(css_computed_style *style, bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX]; /* 8bits: uuuuuttt : unit | type */ - *bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) | (((type & 0x7) | (unit << - 3)) << BORDER_LEFT_WIDTH_SHIFT); + *bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) | ((((uint32_t)type & 0x7) | ( + unit << 3)) << BORDER_LEFT_WIDTH_SHIFT); style->i.border_left_width = length; @@ -1209,8 +1213,8 @@ static inline css_error set_border_left_width(css_computed_style *style, #undef BORDER_LEFT_WIDTH_MASK #define BORDER_RIGHT_COLOR_INDEX 9 -#define BORDER_RIGHT_COLOR_SHIFT 28 -#define BORDER_RIGHT_COLOR_MASK 0x30000000 +#define BORDER_RIGHT_COLOR_SHIFT 30 +#define BORDER_RIGHT_COLOR_MASK 0xc0000000 static inline css_error set_border_right_color(css_computed_style *style, uint8_t type, css_color color) @@ -1220,7 +1224,7 @@ static inline css_error set_border_right_color(css_computed_style *style, bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) | ((type & 0x3) << + *bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) | (((uint32_t)type & 0x3) << BORDER_RIGHT_COLOR_SHIFT); style->i.border_right_color = color; @@ -1231,9 +1235,9 @@ 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 14 +#define BORDER_RIGHT_STYLE_MASK 0x3c000 static inline css_error set_border_right_style(css_computed_style *style, uint8_t type) @@ -1243,7 +1247,7 @@ static inline css_error set_border_right_style(css_computed_style *style, bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) | ((type & 0xf) << + *bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) | (((uint32_t)type & 0xf) << BORDER_RIGHT_STYLE_SHIFT); return CSS_OK; @@ -1253,8 +1257,8 @@ 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 0 -#define BORDER_RIGHT_WIDTH_MASK 0xff +#define BORDER_RIGHT_WIDTH_SHIFT 8 +#define BORDER_RIGHT_WIDTH_MASK 0xff00 static inline css_error set_border_right_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -1264,8 +1268,8 @@ static inline css_error set_border_right_width(css_computed_style *style, bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX]; /* 8bits: uuuuuttt : unit | type */ - *bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) | (((type & 0x7) | (unit << - 3)) << BORDER_RIGHT_WIDTH_SHIFT); + *bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) | ((((uint32_t)type & 0x7) | + (unit << 3)) << BORDER_RIGHT_WIDTH_SHIFT); style->i.border_right_width = length; @@ -1275,9 +1279,9 @@ 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 9 -#define BORDER_TOP_COLOR_SHIFT 16 -#define BORDER_TOP_COLOR_MASK 0x30000 +#define BORDER_TOP_COLOR_INDEX 8 +#define BORDER_TOP_COLOR_SHIFT 0 +#define BORDER_TOP_COLOR_MASK 0x3 static inline css_error set_border_top_color(css_computed_style *style, uint8_t type, css_color color) @@ -1287,7 +1291,7 @@ static inline css_error set_border_top_color(css_computed_style *style, uint8_t bits = &style->i.bits[BORDER_TOP_COLOR_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~BORDER_TOP_COLOR_MASK) | ((type & 0x3) << + *bits = (*bits & ~BORDER_TOP_COLOR_MASK) | (((uint32_t)type & 0x3) << BORDER_TOP_COLOR_SHIFT); style->i.border_top_color = color; @@ -1298,9 +1302,9 @@ 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 1 -#define BORDER_TOP_STYLE_SHIFT 0 -#define BORDER_TOP_STYLE_MASK 0xf +#define BORDER_TOP_STYLE_INDEX 6 +#define BORDER_TOP_STYLE_SHIFT 10 +#define BORDER_TOP_STYLE_MASK 0x3c00 static inline css_error set_border_top_style(css_computed_style *style, uint8_t type) @@ -1310,7 +1314,7 @@ static inline css_error set_border_top_style(css_computed_style *style, uint8_t bits = &style->i.bits[BORDER_TOP_STYLE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~BORDER_TOP_STYLE_MASK) | ((type & 0xf) << + *bits = (*bits & ~BORDER_TOP_STYLE_MASK) | (((uint32_t)type & 0xf) << BORDER_TOP_STYLE_SHIFT); return CSS_OK; @@ -1320,8 +1324,8 @@ 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 8 -#define BORDER_TOP_WIDTH_MASK 0xff00 +#define BORDER_TOP_WIDTH_SHIFT 24 +#define BORDER_TOP_WIDTH_MASK 0xff000000 static inline css_error set_border_top_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -1331,8 +1335,8 @@ static inline css_error set_border_top_width(css_computed_style *style, uint8_t bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX]; /* 8bits: uuuuuttt : unit | type */ - *bits = (*bits & ~BORDER_TOP_WIDTH_MASK) | (((type & 0x7) | (unit << - 3)) << BORDER_TOP_WIDTH_SHIFT); + *bits = (*bits & ~BORDER_TOP_WIDTH_MASK) | ((((uint32_t)type & 0x7) | ( + unit << 3)) << BORDER_TOP_WIDTH_SHIFT); style->i.border_top_width = length; @@ -1342,9 +1346,9 @@ 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 3 -#define BOTTOM_SHIFT 18 -#define BOTTOM_MASK 0x1fc0000 +#define BOTTOM_INDEX 4 +#define BOTTOM_SHIFT 11 +#define BOTTOM_MASK 0x3f800 static inline css_error set_bottom(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -1354,8 +1358,8 @@ static inline css_error set_bottom(css_computed_style *style, uint8_t type, bits = &style->i.bits[BOTTOM_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~BOTTOM_MASK) | (((type & 0x3) | (unit << 2)) << - BOTTOM_SHIFT); + *bits = (*bits & ~BOTTOM_MASK) | ((((uint32_t)type & 0x3) | (unit << + 2)) << BOTTOM_SHIFT); style->i.bottom = length; @@ -1366,8 +1370,8 @@ static inline css_error set_bottom(css_computed_style *style, uint8_t type, #undef BOTTOM_MASK #define BOX_SIZING_INDEX 9 -#define BOX_SIZING_SHIFT 2 -#define BOX_SIZING_MASK 0xc +#define BOX_SIZING_SHIFT 12 +#define BOX_SIZING_MASK 0x3000 static inline css_error set_box_sizing(css_computed_style *style, uint8_t type) { @@ -1376,7 +1380,8 @@ static inline css_error set_box_sizing(css_computed_style *style, uint8_t type) bits = &style->i.bits[BOX_SIZING_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~BOX_SIZING_MASK) | ((type & 0x3) << BOX_SIZING_SHIFT); + *bits = (*bits & ~BOX_SIZING_MASK) | (((uint32_t)type & 0x3) << + BOX_SIZING_SHIFT); return CSS_OK; } @@ -1385,8 +1390,8 @@ static inline css_error set_box_sizing(css_computed_style *style, uint8_t type) #undef BOX_SIZING_MASK #define CAPTION_SIDE_INDEX 9 -#define CAPTION_SIDE_SHIFT 10 -#define CAPTION_SIDE_MASK 0xc00 +#define CAPTION_SIDE_SHIFT 20 +#define CAPTION_SIDE_MASK 0x300000 static inline css_error set_caption_side(css_computed_style *style, uint8_t type) @@ -1396,7 +1401,7 @@ static inline css_error set_caption_side(css_computed_style *style, uint8_t bits = &style->i.bits[CAPTION_SIDE_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~CAPTION_SIDE_MASK) | ((type & 0x3) << + *bits = (*bits & ~CAPTION_SIDE_MASK) | (((uint32_t)type & 0x3) << CAPTION_SIDE_SHIFT); return CSS_OK; @@ -1406,8 +1411,8 @@ static inline css_error set_caption_side(css_computed_style *style, uint8_t #undef CAPTION_SIDE_MASK #define CLEAR_INDEX 8 -#define CLEAR_SHIFT 11 -#define CLEAR_MASK 0x3800 +#define CLEAR_SHIFT 2 +#define CLEAR_MASK 0x1c static inline css_error set_clear(css_computed_style *style, uint8_t type) { @@ -1416,7 +1421,7 @@ static inline css_error set_clear(css_computed_style *style, uint8_t type) bits = &style->i.bits[CLEAR_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~CLEAR_MASK) | ((type & 0x7) << CLEAR_SHIFT); + *bits = (*bits & ~CLEAR_MASK) | (((uint32_t)type & 0x7) << CLEAR_SHIFT); return CSS_OK; } @@ -1425,8 +1430,8 @@ static inline css_error set_clear(css_computed_style *style, uint8_t type) #undef CLEAR_MASK #define COLOR_INDEX 10 -#define COLOR_SHIFT 26 -#define COLOR_MASK 0x4000000 +#define COLOR_SHIFT 24 +#define COLOR_MASK 0x1000000 static inline css_error set_color(css_computed_style *style, uint8_t type, css_color color) @@ -1436,7 +1441,7 @@ static inline css_error set_color(css_computed_style *style, uint8_t type, bits = &style->i.bits[COLOR_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~COLOR_MASK) | ((type & 0x1) << COLOR_SHIFT); + *bits = (*bits & ~COLOR_MASK) | (((uint32_t)type & 0x1) << COLOR_SHIFT); style->i.color = color; @@ -1446,9 +1451,9 @@ 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 0 -#define DIRECTION_MASK 0x3 +#define DIRECTION_INDEX 9 +#define DIRECTION_SHIFT 22 +#define DIRECTION_MASK 0xc00000 static inline css_error set_direction(css_computed_style *style, uint8_t type) { @@ -1457,7 +1462,8 @@ static inline css_error set_direction(css_computed_style *style, uint8_t type) bits = &style->i.bits[DIRECTION_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~DIRECTION_MASK) | ((type & 0x3) << DIRECTION_SHIFT); + *bits = (*bits & ~DIRECTION_MASK) | (((uint32_t)type & 0x3) << + DIRECTION_SHIFT); return CSS_OK; } @@ -1476,7 +1482,8 @@ static inline css_error set_display(css_computed_style *style, uint8_t type) bits = &style->i.bits[DISPLAY_INDEX]; /* 5bits: ttttt : type */ - *bits = (*bits & ~DISPLAY_MASK) | ((type & 0x1f) << DISPLAY_SHIFT); + *bits = (*bits & ~DISPLAY_MASK) | (((uint32_t)type & 0x1f) << + DISPLAY_SHIFT); return CSS_OK; } @@ -1485,8 +1492,8 @@ static inline css_error set_display(css_computed_style *style, uint8_t type) #undef DISPLAY_MASK #define EMPTY_CELLS_INDEX 9 -#define EMPTY_CELLS_SHIFT 12 -#define EMPTY_CELLS_MASK 0x3000 +#define EMPTY_CELLS_SHIFT 18 +#define EMPTY_CELLS_MASK 0xc0000 static inline css_error set_empty_cells(css_computed_style *style, uint8_t type) { @@ -1495,7 +1502,7 @@ static inline css_error set_empty_cells(css_computed_style *style, uint8_t type) bits = &style->i.bits[EMPTY_CELLS_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~EMPTY_CELLS_MASK) | ((type & 0x3) << + *bits = (*bits & ~EMPTY_CELLS_MASK) | (((uint32_t)type & 0x3) << EMPTY_CELLS_SHIFT); return CSS_OK; @@ -1504,9 +1511,9 @@ 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_SHIFT 4 -#define FLEX_BASIS_MASK 0x7f0 +#define FLEX_BASIS_INDEX 2 +#define FLEX_BASIS_SHIFT 11 +#define FLEX_BASIS_MASK 0x3f800 static inline css_error set_flex_basis(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -1516,8 +1523,8 @@ static inline css_error set_flex_basis(css_computed_style *style, uint8_t type, bits = &style->i.bits[FLEX_BASIS_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~FLEX_BASIS_MASK) | (((type & 0x3) | (unit << 2)) << - FLEX_BASIS_SHIFT); + *bits = (*bits & ~FLEX_BASIS_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << FLEX_BASIS_SHIFT); style->i.flex_basis = length; @@ -1527,9 +1534,9 @@ 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 6 -#define FLEX_DIRECTION_SHIFT 0 -#define FLEX_DIRECTION_MASK 0x7 +#define FLEX_DIRECTION_INDEX 8 +#define FLEX_DIRECTION_SHIFT 11 +#define FLEX_DIRECTION_MASK 0x3800 static inline css_error set_flex_direction(css_computed_style *style, uint8_t type) @@ -1539,7 +1546,7 @@ static inline css_error set_flex_direction(css_computed_style *style, uint8_t bits = &style->i.bits[FLEX_DIRECTION_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~FLEX_DIRECTION_MASK) | ((type & 0x7) << + *bits = (*bits & ~FLEX_DIRECTION_MASK) | (((uint32_t)type & 0x7) << FLEX_DIRECTION_SHIFT); return CSS_OK; @@ -1549,8 +1556,8 @@ static inline css_error set_flex_direction(css_computed_style *style, uint8_t #undef FLEX_DIRECTION_MASK #define FLEX_GROW_INDEX 10 -#define FLEX_GROW_SHIFT 23 -#define FLEX_GROW_MASK 0x800000 +#define FLEX_GROW_SHIFT 21 +#define FLEX_GROW_MASK 0x200000 static inline css_error set_flex_grow(css_computed_style *style, uint8_t type, css_fixed fixed) @@ -1560,7 +1567,8 @@ static inline css_error set_flex_grow(css_computed_style *style, uint8_t type, bits = &style->i.bits[FLEX_GROW_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~FLEX_GROW_MASK) | ((type & 0x1) << FLEX_GROW_SHIFT); + *bits = (*bits & ~FLEX_GROW_MASK) | (((uint32_t)type & 0x1) << + FLEX_GROW_SHIFT); style->i.flex_grow = fixed; @@ -1571,8 +1579,8 @@ 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 20 -#define FLEX_SHRINK_MASK 0x100000 +#define FLEX_SHRINK_SHIFT 23 +#define FLEX_SHRINK_MASK 0x800000 static inline css_error set_flex_shrink(css_computed_style *style, uint8_t type, css_fixed fixed) @@ -1582,7 +1590,7 @@ static inline css_error set_flex_shrink(css_computed_style *style, uint8_t bits = &style->i.bits[FLEX_SHRINK_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~FLEX_SHRINK_MASK) | ((type & 0x1) << + *bits = (*bits & ~FLEX_SHRINK_MASK) | (((uint32_t)type & 0x1) << FLEX_SHRINK_SHIFT); style->i.flex_shrink = fixed; @@ -1594,8 +1602,8 @@ static inline css_error set_flex_shrink(css_computed_style *style, uint8_t #undef FLEX_SHRINK_MASK #define FLEX_WRAP_INDEX 9 -#define FLEX_WRAP_SHIFT 20 -#define FLEX_WRAP_MASK 0x300000 +#define FLEX_WRAP_SHIFT 28 +#define FLEX_WRAP_MASK 0x30000000 static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type) { @@ -1604,7 +1612,8 @@ static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type) bits = &style->i.bits[FLEX_WRAP_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~FLEX_WRAP_MASK) | ((type & 0x3) << FLEX_WRAP_SHIFT); + *bits = (*bits & ~FLEX_WRAP_MASK) | (((uint32_t)type & 0x3) << + FLEX_WRAP_SHIFT); return CSS_OK; } @@ -1613,8 +1622,8 @@ static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type) #undef FLEX_WRAP_MASK #define FLOAT_INDEX 9 -#define FLOAT_SHIFT 14 -#define FLOAT_MASK 0xc000 +#define FLOAT_SHIFT 8 +#define FLOAT_MASK 0x300 static inline css_error set_float(css_computed_style *style, uint8_t type) { @@ -1623,7 +1632,7 @@ static inline css_error set_float(css_computed_style *style, uint8_t type) bits = &style->i.bits[FLOAT_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~FLOAT_MASK) | ((type & 0x3) << FLOAT_SHIFT); + *bits = (*bits & ~FLOAT_MASK) | (((uint32_t)type & 0x3) << FLOAT_SHIFT); return CSS_OK; } @@ -1643,7 +1652,7 @@ static inline css_error set_font_family(css_computed_style *style, uint8_t bits = &style->i.bits[FONT_FAMILY_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~FONT_FAMILY_MASK) | ((type & 0x7) << + *bits = (*bits & ~FONT_FAMILY_MASK) | (((uint32_t)type & 0x7) << FONT_FAMILY_SHIFT); lwc_string **old_string_arr = style->font_family; @@ -1681,8 +1690,8 @@ static inline css_error set_font_size(css_computed_style *style, uint8_t type, bits = &style->i.bits[FONT_SIZE_INDEX]; /* 9bits: uuuuutttt : unit | type */ - *bits = (*bits & ~FONT_SIZE_MASK) | (((type & 0xf) | (unit << 4)) << - FONT_SIZE_SHIFT); + *bits = (*bits & ~FONT_SIZE_MASK) | ((((uint32_t)type & 0xf) | (unit << + 4)) << FONT_SIZE_SHIFT); style->i.font_size = length; @@ -1692,9 +1701,9 @@ 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 9 -#define FONT_STYLE_SHIFT 22 -#define FONT_STYLE_MASK 0xc00000 +#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) { @@ -1703,7 +1712,8 @@ static inline css_error set_font_style(css_computed_style *style, uint8_t type) bits = &style->i.bits[FONT_STYLE_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~FONT_STYLE_MASK) | ((type & 0x3) << FONT_STYLE_SHIFT); + *bits = (*bits & ~FONT_STYLE_MASK) | (((uint32_t)type & 0x3) << + FONT_STYLE_SHIFT); return CSS_OK; } @@ -1712,8 +1722,8 @@ 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 6 -#define FONT_VARIANT_MASK 0xc0 +#define FONT_VARIANT_SHIFT 10 +#define FONT_VARIANT_MASK 0xc00 static inline css_error set_font_variant(css_computed_style *style, uint8_t type) @@ -1723,7 +1733,7 @@ static inline css_error set_font_variant(css_computed_style *style, uint8_t bits = &style->i.bits[FONT_VARIANT_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~FONT_VARIANT_MASK) | ((type & 0x3) << + *bits = (*bits & ~FONT_VARIANT_MASK) | (((uint32_t)type & 0x3) << FONT_VARIANT_SHIFT); return CSS_OK; @@ -1732,7 +1742,7 @@ static inline css_error set_font_variant(css_computed_style *style, uint8_t #undef FONT_VARIANT_SHIFT #undef FONT_VARIANT_MASK -#define FONT_WEIGHT_INDEX 4 +#define FONT_WEIGHT_INDEX 3 #define FONT_WEIGHT_SHIFT 0 #define FONT_WEIGHT_MASK 0xf @@ -1743,7 +1753,7 @@ static inline css_error set_font_weight(css_computed_style *style, uint8_t type) bits = &style->i.bits[FONT_WEIGHT_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~FONT_WEIGHT_MASK) | ((type & 0xf) << + *bits = (*bits & ~FONT_WEIGHT_MASK) | (((uint32_t)type & 0xf) << FONT_WEIGHT_SHIFT); return CSS_OK; @@ -1752,7 +1762,7 @@ 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 2 +#define HEIGHT_INDEX 4 #define HEIGHT_SHIFT 4 #define HEIGHT_MASK 0x7f0 @@ -1764,8 +1774,8 @@ static inline css_error set_height(css_computed_style *style, uint8_t type, bits = &style->i.bits[HEIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << - HEIGHT_SHIFT); + *bits = (*bits & ~HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit << + 2)) << HEIGHT_SHIFT); style->i.height = length; @@ -1776,8 +1786,8 @@ static inline css_error set_height(css_computed_style *style, uint8_t type, #undef HEIGHT_MASK #define JUSTIFY_CONTENT_INDEX 8 -#define JUSTIFY_CONTENT_SHIFT 5 -#define JUSTIFY_CONTENT_MASK 0xe0 +#define JUSTIFY_CONTENT_SHIFT 8 +#define JUSTIFY_CONTENT_MASK 0x700 static inline css_error set_justify_content(css_computed_style *style, uint8_t type) @@ -1787,7 +1797,7 @@ static inline css_error set_justify_content(css_computed_style *style, uint8_t bits = &style->i.bits[JUSTIFY_CONTENT_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~JUSTIFY_CONTENT_MASK) | ((type & 0x7) << + *bits = (*bits & ~JUSTIFY_CONTENT_MASK) | (((uint32_t)type & 0x7) << JUSTIFY_CONTENT_SHIFT); return CSS_OK; @@ -1796,7 +1806,7 @@ 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 @@ -1808,8 +1818,8 @@ static inline css_error set_left(css_computed_style *style, uint8_t type, bits = &style->i.bits[LEFT_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~LEFT_MASK) | (((type & 0x3) | (unit << 2)) << - LEFT_SHIFT); + *bits = (*bits & ~LEFT_MASK) | ((((uint32_t)type & 0x3) | (unit << 2)) + << LEFT_SHIFT); style->i.left = length; @@ -1819,9 +1829,9 @@ 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 11 -#define LINE_HEIGHT_MASK 0x3f800 +#define LINE_HEIGHT_INDEX 1 +#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) @@ -1831,8 +1841,8 @@ static inline css_error set_line_height(css_computed_style *style, uint8_t bits = &style->i.bits[LINE_HEIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~LINE_HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << - LINE_HEIGHT_SHIFT); + *bits = (*bits & ~LINE_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << LINE_HEIGHT_SHIFT); style->i.line_height = length; @@ -1843,8 +1853,8 @@ 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 26 +#define LIST_STYLE_IMAGE_MASK 0x4000000 static inline css_error set_list_style_image(css_computed_style *style, uint8_t type, lwc_string *string) @@ -1854,7 +1864,7 @@ static inline css_error set_list_style_image(css_computed_style *style, uint8_t bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~LIST_STYLE_IMAGE_MASK) | ((type & 0x1) << + *bits = (*bits & ~LIST_STYLE_IMAGE_MASK) | (((uint32_t)type & 0x1) << LIST_STYLE_IMAGE_SHIFT); lwc_string *old_string = style->i.list_style_image; @@ -1875,8 +1885,8 @@ static inline css_error set_list_style_image(css_computed_style *style, uint8_t #undef LIST_STYLE_IMAGE_MASK #define LIST_STYLE_POSITION_INDEX 9 -#define LIST_STYLE_POSITION_SHIFT 0 -#define LIST_STYLE_POSITION_MASK 0x3 +#define LIST_STYLE_POSITION_SHIFT 2 +#define LIST_STYLE_POSITION_MASK 0xc static inline css_error set_list_style_position(css_computed_style *style, uint8_t type) @@ -1886,8 +1896,8 @@ static inline css_error set_list_style_position(css_computed_style *style, bits = &style->i.bits[LIST_STYLE_POSITION_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~LIST_STYLE_POSITION_MASK) | ((type & 0x3) << - LIST_STYLE_POSITION_SHIFT); + *bits = (*bits & ~LIST_STYLE_POSITION_MASK) | (((uint32_t)type & 0x3) + << LIST_STYLE_POSITION_SHIFT); return CSS_OK; } @@ -1895,9 +1905,9 @@ static inline css_error set_list_style_position(css_computed_style *style, #undef LIST_STYLE_POSITION_SHIFT #undef LIST_STYLE_POSITION_MASK -#define LIST_STYLE_TYPE_INDEX 3 -#define LIST_STYLE_TYPE_SHIFT 0 -#define LIST_STYLE_TYPE_MASK 0xf +#define LIST_STYLE_TYPE_INDEX 6 +#define LIST_STYLE_TYPE_SHIFT 18 +#define LIST_STYLE_TYPE_MASK 0x3c0000 static inline css_error set_list_style_type(css_computed_style *style, uint8_t type) @@ -1907,7 +1917,7 @@ static inline css_error set_list_style_type(css_computed_style *style, uint8_t bits = &style->i.bits[LIST_STYLE_TYPE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~LIST_STYLE_TYPE_MASK) | ((type & 0xf) << + *bits = (*bits & ~LIST_STYLE_TYPE_MASK) | (((uint32_t)type & 0xf) << LIST_STYLE_TYPE_SHIFT); return CSS_OK; @@ -1916,9 +1926,9 @@ static inline css_error set_list_style_type(css_computed_style *style, uint8_t #undef LIST_STYLE_TYPE_SHIFT #undef LIST_STYLE_TYPE_MASK -#define MARGIN_BOTTOM_INDEX 2 -#define MARGIN_BOTTOM_SHIFT 25 -#define MARGIN_BOTTOM_MASK 0xfe000000 +#define MARGIN_BOTTOM_INDEX 3 +#define MARGIN_BOTTOM_SHIFT 4 +#define MARGIN_BOTTOM_MASK 0x7f0 static inline css_error set_margin_bottom(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -1928,8 +1938,8 @@ static inline css_error set_margin_bottom(css_computed_style *style, uint8_t bits = &style->i.bits[MARGIN_BOTTOM_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~MARGIN_BOTTOM_MASK) | (((type & 0x3) | (unit << 2)) - << MARGIN_BOTTOM_SHIFT); + *bits = (*bits & ~MARGIN_BOTTOM_MASK) | ((((uint32_t)type & 0x3) | ( + unit << 2)) << MARGIN_BOTTOM_SHIFT); style->i.margin_bottom = length; @@ -1939,7 +1949,7 @@ 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 4 +#define MARGIN_LEFT_INDEX 1 #define MARGIN_LEFT_SHIFT 4 #define MARGIN_LEFT_MASK 0x7f0 @@ -1951,8 +1961,8 @@ static inline css_error set_margin_left(css_computed_style *style, uint8_t bits = &style->i.bits[MARGIN_LEFT_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~MARGIN_LEFT_MASK) | (((type & 0x3) | (unit << 2)) << - MARGIN_LEFT_SHIFT); + *bits = (*bits & ~MARGIN_LEFT_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << MARGIN_LEFT_SHIFT); style->i.margin_left = length; @@ -1962,9 +1972,9 @@ 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 1 -#define MARGIN_RIGHT_SHIFT 25 -#define MARGIN_RIGHT_MASK 0xfe000000 +#define MARGIN_RIGHT_INDEX 2 +#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) @@ -1974,8 +1984,8 @@ static inline css_error set_margin_right(css_computed_style *style, uint8_t bits = &style->i.bits[MARGIN_RIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~MARGIN_RIGHT_MASK) | (((type & 0x3) | (unit << 2)) << - MARGIN_RIGHT_SHIFT); + *bits = (*bits & ~MARGIN_RIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << MARGIN_RIGHT_SHIFT); style->i.margin_right = length; @@ -1985,7 +1995,7 @@ static inline css_error set_margin_right(css_computed_style *style, uint8_t #undef MARGIN_RIGHT_SHIFT #undef MARGIN_RIGHT_MASK -#define MARGIN_TOP_INDEX 4 +#define MARGIN_TOP_INDEX 3 #define MARGIN_TOP_SHIFT 18 #define MARGIN_TOP_MASK 0x1fc0000 @@ -1997,8 +2007,8 @@ static inline css_error set_margin_top(css_computed_style *style, uint8_t type, bits = &style->i.bits[MARGIN_TOP_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~MARGIN_TOP_MASK) | (((type & 0x3) | (unit << 2)) << - MARGIN_TOP_SHIFT); + *bits = (*bits & ~MARGIN_TOP_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << MARGIN_TOP_SHIFT); style->i.margin_top = length; @@ -2008,9 +2018,9 @@ 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 3 -#define MAX_HEIGHT_SHIFT 11 -#define MAX_HEIGHT_MASK 0x3f800 +#define MAX_HEIGHT_INDEX 2 +#define MAX_HEIGHT_SHIFT 4 +#define MAX_HEIGHT_MASK 0x7f0 static inline css_error set_max_height(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -2020,8 +2030,8 @@ static inline css_error set_max_height(css_computed_style *style, uint8_t type, bits = &style->i.bits[MAX_HEIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~MAX_HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << - MAX_HEIGHT_SHIFT); + *bits = (*bits & ~MAX_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << MAX_HEIGHT_SHIFT); style->i.max_height = length; @@ -2031,9 +2041,9 @@ 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 1 -#define MAX_WIDTH_SHIFT 18 -#define MAX_WIDTH_MASK 0x1fc0000 +#define MAX_WIDTH_INDEX 2 +#define MAX_WIDTH_SHIFT 25 +#define MAX_WIDTH_MASK 0xfe000000 static inline css_error set_max_width(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -2043,8 +2053,8 @@ static inline css_error set_max_width(css_computed_style *style, uint8_t type, bits = &style->i.bits[MAX_WIDTH_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~MAX_WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << - MAX_WIDTH_SHIFT); + *bits = (*bits & ~MAX_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit << + 2)) << MAX_WIDTH_SHIFT); style->i.max_width = length; @@ -2055,8 +2065,8 @@ static inline css_error set_max_width(css_computed_style *style, uint8_t type, #undef MAX_WIDTH_MASK #define MIN_HEIGHT_INDEX 3 -#define MIN_HEIGHT_SHIFT 4 -#define MIN_HEIGHT_MASK 0x7f0 +#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) @@ -2066,8 +2076,8 @@ static inline css_error set_min_height(css_computed_style *style, uint8_t type, bits = &style->i.bits[MIN_HEIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~MIN_HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << - MIN_HEIGHT_SHIFT); + *bits = (*bits & ~MIN_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit + << 2)) << MIN_HEIGHT_SHIFT); style->i.min_height = length; @@ -2077,9 +2087,9 @@ 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 2 -#define MIN_WIDTH_SHIFT 18 -#define MIN_WIDTH_MASK 0x1fc0000 +#define MIN_WIDTH_INDEX 1 +#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) @@ -2089,8 +2099,8 @@ static inline css_error set_min_width(css_computed_style *style, uint8_t type, bits = &style->i.bits[MIN_WIDTH_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~MIN_WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << - MIN_WIDTH_SHIFT); + *bits = (*bits & ~MIN_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit << + 2)) << MIN_WIDTH_SHIFT); style->i.min_width = length; @@ -2101,8 +2111,8 @@ 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 21 -#define OPACITY_MASK 0x200000 +#define OPACITY_SHIFT 22 +#define OPACITY_MASK 0x400000 static inline css_error set_opacity(css_computed_style *style, uint8_t type, css_fixed fixed) @@ -2112,7 +2122,8 @@ static inline css_error set_opacity(css_computed_style *style, uint8_t type, bits = &style->i.bits[OPACITY_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~OPACITY_MASK) | ((type & 0x1) << OPACITY_SHIFT); + *bits = (*bits & ~OPACITY_MASK) | (((uint32_t)type & 0x1) << + OPACITY_SHIFT); style->i.opacity = fixed; @@ -2123,8 +2134,8 @@ static inline css_error set_opacity(css_computed_style *style, uint8_t type, #undef OPACITY_MASK #define ORDER_INDEX 10 -#define ORDER_SHIFT 22 -#define ORDER_MASK 0x400000 +#define ORDER_SHIFT 27 +#define ORDER_MASK 0x8000000 static inline css_error set_order(css_computed_style *style, uint8_t type, int32_t integer) @@ -2134,7 +2145,7 @@ static inline css_error set_order(css_computed_style *style, uint8_t type, bits = &style->i.bits[ORDER_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~ORDER_MASK) | ((type & 0x1) << ORDER_SHIFT); + *bits = (*bits & ~ORDER_MASK) | (((uint32_t)type & 0x1) << ORDER_SHIFT); style->i.order = integer; @@ -2144,9 +2155,9 @@ static inline css_error set_order(css_computed_style *style, uint8_t type, #undef ORDER_SHIFT #undef ORDER_MASK -#define OUTLINE_STYLE_INDEX 6 -#define OUTLINE_STYLE_SHIFT 6 -#define OUTLINE_STYLE_MASK 0x3c0 +#define OUTLINE_STYLE_INDEX 1 +#define OUTLINE_STYLE_SHIFT 0 +#define OUTLINE_STYLE_MASK 0xf static inline css_error set_outline_style(css_computed_style *style, uint8_t type) @@ -2156,7 +2167,7 @@ static inline css_error set_outline_style(css_computed_style *style, uint8_t bits = &style->i.bits[OUTLINE_STYLE_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~OUTLINE_STYLE_MASK) | ((type & 0xf) << + *bits = (*bits & ~OUTLINE_STYLE_MASK) | (((uint32_t)type & 0xf) << OUTLINE_STYLE_SHIFT); return CSS_OK; @@ -2166,8 +2177,8 @@ static inline css_error set_outline_style(css_computed_style *style, uint8_t #undef OUTLINE_STYLE_MASK #define OVERFLOW_X_INDEX 8 -#define OVERFLOW_X_SHIFT 2 -#define OVERFLOW_X_MASK 0x1c +#define OVERFLOW_X_SHIFT 5 +#define OVERFLOW_X_MASK 0xe0 static inline css_error set_overflow_x(css_computed_style *style, uint8_t type) { @@ -2176,7 +2187,8 @@ static inline css_error set_overflow_x(css_computed_style *style, uint8_t type) bits = &style->i.bits[OVERFLOW_X_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~OVERFLOW_X_MASK) | ((type & 0x7) << OVERFLOW_X_SHIFT); + *bits = (*bits & ~OVERFLOW_X_MASK) | (((uint32_t)type & 0x7) << + OVERFLOW_X_SHIFT); return CSS_OK; } @@ -2185,8 +2197,8 @@ static inline css_error set_overflow_x(css_computed_style *style, uint8_t type) #undef OVERFLOW_X_MASK #define OVERFLOW_Y_INDEX 8 -#define OVERFLOW_Y_SHIFT 23 -#define OVERFLOW_Y_MASK 0x3800000 +#define OVERFLOW_Y_SHIFT 29 +#define OVERFLOW_Y_MASK 0xe0000000 static inline css_error set_overflow_y(css_computed_style *style, uint8_t type) { @@ -2195,7 +2207,8 @@ static inline css_error set_overflow_y(css_computed_style *style, uint8_t type) bits = &style->i.bits[OVERFLOW_Y_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~OVERFLOW_Y_MASK) | ((type & 0x7) << OVERFLOW_Y_SHIFT); + *bits = (*bits & ~OVERFLOW_Y_MASK) | (((uint32_t)type & 0x7) << + OVERFLOW_Y_SHIFT); return CSS_OK; } @@ -2204,8 +2217,8 @@ static inline css_error set_overflow_y(css_computed_style *style, uint8_t type) #undef OVERFLOW_Y_MASK #define PADDING_BOTTOM_INDEX 7 -#define PADDING_BOTTOM_SHIFT 2 -#define PADDING_BOTTOM_MASK 0xfc +#define PADDING_BOTTOM_SHIFT 20 +#define PADDING_BOTTOM_MASK 0x3f00000 static inline css_error set_padding_bottom(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -2215,8 +2228,8 @@ static inline css_error set_padding_bottom(css_computed_style *style, uint8_t bits = &style->i.bits[PADDING_BOTTOM_INDEX]; /* 6bits: uuuuut : unit | type */ - *bits = (*bits & ~PADDING_BOTTOM_MASK) | (((type & 0x1) | (unit << 1)) - << PADDING_BOTTOM_SHIFT); + *bits = (*bits & ~PADDING_BOTTOM_MASK) | ((((uint32_t)type & 0x1) | ( + unit << 1)) << PADDING_BOTTOM_SHIFT); style->i.padding_bottom = length; @@ -2227,8 +2240,8 @@ 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 20 -#define PADDING_LEFT_MASK 0x3f00000 +#define PADDING_LEFT_SHIFT 26 +#define PADDING_LEFT_MASK 0xfc000000 static inline css_error set_padding_left(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -2238,8 +2251,8 @@ static inline css_error set_padding_left(css_computed_style *style, uint8_t bits = &style->i.bits[PADDING_LEFT_INDEX]; /* 6bits: uuuuut : unit | type */ - *bits = (*bits & ~PADDING_LEFT_MASK) | (((type & 0x1) | (unit << 1)) << - PADDING_LEFT_SHIFT); + *bits = (*bits & ~PADDING_LEFT_MASK) | ((((uint32_t)type & 0x1) | (unit + << 1)) << PADDING_LEFT_SHIFT); style->i.padding_left = length; @@ -2250,8 +2263,8 @@ 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 14 -#define PADDING_RIGHT_MASK 0xfc000 +#define PADDING_RIGHT_SHIFT 8 +#define PADDING_RIGHT_MASK 0x3f00 static inline css_error set_padding_right(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -2261,8 +2274,8 @@ static inline css_error set_padding_right(css_computed_style *style, uint8_t bits = &style->i.bits[PADDING_RIGHT_INDEX]; /* 6bits: uuuuut : unit | type */ - *bits = (*bits & ~PADDING_RIGHT_MASK) | (((type & 0x1) | (unit << 1)) - << PADDING_RIGHT_SHIFT); + *bits = (*bits & ~PADDING_RIGHT_MASK) | ((((uint32_t)type & 0x1) | ( + unit << 1)) << PADDING_RIGHT_SHIFT); style->i.padding_right = length; @@ -2273,8 +2286,8 @@ static inline css_error set_padding_right(css_computed_style *style, uint8_t #undef PADDING_RIGHT_MASK #define PADDING_TOP_INDEX 7 -#define PADDING_TOP_SHIFT 26 -#define PADDING_TOP_MASK 0xfc000000 +#define PADDING_TOP_SHIFT 14 +#define PADDING_TOP_MASK 0xfc000 static inline css_error set_padding_top(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -2284,8 +2297,8 @@ static inline css_error set_padding_top(css_computed_style *style, uint8_t bits = &style->i.bits[PADDING_TOP_INDEX]; /* 6bits: uuuuut : unit | type */ - *bits = (*bits & ~PADDING_TOP_MASK) | (((type & 0x1) | (unit << 1)) << - PADDING_TOP_SHIFT); + *bits = (*bits & ~PADDING_TOP_MASK) | ((((uint32_t)type & 0x1) | (unit + << 1)) << PADDING_TOP_SHIFT); style->i.padding_top = length; @@ -2295,9 +2308,9 @@ static inline css_error set_padding_top(css_computed_style *style, uint8_t #undef PADDING_TOP_SHIFT #undef PADDING_TOP_MASK -#define POSITION_INDEX 8 -#define POSITION_SHIFT 14 -#define POSITION_MASK 0x1c000 +#define POSITION_INDEX 5 +#define POSITION_SHIFT 0 +#define POSITION_MASK 0x7 static inline css_error set_position(css_computed_style *style, uint8_t type) { @@ -2306,7 +2319,8 @@ static inline css_error set_position(css_computed_style *style, uint8_t type) bits = &style->i.bits[POSITION_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~POSITION_MASK) | ((type & 0x7) << POSITION_SHIFT); + *bits = (*bits & ~POSITION_MASK) | (((uint32_t)type & 0x7) << + POSITION_SHIFT); return CSS_OK; } @@ -2315,8 +2329,8 @@ static inline css_error set_position(css_computed_style *style, uint8_t type) #undef POSITION_MASK #define QUOTES_INDEX 10 -#define QUOTES_SHIFT 24 -#define QUOTES_MASK 0x1000000 +#define QUOTES_SHIFT 20 +#define QUOTES_MASK 0x100000 static inline css_error set_quotes(css_computed_style *style, uint8_t type, lwc_string **string_arr) @@ -2326,7 +2340,8 @@ static inline css_error set_quotes(css_computed_style *style, uint8_t type, bits = &style->i.bits[QUOTES_INDEX]; /* 1bit: t : type */ - *bits = (*bits & ~QUOTES_MASK) | ((type & 0x1) << QUOTES_SHIFT); + *bits = (*bits & ~QUOTES_MASK) | (((uint32_t)type & 0x1) << + QUOTES_SHIFT); lwc_string **old_string_arr = style->quotes; lwc_string **s; @@ -2351,9 +2366,9 @@ static inline css_error set_quotes(css_computed_style *style, uint8_t type, #undef QUOTES_SHIFT #undef QUOTES_MASK -#define RIGHT_INDEX 4 -#define RIGHT_SHIFT 25 -#define RIGHT_MASK 0xfe000000 +#define RIGHT_INDEX 1 +#define RIGHT_SHIFT 18 +#define RIGHT_MASK 0x1fc0000 static inline css_error set_right(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -2363,8 +2378,8 @@ static inline css_error set_right(css_computed_style *style, uint8_t type, bits = &style->i.bits[RIGHT_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~RIGHT_MASK) | (((type & 0x3) | (unit << 2)) << - RIGHT_SHIFT); + *bits = (*bits & ~RIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit << 2)) + << RIGHT_SHIFT); style->i.right = length; @@ -2375,8 +2390,8 @@ static inline css_error set_right(css_computed_style *style, uint8_t type, #undef RIGHT_MASK #define TABLE_LAYOUT_INDEX 9 -#define TABLE_LAYOUT_SHIFT 30 -#define TABLE_LAYOUT_MASK 0xc0000000 +#define TABLE_LAYOUT_SHIFT 0 +#define TABLE_LAYOUT_MASK 0x3 static inline css_error set_table_layout(css_computed_style *style, uint8_t type) @@ -2386,7 +2401,7 @@ static inline css_error set_table_layout(css_computed_style *style, uint8_t bits = &style->i.bits[TABLE_LAYOUT_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~TABLE_LAYOUT_MASK) | ((type & 0x3) << + *bits = (*bits & ~TABLE_LAYOUT_MASK) | (((uint32_t)type & 0x3) << TABLE_LAYOUT_SHIFT); return CSS_OK; @@ -2395,9 +2410,9 @@ static inline css_error set_table_layout(css_computed_style *style, uint8_t #undef TABLE_LAYOUT_SHIFT #undef TABLE_LAYOUT_MASK -#define TEXT_ALIGN_INDEX 6 -#define TEXT_ALIGN_SHIFT 10 -#define TEXT_ALIGN_MASK 0x3c00 +#define TEXT_ALIGN_INDEX 2 +#define TEXT_ALIGN_SHIFT 0 +#define TEXT_ALIGN_MASK 0xf static inline css_error set_text_align(css_computed_style *style, uint8_t type) { @@ -2406,7 +2421,8 @@ static inline css_error set_text_align(css_computed_style *style, uint8_t type) bits = &style->i.bits[TEXT_ALIGN_INDEX]; /* 4bits: tttt : type */ - *bits = (*bits & ~TEXT_ALIGN_MASK) | ((type & 0xf) << TEXT_ALIGN_SHIFT); + *bits = (*bits & ~TEXT_ALIGN_MASK) | (((uint32_t)type & 0xf) << + TEXT_ALIGN_SHIFT); return CSS_OK; } @@ -2426,7 +2442,7 @@ static inline css_error set_text_decoration(css_computed_style *style, uint8_t bits = &style->i.bits[TEXT_DECORATION_INDEX]; /* 5bits: ttttt : type */ - *bits = (*bits & ~TEXT_DECORATION_MASK) | ((type & 0x1f) << + *bits = (*bits & ~TEXT_DECORATION_MASK) | (((uint32_t)type & 0x1f) << TEXT_DECORATION_SHIFT); return CSS_OK; @@ -2436,8 +2452,8 @@ 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 8 -#define TEXT_INDENT_MASK 0x3f00 +#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) @@ -2447,8 +2463,8 @@ static inline css_error set_text_indent(css_computed_style *style, uint8_t bits = &style->i.bits[TEXT_INDENT_INDEX]; /* 6bits: uuuuut : unit | type */ - *bits = (*bits & ~TEXT_INDENT_MASK) | (((type & 0x1) | (unit << 1)) << - TEXT_INDENT_SHIFT); + *bits = (*bits & ~TEXT_INDENT_MASK) | ((((uint32_t)type & 0x1) | (unit + << 1)) << TEXT_INDENT_SHIFT); style->i.text_indent = length; @@ -2458,9 +2474,9 @@ 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 8 -#define TEXT_TRANSFORM_SHIFT 29 -#define TEXT_TRANSFORM_MASK 0xe0000000 +#define TEXT_TRANSFORM_INDEX 6 +#define TEXT_TRANSFORM_SHIFT 3 +#define TEXT_TRANSFORM_MASK 0x38 static inline css_error set_text_transform(css_computed_style *style, uint8_t type) @@ -2470,7 +2486,7 @@ static inline css_error set_text_transform(css_computed_style *style, uint8_t bits = &style->i.bits[TEXT_TRANSFORM_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~TEXT_TRANSFORM_MASK) | ((type & 0x7) << + *bits = (*bits & ~TEXT_TRANSFORM_MASK) | (((uint32_t)type & 0x7) << TEXT_TRANSFORM_SHIFT); return CSS_OK; @@ -2479,9 +2495,9 @@ static inline css_error set_text_transform(css_computed_style *style, uint8_t #undef TEXT_TRANSFORM_SHIFT #undef TEXT_TRANSFORM_MASK -#define TOP_INDEX 4 -#define TOP_SHIFT 11 -#define TOP_MASK 0x3f800 +#define TOP_INDEX 3 +#define TOP_SHIFT 25 +#define TOP_MASK 0xfe000000 static inline css_error set_top(css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) @@ -2491,8 +2507,8 @@ static inline css_error set_top(css_computed_style *style, uint8_t type, bits = &style->i.bits[TOP_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~TOP_MASK) | (((type & 0x3) | (unit << 2)) << - TOP_SHIFT); + *bits = (*bits & ~TOP_MASK) | ((((uint32_t)type & 0x3) | (unit << 2)) + << TOP_SHIFT); style->i.top = length; @@ -2503,8 +2519,8 @@ static inline css_error set_top(css_computed_style *style, uint8_t type, #undef TOP_MASK #define UNICODE_BIDI_INDEX 9 -#define UNICODE_BIDI_SHIFT 4 -#define UNICODE_BIDI_MASK 0x30 +#define UNICODE_BIDI_SHIFT 16 +#define UNICODE_BIDI_MASK 0x30000 static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t type) @@ -2514,7 +2530,7 @@ static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t bits = &style->i.bits[UNICODE_BIDI_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~UNICODE_BIDI_MASK) | ((type & 0x3) << + *bits = (*bits & ~UNICODE_BIDI_MASK) | (((uint32_t)type & 0x3) << UNICODE_BIDI_SHIFT); return CSS_OK; @@ -2535,8 +2551,8 @@ static inline css_error set_vertical_align(css_computed_style *style, uint8_t bits = &style->i.bits[VERTICAL_ALIGN_INDEX]; /* 9bits: uuuuutttt : unit | type */ - *bits = (*bits & ~VERTICAL_ALIGN_MASK) | (((type & 0xf) | (unit << 4)) - << VERTICAL_ALIGN_SHIFT); + *bits = (*bits & ~VERTICAL_ALIGN_MASK) | ((((uint32_t)type & 0xf) | ( + unit << 4)) << VERTICAL_ALIGN_SHIFT); style->i.vertical_align = length; @@ -2546,9 +2562,9 @@ static inline css_error set_vertical_align(css_computed_style *style, uint8_t #undef VERTICAL_ALIGN_SHIFT #undef VERTICAL_ALIGN_MASK -#define VISIBILITY_INDEX 9 -#define VISIBILITY_SHIFT 18 -#define VISIBILITY_MASK 0xc0000 +#define VISIBILITY_INDEX 10 +#define VISIBILITY_SHIFT 28 +#define VISIBILITY_MASK 0x30000000 static inline css_error set_visibility(css_computed_style *style, uint8_t type) { @@ -2557,7 +2573,8 @@ static inline css_error set_visibility(css_computed_style *style, uint8_t type) bits = &style->i.bits[VISIBILITY_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~VISIBILITY_MASK) | ((type & 0x3) << VISIBILITY_SHIFT); + *bits = (*bits & ~VISIBILITY_MASK) | (((uint32_t)type & 0x3) << + VISIBILITY_SHIFT); return CSS_OK; } @@ -2565,7 +2582,7 @@ static inline css_error set_visibility(css_computed_style *style, uint8_t type) #undef VISIBILITY_SHIFT #undef VISIBILITY_MASK -#define WHITE_SPACE_INDEX 5 +#define WHITE_SPACE_INDEX 6 #define WHITE_SPACE_SHIFT 0 #define WHITE_SPACE_MASK 0x7 @@ -2576,7 +2593,7 @@ static inline css_error set_white_space(css_computed_style *style, uint8_t type) bits = &style->i.bits[WHITE_SPACE_INDEX]; /* 3bits: ttt : type */ - *bits = (*bits & ~WHITE_SPACE_MASK) | ((type & 0x7) << + *bits = (*bits & ~WHITE_SPACE_MASK) | (((uint32_t)type & 0x7) << WHITE_SPACE_SHIFT); return CSS_OK; @@ -2585,9 +2602,9 @@ 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 1 -#define WIDTH_SHIFT 11 -#define WIDTH_MASK 0x3f800 +#define WIDTH_INDEX 4 +#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) @@ -2597,8 +2614,8 @@ static inline css_error set_width(css_computed_style *style, uint8_t type, bits = &style->i.bits[WIDTH_INDEX]; /* 7bits: uuuuutt : unit | type */ - *bits = (*bits & ~WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << - WIDTH_SHIFT); + *bits = (*bits & ~WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit << 2)) + << WIDTH_SHIFT); style->i.width = length; @@ -2608,9 +2625,9 @@ static inline css_error set_width(css_computed_style *style, uint8_t type, #undef WIDTH_SHIFT #undef WIDTH_MASK -#define Z_INDEX_INDEX 9 -#define Z_INDEX_SHIFT 24 -#define Z_INDEX_MASK 0x3000000 +#define Z_INDEX_INDEX 10 +#define Z_INDEX_SHIFT 30 +#define Z_INDEX_MASK 0xc0000000 static inline css_error set_z_index(css_computed_style *style, uint8_t type, int32_t integer) @@ -2620,7 +2637,8 @@ static inline css_error set_z_index(css_computed_style *style, uint8_t type, bits = &style->i.bits[Z_INDEX_INDEX]; /* 2bits: tt : type */ - *bits = (*bits & ~Z_INDEX_MASK) | ((type & 0x3) << Z_INDEX_SHIFT); + *bits = (*bits & ~Z_INDEX_MASK) | (((uint32_t)type & 0x3) << + Z_INDEX_SHIFT); style->i.z_index = integer; diff --git a/src/select/select_generator.py b/src/select/select_generator.py index f87c929..4de99cb 100644 --- a/src/select/select_generator.py +++ b/src/select/select_generator.py @@ -625,7 +625,7 @@ class CSSGroup: type_mask, shift_list, bits_comment = p.get_bits() t.append(bits_comment) - type_mask = '(type & {})'.format(type_mask) + type_mask = '((uint32_t)type & {})'.format(type_mask) val_list = [ '({} << {})'.format(x[0], x[1]) for x in shift_list ] ops_str = ' | '.join([ type_mask ] + val_list) t.append('*bits = (*bits & ~{0}_MASK) | ' -- cgit v1.2.3