From 0cab24ffcbe59104967362219f3c831c84681f7e Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 6 Dec 2014 15:34:27 +0000 Subject: Add column-width property to computed styles. --- src/select/propset.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/select/propset.h') diff --git a/src/select/propset.h b/src/select/propset.h index baac10b..769d3b3 100644 --- a/src/select/propset.h +++ b/src/select/propset.h @@ -30,7 +30,7 @@ static const css_computed_uncommon default_uncommon = { (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_SPAN_NONE << 6) | CSS_COLUMN_WIDTH_AUTO }, { 0, 0 }, { 0, 0, 0, 0 }, @@ -42,6 +42,7 @@ static const css_computed_uncommon default_uncommon = { 0, 0, 0, + 0, NULL, NULL, NULL, @@ -578,6 +579,31 @@ static inline css_error set_column_span( #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 -- cgit v1.2.3