From 32d6b37b16f9c8a840ccc2b6d4d7ef4b706097f4 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 16 Nov 2014 11:59:13 +0000 Subject: Add column_rule_style to computed styles. --- src/select/computed.h | 7 +++-- src/select/properties/column_rule_style.c | 47 ++++++++----------------------- src/select/propget.h | 21 ++++++++++++++ src/select/propset.h | 25 +++++++++++++++- 4 files changed, 60 insertions(+), 40 deletions(-) (limited to 'src/select') diff --git a/src/select/computed.h b/src/select/computed.h index 2f90985..71a3916 100644 --- a/src/select/computed.h +++ b/src/select/computed.h @@ -21,12 +21,13 @@ typedef struct css_computed_uncommon { * column_fill 2 0 * column_gap 2 + 4 4 * column_rule_color 2 4 + * column_rule_style 4 0 * letter_spacing 2 + 4 4 * outline_color 2 4 * outline_width 3 + 4 4 * word_spacing 2 + 4 4 * --- --- - * 64 bits 52 bytes + * 68 bits 52 bytes * * Encode counter_increment and _reset as an array of name, value pairs, * terminated with a blank entry. @@ -50,7 +51,7 @@ typedef struct css_computed_uncommon { * 2 bits sizeof(ptr) * * ___ ___ - * 73 bits 52 + 4sizeof(ptr) bytes + * 81 bits 52 + 4sizeof(ptr) bytes * * 10 bytes 52 + 4sizeof(ptr) bytes * =================== @@ -67,7 +68,7 @@ typedef struct css_computed_uncommon { * 6 cccccccc clip * 7 cccccccc clip * 8 ccccccoo clip | content - * 9 ccff.... column_count | column-fill | + * 9 ccffssss column_count | column-fill | column-rule-style * 10 ggggggcc column-gap | column-rule-color */ uint8_t bits[10]; diff --git a/src/select/properties/column_rule_style.c b/src/select/properties/column_rule_style.c index ba558a2..586ce5d 100644 --- a/src/select/properties/column_rule_style.c +++ b/src/select/properties/column_rule_style.c @@ -17,57 +17,32 @@ css_error css__cascade_column_rule_style(uint32_t opv, css_style *style, css_select_state *state) { - UNUSED(style); - - if (isInherit(opv) == false) { - switch (getValue(opv)) { - case COLUMN_RULE_STYLE_NONE: - case COLUMN_RULE_STYLE_HIDDEN: - case COLUMN_RULE_STYLE_DOTTED: - case COLUMN_RULE_STYLE_DASHED: - case COLUMN_RULE_STYLE_SOLID: - case COLUMN_RULE_STYLE_DOUBLE: - case COLUMN_RULE_STYLE_GROOVE: - case COLUMN_RULE_STYLE_RIDGE: - case COLUMN_RULE_STYLE_INSET: - case COLUMN_RULE_STYLE_OUTSET: - /** \todo convert to public values */ - break; - } - } - - if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { - /** \todo set computed elevation */ - } - - return CSS_OK; + return css__cascade_border_style(opv, style, state, + set_column_rule_style); } css_error css__set_column_rule_style_from_hint(const css_hint *hint, css_computed_style *style) { - UNUSED(hint); - UNUSED(style); - - return CSS_OK; + return set_column_rule_style(style, hint->status); } css_error css__initial_column_rule_style(css_select_state *state) { - UNUSED(state); - - return CSS_OK; + return set_column_rule_style(state->computed, + CSS_COLUMN_RULE_STYLE_NONE); } css_error css__compose_column_rule_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { - UNUSED(parent); - UNUSED(child); - UNUSED(result); + uint8_t type = get_column_rule_style(child); + + if (type == CSS_COLUMN_RULE_STYLE_INHERIT) { + type = get_column_rule_style(parent); + } - return CSS_OK; + return set_column_rule_style(result, type); } diff --git a/src/select/propget.h b/src/select/propget.h index 499f705..4ced8bb 100644 --- a/src/select/propget.h +++ b/src/select/propget.h @@ -438,6 +438,27 @@ static inline uint8_t get_column_rule_color( #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 uint8_t get_column_rule_style( + const css_computed_style *style) +{ + if (style->uncommon != NULL) { + uint8_t bits = style->uncommon->bits[COLUMN_RULE_STYLE_INDEX]; + bits &= COLUMN_RULE_STYLE_MASK; + bits >>= COLUMN_RULE_STYLE_SHIFT; + + /* 4bits: type */ + return bits; + } + + return CSS_COLUMN_RULE_STYLE_NONE; +} +#undef COLUMN_RULE_STYLE_MASK +#undef COLUMN_RULE_STYLE_SHIFT +#undef COLUMN_RULE_STYLE_INDEX + #define CONTENT_INDEX 7 #define CONTENT_SHIFT 0 #define CONTENT_MASK 0x3 diff --git a/src/select/propset.h b/src/select/propset.h index 07ba906..5aa253e 100644 --- a/src/select/propset.h +++ b/src/select/propset.h @@ -26,7 +26,8 @@ static const css_computed_uncommon default_uncommon = { 0, 0, (CSS_CLIP_AUTO << 2) | CSS_CONTENT_NORMAL, - (CSS_COLUMN_COUNT_AUTO << 6) | (CSS_COLUMN_FILL_BALANCE << 4), + (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) }, { 0, 0 }, @@ -505,6 +506,28 @@ static inline css_error set_column_rule_color( #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 CONTENT_INDEX 7 #define CONTENT_SHIFT 0 #define CONTENT_MASK 0x3 -- cgit v1.2.3