diff options
Diffstat (limited to 'src/select/properties/column_count.c')
-rw-r--r-- | src/select/properties/column_count.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/select/properties/column_count.c b/src/select/properties/column_count.c index efd1243..4adadd6 100644 --- a/src/select/properties/column_count.c +++ b/src/select/properties/column_count.c @@ -20,7 +20,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style, uint16_t value = CSS_COLUMN_COUNT_INHERIT; css_fixed count = 0; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case COLUMN_COUNT_SET: value = CSS_COLUMN_COUNT_SET; @@ -34,7 +34,7 @@ css_error css__cascade_column_count(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_column_count(state->computed, value, count); } @@ -52,6 +52,20 @@ css_error css__initial_column_count(css_select_state *state) return set_column_count(state->computed, CSS_COLUMN_COUNT_AUTO, 0); } +css_error css__copy_column_count( + const css_computed_style *from, + css_computed_style *to) +{ + int32_t count = 0; + uint8_t type = get_column_count(from, &count); + + if (from == to) { + return CSS_OK; + } + + return set_column_count(to, type, count); +} + css_error css__compose_column_count(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) @@ -59,9 +73,7 @@ css_error css__compose_column_count(const css_computed_style *parent, int32_t count = 0; uint8_t type = get_column_count(child, &count); - if (type == CSS_COLUMN_COUNT_INHERIT) { - type = get_column_count(parent, &count); - } - - return set_column_count(result, type, count); + return css__copy_column_count( + type == CSS_COLUMN_COUNT_INHERIT ? parent : child, + result); } |