summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Neves <lcneves@gmail.com>2017-11-07 23:15:23 -0500
committerLucas Neves <lcneves@gmail.com>2017-11-07 23:15:23 -0500
commit00249915205c0bc7b15b7bfcc911c5587bef3171 (patch)
tree945fbeeb47ce2063b3a77ec77b54adda59d4959e
parent07e70a6e395dde906434995110c93e892b09b585 (diff)
downloadlibcss-00249915205c0bc7b15b7bfcc911c5587bef3171.tar.gz
WIP: Select: autogen for selection properties.
-rw-r--r--src/select/autogenerated_computed.h78
-rw-r--r--src/select/autogenerated_propset.h1490
-rw-r--r--src/select/select_generator.py135
3 files changed, 1391 insertions, 312 deletions
diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h
index 543785c..cd29a5f 100644
--- a/src/select/autogenerated_computed.h
+++ b/src/select/autogenerated_computed.h
@@ -61,18 +61,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 cccccccooooooowwwwwwwlllllllbbbb
- * column_width; column_gap; word_spacing; letter_spacing; break_before
+ * 1 wwwwwwwccccccclllllllooooooobbbb
+ * word_spacing; column_gap; letter_spacing; column_width; break_before
*
- * 2 ccccccccccccccccccccccccccbbbboo
- * clip; break_after; column_fill
+ * 2 ccccccccccccccccccccccccccooooll
+ * clip; column_rule_style; column_rule_color
*
- * 3 ccccbbbboolluuttmmne............
- * column_rule_style; break_inside; content; column_count; column_rule_color;
- * outline_color; column_span; counter_increment; counter_reset
+ * 3 bbbbrrrrccoouullnnte............
+ * break_inside; break_after; column_fill; column_count; outline_color;
+ * column_span; content; counter_reset; counter_increment
*/
uint32_t bits[4];
@@ -125,7 +125,7 @@ typedef struct css_computed_page {
* Bit allocations:
*
* 0 pppaaaggwo......................
- * page_break_before; page_break_after; page_break_inside; widows; orphans
+ * page_break_after; page_break_before; page_break_inside; widows; orphans
*/
uint32_t bits[1];
@@ -231,45 +231,45 @@ struct css_computed_style_i {
* Bit allocations:
*
* 0 bbbbbbbboooooooorrrrrrrrdddddddd
- * border_right_width; border_top_width; border_bottom_width; border_left_width
+ * border_top_width; border_left_width; border_bottom_width; border_right_width
*
- * 1 ttttttthhhhhhhmmmmmmmiiiiiiiffff
- * top; height; max_width; min_height; font_weight
+ * 1 lllllllhhhhhhhmmmmmmmttttttteeee
+ * left; height; margin_top; top; text_align
*
- * 2 mmmmmmmbbbbbbbaaaaaaarrrrrrroooo
- * min_width; bottom; margin_top; margin_bottom; border_top_style
+ * 2 mmmmmmmaaaaaaaiiiiiiibbbbbbboooo
+ * margin_bottom; max_width; min_height; bottom; border_top_style
*
- * 3 fffffffwwwwwwwmmmmmmmrrrrrrrbbbb
- * flex_basis; width; max_height; right; border_right_style
+ * 3 mmmmmmmrrrrrrraaaaaaawwwwwwwbbbb
+ * min_width; right; margin_right; width; border_left_style
*
- * 4 lllllllmmmmmmmiiiiiiiaaaaaaabbbb
- * left; margin_right; line_height; margin_left; border_left_style
+ * 4 fffffffmmmmmmmaaaaaaalllllllbbbb
+ * flex_basis; max_height; margin_left; line_height; border_right_style
*
- * 5 bbbbbbbbbbbfffffffffvvvvvvvvvppp
- * background_position; font_size; vertical_align; position
+ * 5 bbbbbbbbbbbfffffffffvvvvvvvvvooo
+ * background_position; font_size; vertical_align; overflow
*
- * 6 tttttdddddllllbbbbooooeeeeaaafff
- * text_decoration; display; list_style_type; border_bottom_style;
- * outline_style; text_align; align_content; font_family
+ * 6 dddddtttttlllloooobbbbffffpppeee
+ * display; text_decoration; list_style_type; outline_style;
+ * border_bottom_style; font_weight; position; text_transform
*
- * 7 ppppppaaaaaaddddddttttttiiiiiiff
- * padding_bottom; padding_right; padding_left; text_indent; padding_top;
- * font_variant
+ * 7 ppppppttttttaaaaaaddddddiiiiiirr
+ * padding_bottom; text_indent; padding_left; padding_right; padding_top;
+ * direction
*
- * 8 ttccbbaaffvvooeerrzzkknnddllmmii
- * table_layout; caption_side; border_right_color; background_attachment;
- * float; visibility; box_sizing; empty_cells; border_top_color; z_index;
- * background_color; font_style; direction; border_collapse;
- * border_bottom_color; list_style_position
+ * 8 ccbbvvooaaffrrddllxxeewwttmmzznn
+ * caption_side; background_attachment; visibility; border_left_color;
+ * background_color; font_variant; border_right_color; border_collapse; float;
+ * box_sizing; border_top_color; flex_wrap; border_bottom_color; empty_cells;
+ * z_index; font_style
*
- * 9 fffbbbaaatttccclllwwwooojjjuueer
- * flex_direction; background_repeat; align_items; text_transform; clear;
- * align_self; white_space; overflow; justify_content; unicode_bidi; flex_wrap;
- * color
+ * 9 cccwwwjjjaaallliiifffeeebbbttssq
+ * clear; white_space; justify_content; align_items; align_self; align_content;
+ * font_family; flex_direction; background_repeat; table_layout;
+ * list_style_position; quotes
*
- * 10 bbfaqlior.......................
- * border_left_color; flex_shrink; background_image; quotes; flex_grow;
- * list_style_image; opacity; order
+ * 10 uubflcori.......................
+ * unicode_bidi; background_image; flex_grow; flex_shrink; color; opacity;
+ * order; list_style_image
*/
uint32_t bits[11];
diff --git a/src/select/autogenerated_propset.h b/src/select/autogenerated_propset.h
index f959500..4674a3a 100644
--- a/src/select/autogenerated_propset.h
+++ b/src/select/autogenerated_propset.h
@@ -26,24 +26,24 @@ 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_INHERIT,
- (CSS_COLUMN_WIDTH_AUTO << 25) | (CSS_COLUMN_GAP_NORMAL
- << 18) | (CSS_WORD_SPACING_NORMAL <<
- 11) | (CSS_LETTER_SPACING_NORMAL << 4)
- | CSS_BREAK_BEFORE_AUTO,
- (CSS_CLIP_AUTO << 6) | (CSS_BREAK_AFTER_AUTO << 2) |
- CSS_COLUMN_FILL_BALANCE,
- (CSS_COLUMN_RULE_STYLE_NONE << 28) | (
- CSS_BREAK_INSIDE_AUTO << 24) | (
- CSS_CONTENT_NORMAL << 22) | (
- CSS_COLUMN_COUNT_AUTO << 20) | (
- CSS_COLUMN_RULE_CURRENT_COLOR << 18) | (
- CSS_OUTLINE_COLOR_INVERT << 16) | (
- CSS_COLUMN_SPAN_NONE << 14) | (
- CSS_COUNTER_INCREMENT_NONE << 13) | (
- CSS_COUNTER_RESET_NONE << 12)
+ (CSS_WORD_SPACING_NORMAL << 25) | (
+ CSS_COLUMN_GAP_NORMAL << 18) | (
+ CSS_LETTER_SPACING_NORMAL << 11) | (
+ CSS_COLUMN_WIDTH_AUTO << 4) |
+ CSS_BREAK_BEFORE_AUTO,
+ (CSS_CLIP_AUTO << 6) | (CSS_COLUMN_RULE_STYLE_NONE <<
+ 2) | CSS_COLUMN_RULE_CURRENT_COLOR,
+ (CSS_BREAK_INSIDE_AUTO << 28) | (CSS_BREAK_AFTER_AUTO
+ << 24) | (CSS_COLUMN_FILL_BALANCE <<
+ 22) | (CSS_COLUMN_COUNT_AUTO << 20) | (
+ CSS_OUTLINE_COLOR_INVERT << 18) | (
+ CSS_COLUMN_SPAN_NONE << 16) | (
+ CSS_CONTENT_NORMAL << 14) | (
+ CSS_COUNTER_RESET_NONE << 13) | (
+ CSS_COUNTER_INCREMENT_NONE << 12)
},
.border_spacing_a = 0,
.border_spacing_b = 0,
@@ -82,135 +82,388 @@ static const css_computed_uncommon default_uncommon = {
} \
} while(0) \
+
#define BORDER_SPACING_INDEX 0
#define BORDER_SPACING_SHIFT 21
#define BORDER_SPACING_MASK 0xffe00000
+static inline css_error set_border_spacing(css_computed_style *style, uint8_t
+ type, css_fixed length_a, css_unit unit_a, css_fixed length_b,
+ css_unit unit_b)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[BORDER_SPACING_INDEX];
+ /*
+ * 11bits: aaaaabbbbbt : unit_a | unit_b | type
+ */
#undef BORDER_SPACING_INDEX
#undef BORDER_SPACING_SHIFT
#undef BORDER_SPACING_MASK
-#define BREAK_AFTER_INDEX 2
-#define BREAK_AFTER_SHIFT 2
-#define BREAK_AFTER_MASK 0x3c
+
+#define BREAK_AFTER_INDEX 3
+#define BREAK_AFTER_SHIFT 24
+#define BREAK_AFTER_MASK 0xf000000
+static inline css_error set_break_after(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[BREAK_AFTER_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef BREAK_AFTER_INDEX
#undef BREAK_AFTER_SHIFT
#undef BREAK_AFTER_MASK
+
#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)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[BREAK_BEFORE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef BREAK_BEFORE_INDEX
#undef BREAK_BEFORE_SHIFT
#undef BREAK_BEFORE_MASK
+
#define BREAK_INSIDE_INDEX 3
-#define BREAK_INSIDE_SHIFT 24
-#define BREAK_INSIDE_MASK 0xf000000
+#define BREAK_INSIDE_SHIFT 28
+#define BREAK_INSIDE_MASK 0xf0000000
+static inline css_error set_break_inside(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[BREAK_INSIDE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef BREAK_INSIDE_INDEX
#undef BREAK_INSIDE_SHIFT
#undef BREAK_INSIDE_MASK
+
#define CLIP_INDEX 2
#define CLIP_SHIFT 6
#define CLIP_MASK 0xffffffc0
+static inline css_error set_clip(css_computed_style *style, uint8_t type,
+ css_fixed length_a, css_unit unit_a, css_fixed length_b,
+ css_unit unit_b, css_fixed length_c, css_unit unit_c, css_fixed
+ length_d, css_unit unit_d)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[CLIP_INDEX];
+ /*
+ * 26bits: aaaaabbbbbcccccdddddtttttt : unit_a | unit_b | unit_c |
+ * unit_d | type
+ */
#undef CLIP_INDEX
#undef CLIP_SHIFT
#undef CLIP_MASK
+
#define COLUMN_COUNT_INDEX 3
#define COLUMN_COUNT_SHIFT 20
#define COLUMN_COUNT_MASK 0x300000
+static inline css_error set_column_count(css_computed_style *style, uint8_t
+ type, int32_t integer)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COLUMN_COUNT_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef COLUMN_COUNT_INDEX
#undef COLUMN_COUNT_SHIFT
#undef COLUMN_COUNT_MASK
-#define COLUMN_FILL_INDEX 2
-#define COLUMN_FILL_SHIFT 0
-#define COLUMN_FILL_MASK 0x3
+
+#define COLUMN_FILL_INDEX 3
+#define COLUMN_FILL_SHIFT 22
+#define COLUMN_FILL_MASK 0xc00000
+static inline css_error set_column_fill(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COLUMN_FILL_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef COLUMN_FILL_INDEX
#undef COLUMN_FILL_SHIFT
#undef COLUMN_FILL_MASK
+
#define COLUMN_GAP_INDEX 1
#define COLUMN_GAP_SHIFT 18
#define COLUMN_GAP_MASK 0x1fc0000
+static inline css_error set_column_gap(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COLUMN_GAP_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef COLUMN_GAP_INDEX
#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)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COLUMN_RULE_COLOR_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef COLUMN_RULE_COLOR_INDEX
#undef COLUMN_RULE_COLOR_SHIFT
#undef COLUMN_RULE_COLOR_MASK
-#define COLUMN_RULE_STYLE_INDEX 3
-#define COLUMN_RULE_STYLE_SHIFT 28
-#define COLUMN_RULE_STYLE_MASK 0xf0000000
+
+#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)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COLUMN_RULE_STYLE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef COLUMN_RULE_STYLE_INDEX
#undef COLUMN_RULE_STYLE_SHIFT
#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)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COLUMN_RULE_WIDTH_INDEX];
+ /*
+ * 8bits: uuuuuttt : unit | type
+ */
#undef COLUMN_RULE_WIDTH_INDEX
#undef COLUMN_RULE_WIDTH_SHIFT
#undef COLUMN_RULE_WIDTH_MASK
+
#define COLUMN_SPAN_INDEX 3
-#define COLUMN_SPAN_SHIFT 14
-#define COLUMN_SPAN_MASK 0xc000
+#define COLUMN_SPAN_SHIFT 16
+#define COLUMN_SPAN_MASK 0x30000
+static inline css_error set_column_span(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COLUMN_SPAN_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef COLUMN_SPAN_INDEX
#undef COLUMN_SPAN_SHIFT
#undef COLUMN_SPAN_MASK
+
#define COLUMN_WIDTH_INDEX 1
-#define COLUMN_WIDTH_SHIFT 25
-#define COLUMN_WIDTH_MASK 0xfe000000
+#define COLUMN_WIDTH_SHIFT 4
+#define COLUMN_WIDTH_MASK 0x7f0
+static inline css_error set_column_width(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COLUMN_WIDTH_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef COLUMN_WIDTH_INDEX
#undef COLUMN_WIDTH_SHIFT
#undef COLUMN_WIDTH_MASK
+
#define CONTENT_INDEX 3
-#define CONTENT_SHIFT 22
-#define CONTENT_MASK 0xc00000
+#define CONTENT_SHIFT 14
+#define CONTENT_MASK 0xc000
+static inline css_error set_content(css_computed_style *style, uint8_t type,
+ css_computed_content_item *content_item)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[CONTENT_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef CONTENT_INDEX
#undef CONTENT_SHIFT
#undef CONTENT_MASK
+
#define COUNTER_INCREMENT_INDEX 3
-#define COUNTER_INCREMENT_SHIFT 13
-#define COUNTER_INCREMENT_MASK 0x2000
+#define COUNTER_INCREMENT_SHIFT 12
+#define COUNTER_INCREMENT_MASK 0x1000
+static inline css_error set_counter_increment(css_computed_style *style,
+ uint8_t type, css_computed_counter *counter)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COUNTER_INCREMENT_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef COUNTER_INCREMENT_INDEX
#undef COUNTER_INCREMENT_SHIFT
#undef COUNTER_INCREMENT_MASK
+
#define COUNTER_RESET_INDEX 3
-#define COUNTER_RESET_SHIFT 12
-#define COUNTER_RESET_MASK 0x1000
+#define COUNTER_RESET_SHIFT 13
+#define COUNTER_RESET_MASK 0x2000
+static inline css_error set_counter_reset(css_computed_style *style, uint8_t
+ type, css_computed_counter *counter)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[COUNTER_RESET_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef COUNTER_RESET_INDEX
#undef COUNTER_RESET_SHIFT
#undef COUNTER_RESET_MASK
+
#define CURSOR_INDEX 0
#define CURSOR_SHIFT 0
#define CURSOR_MASK 0x1f
+static inline css_error set_cursor(css_computed_style *style, uint8_t type,
+ lwc_string **string_arr)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[CURSOR_INDEX];
+ /*
+ * 5bits: ttttt : type
+ */
#undef CURSOR_INDEX
#undef CURSOR_SHIFT
#undef CURSOR_MASK
+
#define LETTER_SPACING_INDEX 1
-#define LETTER_SPACING_SHIFT 4
-#define LETTER_SPACING_MASK 0x7f0
+#define LETTER_SPACING_SHIFT 11
+#define LETTER_SPACING_MASK 0x3f800
+static inline css_error set_letter_spacing(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[LETTER_SPACING_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef LETTER_SPACING_INDEX
#undef LETTER_SPACING_SHIFT
#undef LETTER_SPACING_MASK
+
#define OUTLINE_COLOR_INDEX 3
-#define OUTLINE_COLOR_SHIFT 16
-#define OUTLINE_COLOR_MASK 0x30000
+#define OUTLINE_COLOR_SHIFT 18
+#define OUTLINE_COLOR_MASK 0xc0000
+static inline css_error set_outline_color(css_computed_style *style, uint8_t
+ type, css_color color)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[OUTLINE_COLOR_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef OUTLINE_COLOR_INDEX
#undef OUTLINE_COLOR_SHIFT
#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)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[OUTLINE_WIDTH_INDEX];
+ /*
+ * 8bits: uuuuuttt : unit | type
+ */
#undef OUTLINE_WIDTH_INDEX
#undef OUTLINE_WIDTH_SHIFT
#undef OUTLINE_WIDTH_MASK
+
#define WORD_SPACING_INDEX 1
-#define WORD_SPACING_SHIFT 11
-#define WORD_SPACING_MASK 0x3f800
+#define WORD_SPACING_SHIFT 25
+#define WORD_SPACING_MASK 0xfe000000
+static inline css_error set_word_spacing(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ ENSURE_UNCOMMON;
+
+ bits = &style->i.uncommon->i.bits[WORD_SPACING_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef WORD_SPACING_INDEX
#undef WORD_SPACING_SHIFT
#undef WORD_SPACING_MASK
static const css_computed_page default_page = {
.bits = {
- (CSS_PAGE_BREAK_BEFORE_AUTO << 29) | (CSS_PAGE_BREAK_AFTER_AUTO
+ (CSS_PAGE_BREAK_AFTER_AUTO << 29) | (CSS_PAGE_BREAK_BEFORE_AUTO
<< 26) | (CSS_PAGE_BREAK_INSIDE_AUTO << 24) | (
CSS_WIDOWS_SET << 23) | (CSS_ORPHANS_SET << 22)
},
@@ -229,501 +482,1326 @@ static const css_computed_page default_page = {
} \
} while(0) \
+
#define ORPHANS_INDEX 0
#define ORPHANS_SHIFT 22
#define ORPHANS_MASK 0x400000
+static inline css_error set_orphans(css_computed_style *style, uint8_t type,
+ int32_t integer)
+{
+ uint32_t bits;
+
+ ENSURE_PAGE;
+
+ bits = &style->page->bits[ORPHANS_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef ORPHANS_INDEX
#undef ORPHANS_SHIFT
#undef ORPHANS_MASK
+
#define PAGE_BREAK_AFTER_INDEX 0
-#define PAGE_BREAK_AFTER_SHIFT 26
-#define PAGE_BREAK_AFTER_MASK 0x1c000000
+#define PAGE_BREAK_AFTER_SHIFT 29
+#define PAGE_BREAK_AFTER_MASK 0xe0000000
+static inline css_error set_page_break_after(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ ENSURE_PAGE;
+
+ bits = &style->page->bits[PAGE_BREAK_AFTER_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef PAGE_BREAK_AFTER_INDEX
#undef PAGE_BREAK_AFTER_SHIFT
#undef PAGE_BREAK_AFTER_MASK
+
#define PAGE_BREAK_BEFORE_INDEX 0
-#define PAGE_BREAK_BEFORE_SHIFT 29
-#define PAGE_BREAK_BEFORE_MASK 0xe0000000
+#define PAGE_BREAK_BEFORE_SHIFT 26
+#define PAGE_BREAK_BEFORE_MASK 0x1c000000
+static inline css_error set_page_break_before(css_computed_style *style,
+ uint8_t type)
+{
+ uint32_t bits;
+
+ ENSURE_PAGE;
+
+ bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef PAGE_BREAK_BEFORE_INDEX
#undef PAGE_BREAK_BEFORE_SHIFT
#undef PAGE_BREAK_BEFORE_MASK
+
#define PAGE_BREAK_INSIDE_INDEX 0
#define PAGE_BREAK_INSIDE_SHIFT 24
#define PAGE_BREAK_INSIDE_MASK 0x3000000
+static inline css_error set_page_break_inside(css_computed_style *style,
+ uint8_t type)
+{
+ uint32_t bits;
+
+ ENSURE_PAGE;
+
+ bits = &style->page->bits[PAGE_BREAK_INSIDE_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef PAGE_BREAK_INSIDE_INDEX
#undef PAGE_BREAK_INSIDE_SHIFT
#undef PAGE_BREAK_INSIDE_MASK
+
#define WIDOWS_INDEX 0
#define WIDOWS_SHIFT 23
#define WIDOWS_MASK 0x800000
+static inline css_error set_widows(css_computed_style *style, uint8_t type,
+ int32_t integer)
+{
+ uint32_t bits;
+
+ ENSURE_PAGE;
+
+ bits = &style->page->bits[WIDOWS_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef WIDOWS_INDEX
#undef WIDOWS_SHIFT
#undef WIDOWS_MASK
-#define ALIGN_CONTENT_INDEX 6
-#define ALIGN_CONTENT_SHIFT 3
-#define ALIGN_CONTENT_MASK 0x38
+
+#define ALIGN_CONTENT_INDEX 9
+#define ALIGN_CONTENT_SHIFT 14
+#define ALIGN_CONTENT_MASK 0x1c000
+static inline css_error set_align_content(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[ALIGN_CONTENT_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef ALIGN_CONTENT_INDEX
#undef ALIGN_CONTENT_SHIFT
#undef ALIGN_CONTENT_MASK
+
#define ALIGN_ITEMS_INDEX 9
-#define ALIGN_ITEMS_SHIFT 23
-#define ALIGN_ITEMS_MASK 0x3800000
+#define ALIGN_ITEMS_SHIFT 20
+#define ALIGN_ITEMS_MASK 0x700000
+static inline css_error set_align_items(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[ALIGN_ITEMS_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef ALIGN_ITEMS_INDEX
#undef ALIGN_ITEMS_SHIFT
#undef ALIGN_ITEMS_MASK
+
#define ALIGN_SELF_INDEX 9
-#define ALIGN_SELF_SHIFT 14
-#define ALIGN_SELF_MASK 0x1c000
+#define ALIGN_SELF_SHIFT 17
+#define ALIGN_SELF_MASK 0xe0000
+static inline css_error set_align_self(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[ALIGN_SELF_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef ALIGN_SELF_INDEX
#undef ALIGN_SELF_SHIFT
#undef ALIGN_SELF_MASK
+
#define BACKGROUND_ATTACHMENT_INDEX 8
-#define BACKGROUND_ATTACHMENT_SHIFT 24
-#define BACKGROUND_ATTACHMENT_MASK 0x3000000
+#define BACKGROUND_ATTACHMENT_SHIFT 28
+#define BACKGROUND_ATTACHMENT_MASK 0x30000000
+static inline css_error set_background_attachment(css_computed_style *style,
+ uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef BACKGROUND_ATTACHMENT_INDEX
#undef BACKGROUND_ATTACHMENT_SHIFT
#undef BACKGROUND_ATTACHMENT_MASK
+
#define BACKGROUND_COLOR_INDEX 8
-#define BACKGROUND_COLOR_SHIFT 10
-#define BACKGROUND_COLOR_MASK 0xc00
+#define BACKGROUND_COLOR_SHIFT 22
+#define BACKGROUND_COLOR_MASK 0xc00000
+static inline css_error set_background_color(css_computed_style *style, uint8_t
+ type, css_color color)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef BACKGROUND_COLOR_INDEX
#undef BACKGROUND_COLOR_SHIFT
#undef BACKGROUND_COLOR_MASK
+
#define BACKGROUND_IMAGE_INDEX 10
-#define BACKGROUND_IMAGE_SHIFT 28
-#define BACKGROUND_IMAGE_MASK 0x10000000
+#define BACKGROUND_IMAGE_SHIFT 29
+#define BACKGROUND_IMAGE_MASK 0x20000000
+static inline css_error set_background_image(css_computed_style *style, uint8_t
+ type, lwc_string *string)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef BACKGROUND_IMAGE_INDEX
#undef BACKGROUND_IMAGE_SHIFT
#undef BACKGROUND_IMAGE_MASK
+
#define BACKGROUND_POSITION_INDEX 5
#define BACKGROUND_POSITION_SHIFT 21
#define BACKGROUND_POSITION_MASK 0xffe00000
+static inline css_error set_background_position(css_computed_style *style,
+ uint8_t type, css_fixed length_a, css_unit unit_a, css_fixed
+ length_b, css_unit unit_b)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
+ /*
+ * 11bits: aaaaabbbbbt : unit_a | unit_b | type
+ */
#undef BACKGROUND_POSITION_INDEX
#undef BACKGROUND_POSITION_SHIFT
#undef BACKGROUND_POSITION_MASK
+
#define BACKGROUND_REPEAT_INDEX 9
-#define BACKGROUND_REPEAT_SHIFT 26
-#define BACKGROUND_REPEAT_MASK 0x1c000000
+#define BACKGROUND_REPEAT_SHIFT 5
+#define BACKGROUND_REPEAT_MASK 0xe0
+static inline css_error set_background_repeat(css_computed_style *style,
+ uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef BACKGROUND_REPEAT_INDEX
#undef BACKGROUND_REPEAT_SHIFT
#undef BACKGROUND_REPEAT_MASK
+
#define BORDER_BOTTOM_COLOR_INDEX 8
-#define BORDER_BOTTOM_COLOR_SHIFT 2
-#define BORDER_BOTTOM_COLOR_MASK 0xc
+#define BORDER_BOTTOM_COLOR_SHIFT 6
+#define BORDER_BOTTOM_COLOR_MASK 0xc0
+static inline css_error set_border_bottom_color(css_computed_style *style,
+ uint8_t type, css_color color)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef BORDER_BOTTOM_COLOR_INDEX
#undef BORDER_BOTTOM_COLOR_SHIFT
#undef BORDER_BOTTOM_COLOR_MASK
+
#define BORDER_BOTTOM_STYLE_INDEX 6
-#define BORDER_BOTTOM_STYLE_SHIFT 14
-#define BORDER_BOTTOM_STYLE_MASK 0x3c000
+#define BORDER_BOTTOM_STYLE_SHIFT 10
+#define BORDER_BOTTOM_STYLE_MASK 0x3c00
+static inline css_error set_border_bottom_style(css_computed_style *style,
+ uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef BORDER_BOTTOM_STYLE_INDEX
#undef BORDER_BOTTOM_STYLE_SHIFT
#undef BORDER_BOTTOM_STYLE_MASK
+
#define BORDER_BOTTOM_WIDTH_INDEX 0
#define BORDER_BOTTOM_WIDTH_SHIFT 8
#define BORDER_BOTTOM_WIDTH_MASK 0xff00
+static inline css_error set_border_bottom_width(css_computed_style *style,
+ uint8_t type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
+ /*
+ * 8bits: uuuuuttt : unit | type
+ */
#undef BORDER_BOTTOM_WIDTH_INDEX
#undef BORDER_BOTTOM_WIDTH_SHIFT
#undef BORDER_BOTTOM_WIDTH_MASK
+
#define BORDER_COLLAPSE_INDEX 8
-#define BORDER_COLLAPSE_SHIFT 4
-#define BORDER_COLLAPSE_MASK 0x30
+#define BORDER_COLLAPSE_SHIFT 16
+#define BORDER_COLLAPSE_MASK 0x30000
+static inline css_error set_border_collapse(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef BORDER_COLLAPSE_INDEX
#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 8
+#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)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef BORDER_LEFT_COLOR_INDEX
#undef BORDER_LEFT_COLOR_SHIFT
#undef BORDER_LEFT_COLOR_MASK
-#define BORDER_LEFT_STYLE_INDEX 4
+
+#define BORDER_LEFT_STYLE_INDEX 3
#define BORDER_LEFT_STYLE_SHIFT 0
#define BORDER_LEFT_STYLE_MASK 0xf
+static inline css_error set_border_left_style(css_computed_style *style,
+ uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef BORDER_LEFT_STYLE_INDEX
#undef BORDER_LEFT_STYLE_SHIFT
#undef BORDER_LEFT_STYLE_MASK
+
#define BORDER_LEFT_WIDTH_INDEX 0
-#define BORDER_LEFT_WIDTH_SHIFT 0
-#define BORDER_LEFT_WIDTH_MASK 0xff
+#define BORDER_LEFT_WIDTH_SHIFT 16
+#define BORDER_LEFT_WIDTH_MASK 0xff0000
+static inline css_error set_border_left_width(css_computed_style *style,
+ uint8_t type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
+ /*
+ * 8bits: uuuuuttt : unit | type
+ */
#undef BORDER_LEFT_WIDTH_INDEX
#undef BORDER_LEFT_WIDTH_SHIFT
#undef BORDER_LEFT_WIDTH_MASK
+
#define BORDER_RIGHT_COLOR_INDEX 8
-#define BORDER_RIGHT_COLOR_SHIFT 26
-#define BORDER_RIGHT_COLOR_MASK 0xc000000
+#define BORDER_RIGHT_COLOR_SHIFT 18
+#define BORDER_RIGHT_COLOR_MASK 0xc0000
+static inline css_error set_border_right_color(css_computed_style *style,
+ uint8_t type, css_color color)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef BORDER_RIGHT_COLOR_INDEX
#undef BORDER_RIGHT_COLOR_SHIFT
#undef BORDER_RIGHT_COLOR_MASK
-#define BORDER_RIGHT_STYLE_INDEX 3
+
+#define BORDER_RIGHT_STYLE_INDEX 4
#define BORDER_RIGHT_STYLE_SHIFT 0
#define BORDER_RIGHT_STYLE_MASK 0xf
+static inline css_error set_border_right_style(css_computed_style *style,
+ uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef BORDER_RIGHT_STYLE_INDEX
#undef BORDER_RIGHT_STYLE_SHIFT
#undef BORDER_RIGHT_STYLE_MASK
+
#define BORDER_RIGHT_WIDTH_INDEX 0
-#define BORDER_RIGHT_WIDTH_SHIFT 24
-#define BORDER_RIGHT_WIDTH_MASK 0xff000000
+#define BORDER_RIGHT_WIDTH_SHIFT 0
+#define BORDER_RIGHT_WIDTH_MASK 0xff
+static inline css_error set_border_right_width(css_computed_style *style,
+ uint8_t type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
+ /*
+ * 8bits: uuuuuttt : unit | type
+ */
#undef BORDER_RIGHT_WIDTH_INDEX
#undef BORDER_RIGHT_WIDTH_SHIFT
#undef BORDER_RIGHT_WIDTH_MASK
+
#define BORDER_TOP_COLOR_INDEX 8
-#define BORDER_TOP_COLOR_SHIFT 14
-#define BORDER_TOP_COLOR_MASK 0xc000
+#define BORDER_TOP_COLOR_SHIFT 10
+#define BORDER_TOP_COLOR_MASK 0xc00
+static inline css_error set_border_top_color(css_computed_style *style, uint8_t
+ type, css_color color)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef BORDER_TOP_COLOR_INDEX
#undef BORDER_TOP_COLOR_SHIFT
#undef BORDER_TOP_COLOR_MASK
+
#define BORDER_TOP_STYLE_INDEX 2
#define BORDER_TOP_STYLE_SHIFT 0
#define BORDER_TOP_STYLE_MASK 0xf
+static inline css_error set_border_top_style(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef BORDER_TOP_STYLE_INDEX
#undef BORDER_TOP_STYLE_SHIFT
#undef BORDER_TOP_STYLE_MASK
+
#define BORDER_TOP_WIDTH_INDEX 0
-#define BORDER_TOP_WIDTH_SHIFT 16
-#define BORDER_TOP_WIDTH_MASK 0xff0000
+#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)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
+ /*
+ * 8bits: uuuuuttt : unit | type
+ */
#undef BORDER_TOP_WIDTH_INDEX
#undef BORDER_TOP_WIDTH_SHIFT
#undef BORDER_TOP_WIDTH_MASK
+
#define BOTTOM_INDEX 2
-#define BOTTOM_SHIFT 18
-#define BOTTOM_MASK 0x1fc0000
+#define BOTTOM_SHIFT 4
+#define BOTTOM_MASK 0x7f0
+static inline css_error set_bottom(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BOTTOM_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef BOTTOM_INDEX
#undef BOTTOM_SHIFT
#undef BOTTOM_MASK
+
#define BOX_SIZING_INDEX 8
-#define BOX_SIZING_SHIFT 18
-#define BOX_SIZING_MASK 0xc0000
+#define BOX_SIZING_SHIFT 12
+#define BOX_SIZING_MASK 0x3000
+static inline css_error set_box_sizing(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[BOX_SIZING_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef BOX_SIZING_INDEX
#undef BOX_SIZING_SHIFT
#undef BOX_SIZING_MASK
+
#define CAPTION_SIDE_INDEX 8
-#define CAPTION_SIDE_SHIFT 28
-#define CAPTION_SIDE_MASK 0x30000000
+#define CAPTION_SIDE_SHIFT 30
+#define CAPTION_SIDE_MASK 0xc0000000
+static inline css_error set_caption_side(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[CAPTION_SIDE_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef CAPTION_SIDE_INDEX
#undef CAPTION_SIDE_SHIFT
#undef CAPTION_SIDE_MASK
+
#define CLEAR_INDEX 9
-#define CLEAR_SHIFT 17
-#define CLEAR_MASK 0xe0000
+#define CLEAR_SHIFT 29
+#define CLEAR_MASK 0xe0000000
+static inline css_error set_clear(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[CLEAR_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef CLEAR_INDEX
#undef CLEAR_SHIFT
#undef CLEAR_MASK
-#define COLOR_INDEX 9
-#define COLOR_SHIFT 0
-#define COLOR_MASK 0x1
+
+#define COLOR_INDEX 10
+#define COLOR_SHIFT 26
+#define COLOR_MASK 0x4000000
+static inline css_error set_color(css_computed_style *style, uint8_t type,
+ css_color color)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[COLOR_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef COLOR_INDEX
#undef COLOR_SHIFT
#undef COLOR_MASK
-#define DIRECTION_INDEX 8
-#define DIRECTION_SHIFT 6
-#define DIRECTION_MASK 0xc0
+
+#define DIRECTION_INDEX 7
+#define DIRECTION_SHIFT 0
+#define DIRECTION_MASK 0x3
+static inline css_error set_direction(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[DIRECTION_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef DIRECTION_INDEX
#undef DIRECTION_SHIFT
#undef DIRECTION_MASK
+
#define DISPLAY_INDEX 6
-#define DISPLAY_SHIFT 22
-#define DISPLAY_MASK 0x7c00000
+#define DISPLAY_SHIFT 27
+#define DISPLAY_MASK 0xf8000000
+static inline css_error set_display(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[DISPLAY_INDEX];
+ /*
+ * 5bits: ttttt : type
+ */
#undef DISPLAY_INDEX
#undef DISPLAY_SHIFT
#undef DISPLAY_MASK
+
#define EMPTY_CELLS_INDEX 8
-#define EMPTY_CELLS_SHIFT 16
-#define EMPTY_CELLS_MASK 0x30000
+#define EMPTY_CELLS_SHIFT 4
+#define EMPTY_CELLS_MASK 0x30
+static inline css_error set_empty_cells(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[EMPTY_CELLS_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef EMPTY_CELLS_INDEX
#undef EMPTY_CELLS_SHIFT
#undef EMPTY_CELLS_MASK
-#define FLEX_BASIS_INDEX 3
+
+#define FLEX_BASIS_INDEX 4
#define FLEX_BASIS_SHIFT 25
#define FLEX_BASIS_MASK 0xfe000000
+static inline css_error set_flex_basis(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FLEX_BASIS_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef FLEX_BASIS_INDEX
#undef FLEX_BASIS_SHIFT
#undef FLEX_BASIS_MASK
+
#define FLEX_DIRECTION_INDEX 9
-#define FLEX_DIRECTION_SHIFT 29
-#define FLEX_DIRECTION_MASK 0xe0000000
+#define FLEX_DIRECTION_SHIFT 8
+#define FLEX_DIRECTION_MASK 0x700
+static inline css_error set_flex_direction(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FLEX_DIRECTION_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef FLEX_DIRECTION_INDEX
#undef FLEX_DIRECTION_SHIFT
#undef FLEX_DIRECTION_MASK
+
#define FLEX_GROW_INDEX 10
-#define FLEX_GROW_SHIFT 26
-#define FLEX_GROW_MASK 0x4000000
+#define FLEX_GROW_SHIFT 28
+#define FLEX_GROW_MASK 0x10000000
+static inline css_error set_flex_grow(css_computed_style *style, uint8_t type,
+ css_fixed fixed)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FLEX_GROW_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef FLEX_GROW_INDEX
#undef FLEX_GROW_SHIFT
#undef FLEX_GROW_MASK
+
#define FLEX_SHRINK_INDEX 10
-#define FLEX_SHRINK_SHIFT 29
-#define FLEX_SHRINK_MASK 0x20000000
+#define FLEX_SHRINK_SHIFT 27
+#define FLEX_SHRINK_MASK 0x8000000
+static inline css_error set_flex_shrink(css_computed_style *style, uint8_t
+ type, css_fixed fixed)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FLEX_SHRINK_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef FLEX_SHRINK_INDEX
#undef FLEX_SHRINK_SHIFT
#undef FLEX_SHRINK_MASK
-#define FLEX_WRAP_INDEX 9
-#define FLEX_WRAP_SHIFT 1
-#define FLEX_WRAP_MASK 0x6
+
+#define FLEX_WRAP_INDEX 8
+#define FLEX_WRAP_SHIFT 8
+#define FLEX_WRAP_MASK 0x300
+static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FLEX_WRAP_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef FLEX_WRAP_INDEX
#undef FLEX_WRAP_SHIFT
#undef FLEX_WRAP_MASK
+
#define FLOAT_INDEX 8
-#define FLOAT_SHIFT 22
-#define FLOAT_MASK 0xc00000
+#define FLOAT_SHIFT 14
+#define FLOAT_MASK 0xc000
+static inline css_error set_float(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FLOAT_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef FLOAT_INDEX
#undef FLOAT_SHIFT
#undef FLOAT_MASK
-#define FONT_FAMILY_INDEX 6
-#define FONT_FAMILY_SHIFT 0
-#define FONT_FAMILY_MASK 0x7
+
+#define FONT_FAMILY_INDEX 9
+#define FONT_FAMILY_SHIFT 11
+#define FONT_FAMILY_MASK 0x3800
+static inline css_error set_font_family(css_computed_style *style, uint8_t
+ type, lwc_string **string_arr)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FONT_FAMILY_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef FONT_FAMILY_INDEX
#undef FONT_FAMILY_SHIFT
#undef FONT_FAMILY_MASK
+
#define FONT_SIZE_INDEX 5
#define FONT_SIZE_SHIFT 12
#define FONT_SIZE_MASK 0x1ff000
+static inline css_error set_font_size(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FONT_SIZE_INDEX];
+ /*
+ * 9bits: uuuuutttt : unit | type
+ */
#undef FONT_SIZE_INDEX
#undef FONT_SIZE_SHIFT
#undef FONT_SIZE_MASK
+
#define FONT_STYLE_INDEX 8
-#define FONT_STYLE_SHIFT 8
-#define FONT_STYLE_MASK 0x300
+#define FONT_STYLE_SHIFT 0
+#define FONT_STYLE_MASK 0x3
+static inline css_error set_font_style(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FONT_STYLE_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef FONT_STYLE_INDEX
#undef FONT_STYLE_SHIFT
#undef FONT_STYLE_MASK
-#define FONT_VARIANT_INDEX 7
-#define FONT_VARIANT_SHIFT 0
-#define FONT_VARIANT_MASK 0x3
+
+#define FONT_VARIANT_INDEX 8
+#define FONT_VARIANT_SHIFT 20
+#define FONT_VARIANT_MASK 0x300000
+static inline css_error set_font_variant(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FONT_VARIANT_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef FONT_VARIANT_INDEX
#undef FONT_VARIANT_SHIFT
#undef FONT_VARIANT_MASK
-#define FONT_WEIGHT_INDEX 1
-#define FONT_WEIGHT_SHIFT 0
-#define FONT_WEIGHT_MASK 0xf
+
+#define FONT_WEIGHT_INDEX 6
+#define FONT_WEIGHT_SHIFT 6
+#define FONT_WEIGHT_MASK 0x3c0
+static inline css_error set_font_weight(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[FONT_WEIGHT_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef FONT_WEIGHT_INDEX
#undef FONT_WEIGHT_SHIFT
#undef FONT_WEIGHT_MASK
+
#define HEIGHT_INDEX 1
#define HEIGHT_SHIFT 18
#define HEIGHT_MASK 0x1fc0000
+static inline css_error set_height(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[HEIGHT_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef HEIGHT_INDEX
#undef HEIGHT_SHIFT
#undef HEIGHT_MASK
+
#define JUSTIFY_CONTENT_INDEX 9
-#define JUSTIFY_CONTENT_SHIFT 5
-#define JUSTIFY_CONTENT_MASK 0xe0
+#define JUSTIFY_CONTENT_SHIFT 23
+#define JUSTIFY_CONTENT_MASK 0x3800000
+static inline css_error set_justify_content(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[JUSTIFY_CONTENT_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef JUSTIFY_CONTENT_INDEX
#undef JUSTIFY_CONTENT_SHIFT
#undef JUSTIFY_CONTENT_MASK
-#define LEFT_INDEX 4
+
+#define LEFT_INDEX 1
#define LEFT_SHIFT 25
#define LEFT_MASK 0xfe000000
+static inline css_error set_left(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[LEFT_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef LEFT_INDEX
#undef LEFT_SHIFT
#undef LEFT_MASK
+
#define LINE_HEIGHT_INDEX 4
-#define LINE_HEIGHT_SHIFT 11
-#define LINE_HEIGHT_MASK 0x3f800
+#define LINE_HEIGHT_SHIFT 4
+#define LINE_HEIGHT_MASK 0x7f0
+static inline css_error set_line_height(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[LINE_HEIGHT_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef LINE_HEIGHT_INDEX
#undef LINE_HEIGHT_SHIFT
#undef LINE_HEIGHT_MASK
+
#define LIST_STYLE_IMAGE_INDEX 10
-#define LIST_STYLE_IMAGE_SHIFT 25
-#define LIST_STYLE_IMAGE_MASK 0x2000000
+#define LIST_STYLE_IMAGE_SHIFT 23
+#define LIST_STYLE_IMAGE_MASK 0x800000
+static inline css_error set_list_style_image(css_computed_style *style, uint8_t
+ type, lwc_string *string)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef LIST_STYLE_IMAGE_INDEX
#undef LIST_STYLE_IMAGE_SHIFT
#undef LIST_STYLE_IMAGE_MASK
-#define LIST_STYLE_POSITION_INDEX 8
-#define LIST_STYLE_POSITION_SHIFT 0
-#define LIST_STYLE_POSITION_MASK 0x3
+
+#define LIST_STYLE_POSITION_INDEX 9
+#define LIST_STYLE_POSITION_SHIFT 1
+#define LIST_STYLE_POSITION_MASK 0x6
+static inline css_error set_list_style_position(css_computed_style *style,
+ uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef LIST_STYLE_POSITION_INDEX
#undef LIST_STYLE_POSITION_SHIFT
#undef LIST_STYLE_POSITION_MASK
+
#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)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef LIST_STYLE_TYPE_INDEX
#undef LIST_STYLE_TYPE_SHIFT
#undef LIST_STYLE_TYPE_MASK
+
#define MARGIN_BOTTOM_INDEX 2
-#define MARGIN_BOTTOM_SHIFT 4
-#define MARGIN_BOTTOM_MASK 0x7f0
+#define MARGIN_BOTTOM_SHIFT 25
+#define MARGIN_BOTTOM_MASK 0xfe000000
+static inline css_error set_margin_bottom(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef MARGIN_BOTTOM_INDEX
#undef MARGIN_BOTTOM_SHIFT
#undef MARGIN_BOTTOM_MASK
+
#define MARGIN_LEFT_INDEX 4
-#define MARGIN_LEFT_SHIFT 4
-#define MARGIN_LEFT_MASK 0x7f0
+#define MARGIN_LEFT_SHIFT 11
+#define MARGIN_LEFT_MASK 0x3f800
+static inline css_error set_margin_left(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[MARGIN_LEFT_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef MARGIN_LEFT_INDEX
#undef MARGIN_LEFT_SHIFT
#undef MARGIN_LEFT_MASK
-#define MARGIN_RIGHT_INDEX 4
-#define MARGIN_RIGHT_SHIFT 18
-#define MARGIN_RIGHT_MASK 0x1fc0000
+
+#define MARGIN_RIGHT_INDEX 3
+#define MARGIN_RIGHT_SHIFT 11
+#define MARGIN_RIGHT_MASK 0x3f800
+static inline css_error set_margin_right(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[MARGIN_RIGHT_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef MARGIN_RIGHT_INDEX
#undef MARGIN_RIGHT_SHIFT
#undef MARGIN_RIGHT_MASK
-#define MARGIN_TOP_INDEX 2
+
+#define MARGIN_TOP_INDEX 1
#define MARGIN_TOP_SHIFT 11
#define MARGIN_TOP_MASK 0x3f800
+static inline css_error set_margin_top(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[MARGIN_TOP_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef MARGIN_TOP_INDEX
#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 4
+#define MAX_HEIGHT_SHIFT 18
+#define MAX_HEIGHT_MASK 0x1fc0000
+static inline css_error set_max_height(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[MAX_HEIGHT_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef MAX_HEIGHT_INDEX
#undef MAX_HEIGHT_SHIFT
#undef MAX_HEIGHT_MASK
-#define MAX_WIDTH_INDEX 1
-#define MAX_WIDTH_SHIFT 11
-#define MAX_WIDTH_MASK 0x3f800
+
+#define MAX_WIDTH_INDEX 2
+#define MAX_WIDTH_SHIFT 18
+#define MAX_WIDTH_MASK 0x1fc0000
+static inline css_error set_max_width(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[MAX_WIDTH_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef MAX_WIDTH_INDEX
#undef MAX_WIDTH_SHIFT
#undef MAX_WIDTH_MASK
-#define MIN_HEIGHT_INDEX 1
-#define MIN_HEIGHT_SHIFT 4
-#define MIN_HEIGHT_MASK 0x7f0
+
+#define MIN_HEIGHT_INDEX 2
+#define MIN_HEIGHT_SHIFT 11
+#define MIN_HEIGHT_MASK 0x3f800
+static inline css_error set_min_height(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[MIN_HEIGHT_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef MIN_HEIGHT_INDEX
#undef MIN_HEIGHT_SHIFT
#undef MIN_HEIGHT_MASK
-#define MIN_WIDTH_INDEX 2
+
+#define MIN_WIDTH_INDEX 3
#define MIN_WIDTH_SHIFT 25
#define MIN_WIDTH_MASK 0xfe000000
+static inline css_error set_min_width(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[MIN_WIDTH_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef MIN_WIDTH_INDEX
#undef MIN_WIDTH_SHIFT
#undef MIN_WIDTH_MASK
+
#define OPACITY_INDEX 10
-#define OPACITY_SHIFT 24
-#define OPACITY_MASK 0x1000000
+#define OPACITY_SHIFT 25
+#define OPACITY_MASK 0x2000000
+static inline css_error set_opacity(css_computed_style *style, uint8_t type,
+ css_fixed fixed)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[OPACITY_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef OPACITY_INDEX
#undef OPACITY_SHIFT
#undef OPACITY_MASK
+
#define ORDER_INDEX 10
-#define ORDER_SHIFT 23
-#define ORDER_MASK 0x800000
+#define ORDER_SHIFT 24
+#define ORDER_MASK 0x1000000
+static inline css_error set_order(css_computed_style *style, uint8_t type,
+ int32_t integer)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[ORDER_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef ORDER_INDEX
#undef ORDER_SHIFT
#undef ORDER_MASK
+
#define OUTLINE_STYLE_INDEX 6
-#define OUTLINE_STYLE_SHIFT 10
-#define OUTLINE_STYLE_MASK 0x3c00
+#define OUTLINE_STYLE_SHIFT 14
+#define OUTLINE_STYLE_MASK 0x3c000
+static inline css_error set_outline_style(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[OUTLINE_STYLE_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef OUTLINE_STYLE_INDEX
#undef OUTLINE_STYLE_SHIFT
#undef OUTLINE_STYLE_MASK
-#define OVERFLOW_INDEX 9
-#define OVERFLOW_SHIFT 8
-#define OVERFLOW_MASK 0x700
+
+#define OVERFLOW_INDEX 5
+#define OVERFLOW_SHIFT 0
+#define OVERFLOW_MASK 0x7
+static inline css_error set_overflow(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[OVERFLOW_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef OVERFLOW_INDEX
#undef OVERFLOW_SHIFT
#undef OVERFLOW_MASK
+
#define PADDING_BOTTOM_INDEX 7
#define PADDING_BOTTOM_SHIFT 26
#define PADDING_BOTTOM_MASK 0xfc000000
+static inline css_error set_padding_bottom(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[PADDING_BOTTOM_INDEX];
+ /*
+ * 6bits: uuuuut : unit | type
+ */
#undef PADDING_BOTTOM_INDEX
#undef PADDING_BOTTOM_SHIFT
#undef PADDING_BOTTOM_MASK
+
#define PADDING_LEFT_INDEX 7
#define PADDING_LEFT_SHIFT 14
#define PADDING_LEFT_MASK 0xfc000
+static inline css_error set_padding_left(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[PADDING_LEFT_INDEX];
+ /*
+ * 6bits: uuuuut : unit | type
+ */
#undef PADDING_LEFT_INDEX
#undef PADDING_LEFT_SHIFT
#undef PADDING_LEFT_MASK
+
#define PADDING_RIGHT_INDEX 7
-#define PADDING_RIGHT_SHIFT 20
-#define PADDING_RIGHT_MASK 0x3f00000
+#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)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[PADDING_RIGHT_INDEX];
+ /*
+ * 6bits: uuuuut : unit | type
+ */
#undef PADDING_RIGHT_INDEX
#undef PADDING_RIGHT_SHIFT
#undef PADDING_RIGHT_MASK
+
#define PADDING_TOP_INDEX 7
#define PADDING_TOP_SHIFT 2
#define PADDING_TOP_MASK 0xfc
+static inline css_error set_padding_top(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[PADDING_TOP_INDEX];
+ /*
+ * 6bits: uuuuut : unit | type
+ */
#undef PADDING_TOP_INDEX
#undef PADDING_TOP_SHIFT
#undef PADDING_TOP_MASK
-#define POSITION_INDEX 5
-#define POSITION_SHIFT 0
-#define POSITION_MASK 0x7
+
+#define POSITION_INDEX 6
+#define POSITION_SHIFT 3
+#define POSITION_MASK 0x38
+static inline css_error set_position(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[POSITION_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef POSITION_INDEX
#undef POSITION_SHIFT
#undef POSITION_MASK
-#define QUOTES_INDEX 10
-#define QUOTES_SHIFT 27
-#define QUOTES_MASK 0x8000000
+
+#define QUOTES_INDEX 9
+#define QUOTES_SHIFT 0
+#define QUOTES_MASK 0x1
+static inline css_error set_quotes(css_computed_style *style, uint8_t type,
+ lwc_string **string_arr)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[QUOTES_INDEX];
+ /*
+ * 1bit: t : type
+ */
#undef QUOTES_INDEX
#undef QUOTES_SHIFT
#undef QUOTES_MASK
+
#define RIGHT_INDEX 3
-#define RIGHT_SHIFT 4
-#define RIGHT_MASK 0x7f0
+#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)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[RIGHT_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef RIGHT_INDEX
#undef RIGHT_SHIFT
#undef RIGHT_MASK
-#define TABLE_LAYOUT_INDEX 8
-#define TABLE_LAYOUT_SHIFT 30
-#define TABLE_LAYOUT_MASK 0xc0000000
+
+#define TABLE_LAYOUT_INDEX 9
+#define TABLE_LAYOUT_SHIFT 3
+#define TABLE_LAYOUT_MASK 0x18
+static inline css_error set_table_layout(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[TABLE_LAYOUT_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef TABLE_LAYOUT_INDEX
#undef TABLE_LAYOUT_SHIFT
#undef TABLE_LAYOUT_MASK
-#define TEXT_ALIGN_INDEX 6
-#define TEXT_ALIGN_SHIFT 6
-#define TEXT_ALIGN_MASK 0x3c0
+
+#define TEXT_ALIGN_INDEX 1
+#define TEXT_ALIGN_SHIFT 0
+#define TEXT_ALIGN_MASK 0xf
+static inline css_error set_text_align(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[TEXT_ALIGN_INDEX];
+ /*
+ * 4bits: tttt : type
+ */
#undef TEXT_ALIGN_INDEX
#undef TEXT_ALIGN_SHIFT
#undef TEXT_ALIGN_MASK
+
#define TEXT_DECORATION_INDEX 6
-#define TEXT_DECORATION_SHIFT 27
-#define TEXT_DECORATION_MASK 0xf8000000
+#define TEXT_DECORATION_SHIFT 22
+#define TEXT_DECORATION_MASK 0x7c00000
+static inline css_error set_text_decoration(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[TEXT_DECORATION_INDEX];
+ /*
+ * 5bits: ttttt : type
+ */
#undef TEXT_DECORATION_INDEX
#undef TEXT_DECORATION_SHIFT
#undef TEXT_DECORATION_MASK
+
#define TEXT_INDENT_INDEX 7
-#define TEXT_INDENT_SHIFT 8
-#define TEXT_INDENT_MASK 0x3f00
+#define TEXT_INDENT_SHIFT 20
+#define TEXT_INDENT_MASK 0x3f00000
+static inline css_error set_text_indent(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[TEXT_INDENT_INDEX];
+ /*
+ * 6bits: uuuuut : unit | type
+ */
#undef TEXT_INDENT_INDEX
#undef TEXT_INDENT_SHIFT
#undef TEXT_INDENT_MASK
-#define TEXT_TRANSFORM_INDEX 9
-#define TEXT_TRANSFORM_SHIFT 20
-#define TEXT_TRANSFORM_MASK 0x700000
+
+#define TEXT_TRANSFORM_INDEX 6
+#define TEXT_TRANSFORM_SHIFT 0
+#define TEXT_TRANSFORM_MASK 0x7
+static inline css_error set_text_transform(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef TEXT_TRANSFORM_INDEX
#undef TEXT_TRANSFORM_SHIFT
#undef TEXT_TRANSFORM_MASK
+
#define TOP_INDEX 1
-#define TOP_SHIFT 25
-#define TOP_MASK 0xfe000000
+#define TOP_SHIFT 4
+#define TOP_MASK 0x7f0
+static inline css_error set_top(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[TOP_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef TOP_INDEX
#undef TOP_SHIFT
#undef TOP_MASK
-#define UNICODE_BIDI_INDEX 9
-#define UNICODE_BIDI_SHIFT 3
-#define UNICODE_BIDI_MASK 0x18
+
+#define UNICODE_BIDI_INDEX 10
+#define UNICODE_BIDI_SHIFT 30
+#define UNICODE_BIDI_MASK 0xc0000000
+static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t
+ type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[UNICODE_BIDI_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef UNICODE_BIDI_INDEX
#undef UNICODE_BIDI_SHIFT
#undef UNICODE_BIDI_MASK
+
#define VERTICAL_ALIGN_INDEX 5
#define VERTICAL_ALIGN_SHIFT 3
#define VERTICAL_ALIGN_MASK 0xff8
+static inline css_error set_vertical_align(css_computed_style *style, uint8_t
+ type, css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
+ /*
+ * 9bits: uuuuutttt : unit | type
+ */
#undef VERTICAL_ALIGN_INDEX
#undef VERTICAL_ALIGN_SHIFT
#undef VERTICAL_ALIGN_MASK
+
#define VISIBILITY_INDEX 8
-#define VISIBILITY_SHIFT 20
-#define VISIBILITY_MASK 0x300000
+#define VISIBILITY_SHIFT 26
+#define VISIBILITY_MASK 0xc000000
+static inline css_error set_visibility(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[VISIBILITY_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef VISIBILITY_INDEX
#undef VISIBILITY_SHIFT
#undef VISIBILITY_MASK
+
#define WHITE_SPACE_INDEX 9
-#define WHITE_SPACE_SHIFT 11
-#define WHITE_SPACE_MASK 0x3800
+#define WHITE_SPACE_SHIFT 26
+#define WHITE_SPACE_MASK 0x1c000000
+static inline css_error set_white_space(css_computed_style *style, uint8_t type)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[WHITE_SPACE_INDEX];
+ /*
+ * 3bits: ttt : type
+ */
#undef WHITE_SPACE_INDEX
#undef WHITE_SPACE_SHIFT
#undef WHITE_SPACE_MASK
+
#define WIDTH_INDEX 3
-#define WIDTH_SHIFT 18
-#define WIDTH_MASK 0x1fc0000
+#define WIDTH_SHIFT 4
+#define WIDTH_MASK 0x7f0
+static inline css_error set_width(css_computed_style *style, uint8_t type,
+ css_fixed length, css_unit unit)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[WIDTH_INDEX];
+ /*
+ * 7bits: uuuuutt : unit | type
+ */
#undef WIDTH_INDEX
#undef WIDTH_SHIFT
#undef WIDTH_MASK
+
#define Z_INDEX_INDEX 8
-#define Z_INDEX_SHIFT 12
-#define Z_INDEX_MASK 0x3000
+#define Z_INDEX_SHIFT 2
+#define Z_INDEX_MASK 0xc
+static inline css_error set_z_index(css_computed_style *style, uint8_t type,
+ int32_t integer)
+{
+ uint32_t bits;
+
+ bits = &style->i.bits[Z_INDEX_INDEX];
+ /*
+ * 2bits: tt : type
+ */
#undef Z_INDEX_INDEX
#undef Z_INDEX_SHIFT
#undef Z_INDEX_MASK
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index 966fa53..9cd882f 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -70,6 +70,8 @@ class Text:
self._lines.append(text)
return
+ line_break_before = [ c for c in ' +-*/' ]
+ line_break_after = [ c for c in '({[' ]
column_max = 72 if self._esc_nl else 80
multiline = False
@@ -82,9 +84,12 @@ class Text:
line += text
text = ''
else:
- space_index = text[:column_max - prefix_size].rfind(' ')
- paren_index = text[:column_max - prefix_size].rfind('(')
- break_index = max(space_index, paren_index + 1)
+ break_index = 0
+ for c in (line_break_before + line_break_after):
+ after = 1 if c in line_break_after else 0
+ break_index = max(break_index,
+ text[:column_max - prefix_size].rfind(c) + after)
+ break_index = break_index or len(text)
line += text[:break_index].rstrip()
text = text[break_index:].lstrip()
if self._esc_nl:
@@ -123,6 +128,7 @@ class CSSValue:
self.type = css_type
self.size = size # `None` means sizeof(ptr)
self.defaults = get_tuple(defaults)
+ self.suffix = ''
self.bits = None if bits_size is None else {
'name': bits_name,
'type': bits_type,
@@ -136,51 +142,37 @@ class CSSProperty:
self.name = name
self.type_size = type_size
self.values = self.make_values(values)
- self.defaults = get_tuple(defaults)
+ self.defaults = defaults
self.condition = condition
self.override = get_tuple(override)
self.comments = comments
- self.__index = None
- self.__shift = None
self.__mask = None
- def make_values(self, vals, for_list=False):
+ def make_values(self, vals):
if vals is None:
return []
elif type(vals) is str:
- val_list = [ CSSValue(*x) for x in values if x[0] == vals ]
- return val_list[0] if for_list else val_list
+ return self.make_values(((vals,),))
elif type(vals) is tuple:
val_list = []
- for val in vals:
+ for i, v in enumerate(vals):
for x in values:
- if x[0] == val[0]:
+ if x[0] == v[0]:
value = CSSValue(*x)
- if len(val) is 2:
- value.defaults = get_tuple(val[1])
+ if len(v) is 2:
+ value.defaults = get_tuple(v[1])
+ if len(vals) > 1:
+ value.suffix = '_' + string.ascii_lowercase[i]
val_list.append(value)
break
else:
- raise ValueError('Value ' + val[0] + ' not found!')
+ raise ValueError('Value ' + v[0] + ' not found!')
return val_list
else:
raise TypeError('Expected None, str or tuple, got ' +
type(vals).__name__)
@property
- def default_op(self):
- if len(self.defaults) < 1:
- raise ValueError('Property has empty defaults!')
- return self.defaults[0]
-
- def default_value(self, index):
- # First default of property is the opcode
- if len(self.defaults) < index + 2:
- return self.values[index].defaults
- else:
- return self.defaults[index + 1]
-
- @property
def bits_size(self):
return self.type_size + sum([ v.bits['size'] for v in self.values
if v.bits is not None ])
@@ -214,34 +206,6 @@ class CSSProperty:
(' + ' if vars_size and ptr else '') + ptr)
@property
- def index(self):
- if self.__index is None:
- raise NameError('Attribute `index` not set yet!')
- return self.__index
-
- @index.setter
- def index(self, val):
- if type(val) is not int:
- raise TypeError('Value of `index` must be an integer!')
- if val < 0:
- raise ValueError('Value of `index` must be zero or positive!')
- self.__index = val
-
- @property
- def shift(self):
- if self.__shift is None:
- raise NameError('Attribute `shift` not set yet!')
- return self.__shift
-
- @shift.setter
- def shift(self, val):
- if type(val) is not int:
- raise TypeError('Value of `shift` must be an integer!')
- if val < 0:
- raise ValueError('Value of `shift` must be zero or positive!')
- self.__shift = val
-
- @property
def mask(self):
if self.__mask is None:
raise NameError('Attribute `mask` not set yet!')
@@ -255,7 +219,6 @@ class CSSProperty:
raise ValueError('Value of `mask` must be zero or positive!')
self.__mask = val
-
class Bin:
def __init__(self, first_object):
self.contents = [ first_object ]
@@ -399,6 +362,10 @@ class CSSGroup:
def make_propset_h(self):
t = Text()
+ i_dot = '' if self.name is 'page' else 'i.'
+ grp = '' if self.name is 'style' else '->{}{}'.format(
+ '' if self.name is 'page' else i_dot, self.name)
+
if self.name is not 'style':
t.append('static const css_computed_{0} default_{0} = {{'.format(
self.name))
@@ -412,9 +379,8 @@ class CSSGroup:
for b in self.bits_array:
or_ops = []
for p in b.contents:
- or_ops.append('({} << {})'.format(p.default_op,
- str(p.shift))
- if p.shift else p.default_op)
+ or_ops.append('({} << {})'.format(p.defaults, str(p.shift))
+ if p.shift else p.defaults)
bits_ops.append(' | '.join(or_ops))
t.append(',\n'.join(bits_ops).split('\n'))
t.indent(-1)
@@ -432,10 +398,9 @@ class CSSGroup:
t.indent(-1)
t.append('};')
- t.append()
+ t.append()
t.escape_newline()
- i_dot = '' if self.name is 'page' else 'i.'
t.append('#define ENSURE_{} do {{'.format(self.name.upper()))
t.indent(1)
t.append('if (style->{}{} == NULL) {{'.format(i_dot, self.name))
@@ -457,9 +422,47 @@ class CSSGroup:
t.append()
for p in sorted(self.props, key=(lambda x: x.name)):
+ vals = []
+ for v in p.values:
+ vt, vn = shift_star(v.type, v.name)
+ vn += v.suffix
+ vals.append((vt, vn))
+ if v.bits is not None:
+ bt, bn = shift_star(v.bits['type'], v.bits['name'])
+ bn += v.suffix
+ vals.append((bt, bn))
+ params = ', '.join([ 'css_computed_style *style', 'uint8_t type' ]
+ + [ ' '.join(x) for x in vals ])
+ t.append()
t.append('#define {}_INDEX {}'.format(p.name.upper(), p.index))
t.append('#define {}_SHIFT {}'.format(p.name.upper(), p.shift))
t.append('#define {}_MASK {}'.format(p.name.upper(), p.mask))
+ t.append('static inline css_error set_{}({})'.format(
+ p.name, params))
+ t.append('{')
+ t.indent(1)
+ t.append('uint32_t bits;')
+ t.append()
+ if self.name is not 'style':
+ t.append('ENSURE_{};'.format(self.name.upper()))
+ t.append()
+ t.append('bits = &style{}->{}bits[{}_INDEX];'.format(
+ grp, i_dot, p.name.upper()))
+ t.comment()
+ bits = [
+ { 'letter': v.suffix[1] if v.suffix else v.bits['name'][0],
+ 'name': v.bits['name'] + v.suffix,
+ 'size': v.bits['size'] }
+ for v in p.values if v.bits is not None ]
+ bits.append({ 'letter': 't', 'size': p.type_size, 'name': 'type' })
+ bits_len = sum([ x['size'] for x in bits ])
+ t.append('{}bit{}: {} : {}'.format(
+ bits_len,
+ ('' if bits_len is 1 else 's'),
+ ''.join([ b['letter'] * b['size'] for b in bits ]),
+ ' | '.join([ b['name'] for b in bits ])))
+ t.comment()
+ t.indent(-1)
t.append('#undef {}_INDEX'.format(p.name.upper()))
t.append('#undef {}_SHIFT'.format(p.name.upper()))
t.append('#undef {}_MASK'.format(p.name.upper()))
@@ -472,15 +475,13 @@ class CSSGroup:
r = []
for p in sorted(self.props, key=(lambda x: x.name)):
if bool(p.comments) == for_commented:
- for i, v in enumerate(p.values):
- v_suffix = ('' if len(p.values) is 1 else
- '_' + string.ascii_lowercase[i])
+ for v in p.values:
if defaults:
- r.append('.{}{} = {}'.format(p.name, v_suffix,
- p.default_value(i)[0]))
+ r.append('.{}{} = {}'.format(p.name, v.suffix,
+ v.defaults[0]))
else:
v_type, v_name = shift_star(v.type, p.name)
- r.append('{} {}{};'.format(v_type, v_name, v_suffix))
+ r.append('{} {}{};'.format(v_type, v_name, v.suffix))
return r
def make_text(self, filename):