diff options
Diffstat (limited to 'src/select/propset.h')
-rw-r--r-- | src/select/propset.h | 352 |
1 files changed, 276 insertions, 76 deletions
diff --git a/src/select/propset.h b/src/select/propset.h index b7da5a6..769d3b3 100644 --- a/src/select/propset.h +++ b/src/select/propset.h @@ -20,12 +20,17 @@ static const css_computed_uncommon default_uncommon = { { (CSS_LETTER_SPACING_INHERIT << 2) | CSS_OUTLINE_COLOR_INVERT, (CSS_OUTLINE_WIDTH_MEDIUM << 1) | CSS_BORDER_SPACING_INHERIT, 0, - (CSS_WORD_SPACING_INHERIT << 2) | + (CSS_WORD_SPACING_INHERIT << 2) | (CSS_COUNTER_INCREMENT_NONE << 1) | CSS_COUNTER_RESET_NONE, (CSS_CURSOR_INHERIT << 3) | (CSS_WRITING_MODE_INHERIT << 1) | 0, 0, 0, - (CSS_CLIP_AUTO << 2) | CSS_CONTENT_NORMAL + (CSS_CLIP_AUTO << 2) | CSS_CONTENT_NORMAL, + (CSS_COLUMN_COUNT_AUTO << 6) | (CSS_COLUMN_FILL_BALANCE << 4) | + (CSS_COLUMN_RULE_STYLE_NONE << 0), + (CSS_COLUMN_GAP_NORMAL << 2) | (CSS_COLUMN_RULE_COLOR_CURRENT_COLOR), + (CSS_COLUMN_RULE_WIDTH_MEDIUM << 1), + (CSS_COLUMN_SPAN_NONE << 6) | CSS_COLUMN_WIDTH_AUTO }, { 0, 0 }, { 0, 0, 0, 0 }, @@ -33,6 +38,11 @@ static const css_computed_uncommon default_uncommon = { 0, 0, 0, + 0, + 0, + 0, + 0, + 0, NULL, NULL, NULL, @@ -51,14 +61,14 @@ static const css_computed_uncommon default_uncommon = { } while(0) static const css_computed_page default_page = { - { - (CSS_PAGE_BREAK_INSIDE_AUTO << 6) | + { + (CSS_PAGE_BREAK_INSIDE_AUTO << 6) | (CSS_PAGE_BREAK_BEFORE_AUTO << 3) | CSS_PAGE_BREAK_AFTER_AUTO, - (CSS_WIDOWS_SET << 1) | + (CSS_WIDOWS_SET << 1) | CSS_ORPHANS_SET }, - 2 << CSS_RADIX_POINT, + 2 << CSS_RADIX_POINT, 2 << CSS_RADIX_POINT }; @@ -77,7 +87,7 @@ static const css_computed_page default_page = { #define LETTER_SPACING_SHIFT 2 #define LETTER_SPACING_MASK 0xfc static inline css_error set_letter_spacing( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits; @@ -87,7 +97,7 @@ static inline css_error set_letter_spacing( bits = &style->uncommon->bits[LETTER_SPACING_INDEX]; /* 6bits: uuuutt : unit | type */ - *bits = (*bits & ~LETTER_SPACING_MASK) | + *bits = (*bits & ~LETTER_SPACING_MASK) | (((type & 0x3) | unit << 2) << LETTER_SPACING_SHIFT); style->uncommon->letter_spacing = length; @@ -126,7 +136,7 @@ static inline css_error set_outline_color( #define OUTLINE_WIDTH_SHIFT 1 #define OUTLINE_WIDTH_MASK 0xfe static inline css_error set_outline_width( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits; @@ -153,7 +163,7 @@ static inline css_error set_outline_width( #define BORDER_SPACING_INDEX1 2 #define BORDER_SPACING_SHIFT1 0 static inline css_error set_border_spacing( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed hlength, css_unit hunit, css_fixed vlength, css_unit vunit) { @@ -164,7 +174,7 @@ static inline css_error set_border_spacing( bits = &style->uncommon->bits[BORDER_SPACING_INDEX]; /* 1 bit: type */ - *bits = (*bits & ~BORDER_SPACING_MASK) | + *bits = (*bits & ~BORDER_SPACING_MASK) | ((type & 0x1) << BORDER_SPACING_SHIFT); bits = &style->uncommon->bits[BORDER_SPACING_INDEX1]; @@ -188,7 +198,7 @@ static inline css_error set_border_spacing( #define WORD_SPACING_SHIFT 2 #define WORD_SPACING_MASK 0xfc static inline css_error set_word_spacing( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits; @@ -200,7 +210,7 @@ static inline css_error set_word_spacing( /* 6bits: uuuutt : unit | type */ *bits = (*bits & ~WORD_SPACING_MASK) | (((type & 0x3) | (unit << 2)) << WORD_SPACING_SHIFT); - + style->uncommon->word_spacing = length; return CSS_OK; @@ -235,7 +245,7 @@ static inline css_error set_writing_mode( #define COUNTER_INCREMENT_SHIFT 1 #define COUNTER_INCREMENT_MASK 0x2 static inline css_error set_counter_increment( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_computed_counter *counters) { uint8_t *bits; @@ -275,7 +285,7 @@ static inline css_error set_counter_increment( #define COUNTER_RESET_SHIFT 0 #define COUNTER_RESET_MASK 0x1 static inline css_error set_counter_reset( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_computed_counter *counters) { uint8_t *bits; @@ -315,7 +325,7 @@ static inline css_error set_counter_reset( #define CURSOR_SHIFT 3 #define CURSOR_MASK 0xf8 static inline css_error set_cursor( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, lwc_string **urls) { uint8_t *bits; @@ -359,7 +369,7 @@ static inline css_error set_cursor( #define CLIP_INDEX2 6 #define CLIP_SHIFT2 0 static inline css_error set_clip( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_computed_clip_rect *rect) { uint8_t *bits; @@ -369,7 +379,7 @@ static inline css_error set_clip( bits = &style->uncommon->bits[CLIP_INDEX]; /* 6bits: trblyy : top | right | bottom | left | type */ - *bits = (*bits & ~CLIP_MASK) | + *bits = (*bits & ~CLIP_MASK) | ((type & 0x3) << CLIP_SHIFT); if (type == CSS_CLIP_RECT) { @@ -404,6 +414,196 @@ static inline css_error set_clip( #undef CLIP_SHIFT #undef CLIP_INDEX +#define COLUMN_COUNT_INDEX 8 +#define COLUMN_COUNT_SHIFT 6 +#define COLUMN_COUNT_MASK 0xc0 +static inline css_error set_column_count( + css_computed_style *style, uint8_t type, int32_t count) +{ + uint8_t *bits; + + ENSURE_UNCOMMON; + + bits = &style->uncommon->bits[COLUMN_COUNT_INDEX]; + + /* 2bits: tt : type */ + *bits = (*bits & ~COLUMN_COUNT_MASK) | + ((type & 0x3) << COLUMN_COUNT_SHIFT); + + style->uncommon->column_count = count; + + return CSS_OK; +} +#undef COLUMN_COUNT_MASK +#undef COLUMN_COUNT_SHIFT +#undef COLUMN_COUNT_INDEX + +#define COLUMN_FILL_INDEX 8 +#define COLUMN_FILL_SHIFT 4 +#define COLUMN_FILL_MASK 0x30 +static inline css_error set_column_fill( + css_computed_style *style, uint8_t type) +{ + uint8_t *bits; + + ENSURE_UNCOMMON; + + bits = &style->uncommon->bits[COLUMN_FILL_INDEX]; + + /* 2bits: tt : type */ + *bits = (*bits & ~COLUMN_FILL_MASK) | + ((type & 0x3) << COLUMN_FILL_SHIFT); + + return CSS_OK; +} +#undef COLUMN_FILL_MASK +#undef COLUMN_FILL_SHIFT +#undef COLUMN_FILL_INDEX + +#define COLUMN_GAP_INDEX 9 +#define COLUMN_GAP_SHIFT 2 +#define COLUMN_GAP_MASK 0xfc +static inline css_error set_column_gap( + css_computed_style *style, uint8_t type, + css_fixed length, css_unit unit) +{ + uint8_t *bits; + + ENSURE_UNCOMMON; + + bits = &style->uncommon->bits[COLUMN_GAP_INDEX]; + + /* 6bits: uuuutt : units | type */ + *bits = (*bits & ~COLUMN_GAP_MASK) | + (((type & 0x3) | (unit << 2)) << COLUMN_GAP_SHIFT); + + style->uncommon->column_gap = length; + + return CSS_OK; +} +#undef COLUMN_GAP_MASK +#undef COLUMN_GAP_SHIFT +#undef COLUMN_GAP_INDEX + +#define COLUMN_RULE_COLOR_INDEX 9 +#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) +{ + uint8_t *bits; + + ENSURE_UNCOMMON; + + bits = &style->uncommon->bits[COLUMN_RULE_COLOR_INDEX]; + + /* 2bits: type */ + *bits = (*bits & ~COLUMN_RULE_COLOR_MASK) | + ((type & 0x3) << COLUMN_RULE_COLOR_SHIFT); + + style->uncommon->column_rule_color = color; + + return CSS_OK; +} +#undef COLUMN_RULE_COLOR_MASK +#undef COLUMN_RULE_COLOR_SHIFT +#undef COLUMN_RULE_COLOR_INDEX + +#define COLUMN_RULE_STYLE_INDEX 8 +#define COLUMN_RULE_STYLE_SHIFT 0 +#define COLUMN_RULE_STYLE_MASK 0xf +static inline css_error set_column_rule_style( + css_computed_style *style, uint8_t type) +{ + uint8_t *bits; + + ENSURE_UNCOMMON; + + bits = &style->uncommon->bits[COLUMN_RULE_STYLE_INDEX]; + + /* 4bits: type */ + *bits = (*bits & ~COLUMN_RULE_STYLE_MASK) | + ((type & 0xf) << COLUMN_RULE_STYLE_SHIFT); + + return CSS_OK; +} +#undef COLUMN_RULE_STYLE_MASK +#undef COLUMN_RULE_STYLE_SHIFT +#undef COLUMN_RULE_STYLE_INDEX + +#define COLUMN_RULE_WIDTH_INDEX 10 +#define COLUMN_RULE_WIDTH_SHIFT 1 +#define COLUMN_RULE_WIDTH_MASK 0xfe +static inline css_error set_column_rule_width( + css_computed_style *style, uint8_t type, + css_fixed length, css_unit unit) +{ + uint8_t *bits; + + ENSURE_UNCOMMON; + + bits = &style->uncommon->bits[COLUMN_RULE_WIDTH_INDEX]; + + /* 7bits: uuuuttt : units | type */ + *bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) | + (((type & 0x7) | (unit << 3)) << COLUMN_RULE_WIDTH_SHIFT); + + style->uncommon->column_rule_width = length; + + return CSS_OK; +} +#undef COLUMN_RULE_WIDTH_MASK +#undef COLUMN_RULE_WIDTH_SHIFT +#undef COLUMN_RULE_WIDTH_INDEX + +#define COLUMN_SPAN_INDEX 11 +#define COLUMN_SPAN_SHIFT 6 +#define COLUMN_SPAN_MASK 0xc0 +static inline css_error set_column_span( + css_computed_style *style, uint8_t type) +{ + uint8_t *bits; + + ENSURE_UNCOMMON; + + bits = &style->uncommon->bits[COLUMN_SPAN_INDEX]; + + /* 2bits: tt : type */ + *bits = (*bits & ~COLUMN_SPAN_MASK) | + ((type & 0x3) << COLUMN_SPAN_SHIFT); + + return CSS_OK; +} +#undef COLUMN_SPAN_MASK +#undef COLUMN_SPAN_SHIFT +#undef COLUMN_SPAN_INDEX + +#define COLUMN_WIDTH_INDEX 11 +#define COLUMN_WIDTH_SHIFT 0 +#define COLUMN_WIDTH_MASK 0x3f +static inline css_error set_column_width( + css_computed_style *style, uint8_t type, + css_fixed length, css_unit unit) +{ + uint8_t *bits; + + ENSURE_UNCOMMON; + + bits = &style->uncommon->bits[COLUMN_WIDTH_INDEX]; + + /* 6bits: uuuutt : units | type */ + *bits = (*bits & ~COLUMN_WIDTH_MASK) | + (((type & 0x3) | (unit << 2)) << COLUMN_WIDTH_SHIFT); + + style->uncommon->column_width = length; + + return CSS_OK; +} +#undef COLUMN_WIDTH_MASK +#undef COLUMN_WIDTH_SHIFT +#undef COLUMN_WIDTH_INDEX + #define CONTENT_INDEX 7 #define CONTENT_SHIFT 0 #define CONTENT_MASK 0x3 @@ -424,7 +624,7 @@ static inline css_error set_content( *bits = (*bits & ~CONTENT_MASK) | ((type & 0x3) << CONTENT_SHIFT); - for (c = content; c != NULL && + for (c = content; c != NULL && c->type != CSS_COMPUTED_CONTENT_NONE; c++) { switch (c->type) { case CSS_COMPUTED_CONTENT_STRING: @@ -441,9 +641,9 @@ static inline css_error set_content( lwc_string_ref(c->data.counter.name); break; case CSS_COMPUTED_CONTENT_COUNTERS: - c->data.counters.name = + c->data.counters.name = lwc_string_ref(c->data.counters.name); - c->data.counters.sep = + c->data.counters.sep = lwc_string_ref(c->data.counters.sep); break; default: @@ -455,7 +655,7 @@ static inline css_error set_content( /* Free existing array */ if (oldcontent != NULL) { - for (c = oldcontent; + for (c = oldcontent; c->type != CSS_COMPUTED_CONTENT_NONE; c++) { switch (c->type) { case CSS_COMPUTED_CONTENT_STRING: @@ -493,7 +693,7 @@ static inline css_error set_content( #define VERTICAL_ALIGN_INDEX 0 #define VERTICAL_ALIGN_SHIFT 0 static inline css_error set_vertical_align( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[VERTICAL_ALIGN_INDEX]; @@ -511,7 +711,7 @@ static inline css_error set_vertical_align( #define FONT_SIZE_INDEX 1 #define FONT_SIZE_SHIFT 0 static inline css_error set_font_size( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[FONT_SIZE_INDEX]; @@ -530,7 +730,7 @@ static inline css_error set_font_size( #define BORDER_TOP_WIDTH_SHIFT 1 #define BORDER_TOP_WIDTH_MASK 0xfe static inline css_error set_border_top_width( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BORDER_TOP_WIDTH_INDEX]; @@ -551,7 +751,7 @@ static inline css_error set_border_top_width( #define BORDER_RIGHT_WIDTH_SHIFT 1 #define BORDER_RIGHT_WIDTH_MASK 0xfe static inline css_error set_border_right_width( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BORDER_RIGHT_WIDTH_INDEX]; @@ -572,7 +772,7 @@ static inline css_error set_border_right_width( #define BORDER_BOTTOM_WIDTH_SHIFT 1 #define BORDER_BOTTOM_WIDTH_MASK 0xfe static inline css_error set_border_bottom_width( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BORDER_BOTTOM_WIDTH_INDEX]; @@ -593,7 +793,7 @@ static inline css_error set_border_bottom_width( #define BORDER_LEFT_WIDTH_SHIFT 1 #define BORDER_LEFT_WIDTH_MASK 0xfe static inline css_error set_border_left_width( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BORDER_LEFT_WIDTH_INDEX]; @@ -614,7 +814,7 @@ static inline css_error set_border_left_width( #define BACKGROUND_IMAGE_SHIFT 0 #define BACKGROUND_IMAGE_MASK 0x1 static inline css_error set_background_image( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, lwc_string *url) { uint8_t *bits = &style->bits[BACKGROUND_IMAGE_INDEX]; @@ -643,7 +843,7 @@ static inline css_error set_background_image( #define COLOR_SHIFT 0 #define COLOR_MASK 0x1 static inline css_error set_color( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[COLOR_INDEX]; @@ -664,7 +864,7 @@ static inline css_error set_color( #define LIST_STYLE_IMAGE_SHIFT 0 #define LIST_STYLE_IMAGE_MASK 0x1 static inline css_error set_list_style_image( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, lwc_string *url) { uint8_t *bits = &style->bits[LIST_STYLE_IMAGE_INDEX]; @@ -693,7 +893,7 @@ static inline css_error set_list_style_image( #define QUOTES_SHIFT 0 #define QUOTES_MASK 0x1 static inline css_error set_quotes( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, lwc_string **quotes) { uint8_t *bits = &style->bits[QUOTES_INDEX]; @@ -728,7 +928,7 @@ static inline css_error set_quotes( #define TOP_SHIFT 2 #define TOP_MASK 0xfc static inline css_error set_top( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[TOP_INDEX]; @@ -749,7 +949,7 @@ static inline css_error set_top( #define RIGHT_SHIFT 2 #define RIGHT_MASK 0xfc static inline css_error set_right( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[RIGHT_INDEX]; @@ -770,7 +970,7 @@ static inline css_error set_right( #define BOTTOM_SHIFT 2 #define BOTTOM_MASK 0xfc static inline css_error set_bottom( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BOTTOM_INDEX]; @@ -791,7 +991,7 @@ static inline css_error set_bottom( #define LEFT_SHIFT 2 #define LEFT_MASK 0xfc static inline css_error set_left( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[LEFT_INDEX]; @@ -812,7 +1012,7 @@ static inline css_error set_left( #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_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BORDER_TOP_COLOR_INDEX]; @@ -833,7 +1033,7 @@ static inline css_error set_border_top_color( #define BORDER_RIGHT_COLOR_SHIFT 0 #define BORDER_RIGHT_COLOR_MASK 0x3 static inline css_error set_border_right_color( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BORDER_RIGHT_COLOR_INDEX]; @@ -854,7 +1054,7 @@ static inline css_error set_border_right_color( #define BORDER_BOTTOM_COLOR_SHIFT 0 #define BORDER_BOTTOM_COLOR_MASK 0x3 static inline css_error set_border_bottom_color( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BORDER_BOTTOM_COLOR_INDEX]; @@ -875,7 +1075,7 @@ static inline css_error set_border_bottom_color( #define BORDER_LEFT_COLOR_SHIFT 0 #define BORDER_LEFT_COLOR_MASK 0x3 static inline css_error set_border_left_color( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BORDER_LEFT_COLOR_INDEX]; @@ -896,7 +1096,7 @@ static inline css_error set_border_left_color( #define HEIGHT_SHIFT 2 #define HEIGHT_MASK 0xfc static inline css_error set_height( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[HEIGHT_INDEX]; @@ -917,7 +1117,7 @@ static inline css_error set_height( #define LINE_HEIGHT_SHIFT 2 #define LINE_HEIGHT_MASK 0xfc static inline css_error set_line_height( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[LINE_HEIGHT_INDEX]; @@ -938,7 +1138,7 @@ static inline css_error set_line_height( #define BACKGROUND_COLOR_SHIFT 0 #define BACKGROUND_COLOR_MASK 0x3 static inline css_error set_background_color( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BACKGROUND_COLOR_INDEX]; @@ -959,7 +1159,7 @@ static inline css_error set_background_color( #define Z_INDEX_SHIFT 0 #define Z_INDEX_MASK 0x3 static inline css_error set_z_index( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, int32_t z_index) { uint8_t *bits = &style->bits[Z_INDEX_INDEX]; @@ -980,7 +1180,7 @@ static inline css_error set_z_index( #define MARGIN_TOP_SHIFT 2 #define MARGIN_TOP_MASK 0xfc static inline css_error set_margin_top( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MARGIN_TOP_INDEX]; @@ -1001,7 +1201,7 @@ static inline css_error set_margin_top( #define MARGIN_RIGHT_SHIFT 2 #define MARGIN_RIGHT_MASK 0xfc static inline css_error set_margin_right( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MARGIN_RIGHT_INDEX]; @@ -1022,7 +1222,7 @@ static inline css_error set_margin_right( #define MARGIN_BOTTOM_SHIFT 2 #define MARGIN_BOTTOM_MASK 0xfc static inline css_error set_margin_bottom( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MARGIN_BOTTOM_INDEX]; @@ -1043,7 +1243,7 @@ static inline css_error set_margin_bottom( #define MARGIN_LEFT_SHIFT 2 #define MARGIN_LEFT_MASK 0xfc static inline css_error set_margin_left( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MARGIN_LEFT_INDEX]; @@ -1136,7 +1336,7 @@ static inline css_error set_direction( #define MAX_HEIGHT_SHIFT 2 #define MAX_HEIGHT_MASK 0xfc static inline css_error set_max_height( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MAX_HEIGHT_INDEX]; @@ -1157,7 +1357,7 @@ static inline css_error set_max_height( #define MAX_WIDTH_SHIFT 2 #define MAX_WIDTH_MASK 0xfc static inline css_error set_max_width( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MAX_WIDTH_INDEX]; @@ -1178,7 +1378,7 @@ static inline css_error set_max_width( #define WIDTH_SHIFT 2 #define WIDTH_MASK 0xfc static inline css_error set_width( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[WIDTH_INDEX]; @@ -1253,7 +1453,7 @@ static inline css_error set_font_style( #define MIN_HEIGHT_SHIFT 3 #define MIN_HEIGHT_MASK 0xf8 static inline css_error set_min_height( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MIN_HEIGHT_INDEX]; @@ -1274,7 +1474,7 @@ static inline css_error set_min_height( #define MIN_WIDTH_SHIFT 3 #define MIN_WIDTH_MASK 0xf8 static inline css_error set_min_width( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MIN_WIDTH_INDEX]; @@ -1331,7 +1531,7 @@ static inline css_error set_clear( #define PADDING_TOP_SHIFT 3 #define PADDING_TOP_MASK 0xf8 static inline css_error set_padding_top( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[PADDING_TOP_INDEX]; @@ -1352,7 +1552,7 @@ static inline css_error set_padding_top( #define PADDING_RIGHT_SHIFT 3 #define PADDING_RIGHT_MASK 0xf8 static inline css_error set_padding_right( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[PADDING_RIGHT_INDEX]; @@ -1373,7 +1573,7 @@ static inline css_error set_padding_right( #define PADDING_BOTTOM_SHIFT 3 #define PADDING_BOTTOM_MASK 0xf8 static inline css_error set_padding_bottom( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[PADDING_BOTTOM_INDEX]; @@ -1394,7 +1594,7 @@ static inline css_error set_padding_bottom( #define PADDING_LEFT_SHIFT 3 #define PADDING_LEFT_MASK 0xf8 static inline css_error set_padding_left( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[PADDING_LEFT_INDEX]; @@ -1469,7 +1669,7 @@ static inline css_error set_position( #define OPACITY_SHIFT 2 #define OPACITY_MASK 0x04 static inline css_error set_opacity( - css_computed_style *style, + css_computed_style *style, uint8_t type, css_fixed opacity) { uint8_t *bits = &style->bits[OPACITY_INDEX]; @@ -1508,7 +1708,7 @@ static inline css_error set_text_transform( #define TEXT_INDENT_SHIFT 3 #define TEXT_INDENT_MASK 0xf8 static inline css_error set_text_indent( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[TEXT_INDENT_INDEX]; @@ -1549,7 +1749,7 @@ static inline css_error set_white_space( #define BACKGROUND_POSITION_INDEX1 26 #define BACKGROUND_POSITION_SHIFT1 0 static inline css_error set_background_position( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, css_fixed hlength, css_unit hunit, css_fixed vlength, css_unit vunit) { @@ -1558,7 +1758,7 @@ static inline css_error set_background_position( bits = &style->bits[BACKGROUND_POSITION_INDEX]; /* 1 bit: type */ - *bits = (*bits & ~BACKGROUND_POSITION_MASK) | + *bits = (*bits & ~BACKGROUND_POSITION_MASK) | ((type & 0x1) << BACKGROUND_POSITION_SHIFT); bits = &style->bits[BACKGROUND_POSITION_INDEX1]; @@ -1635,7 +1835,7 @@ static inline css_error set_text_decoration( #define FONT_FAMILY_SHIFT 0 #define FONT_FAMILY_MASK 0x7 static inline css_error set_font_family( - css_computed_style *style, uint8_t type, + css_computed_style *style, uint8_t type, lwc_string **names) { uint8_t *bits = &style->bits[FONT_FAMILY_INDEX]; @@ -1923,9 +2123,9 @@ static inline css_error set_page_break_before( return CSS_OK; } } - + ENSURE_PAGE; - + bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX]; /* 3bits: type */ @@ -1951,7 +2151,7 @@ static inline css_error set_page_break_inside( return CSS_OK; } } - + ENSURE_PAGE; bits = &style->page->bits[PAGE_BREAK_INSIDE_INDEX]; @@ -1973,7 +2173,7 @@ static inline css_error set_orphans( css_computed_style *style, uint8_t type, int32_t count) { uint8_t *bits; - + if (style->page == NULL) { if (type == CSS_ORPHANS_SET && count == 2) { return CSS_OK; @@ -1981,14 +2181,14 @@ static inline css_error set_orphans( } ENSURE_PAGE; - + bits = &style->page->bits[ORPHANS_INDEX]; - + /* 1bit: type */ *bits = (*bits & ~ORPHANS_MASK) | ((type & 0x1) << ORPHANS_SHIFT); - + style->page->orphans = count; - + return CSS_OK; } #undef ORPHANS_INDEX @@ -2002,22 +2202,22 @@ static inline css_error set_widows( css_computed_style *style, uint8_t type, int32_t count) { uint8_t *bits; - + if (style->page == NULL) { if (type == CSS_WIDOWS_SET && count == 2) { return CSS_OK; } } - + ENSURE_PAGE; - + bits = &style->page->bits[WIDOWS_INDEX]; - + /* 1bit: type */ *bits = (*bits & ~WIDOWS_MASK) | ((type & 0x1) << WIDOWS_SHIFT); - + style->page->widows = count; - + return CSS_OK; } #undef WIDOWS_INDEX |