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/properties/column_width.c | 54 +++++++++++++----------------------- 1 file changed, 20 insertions(+), 34 deletions(-) (limited to 'src/select/properties/column_width.c') diff --git a/src/select/properties/column_width.c b/src/select/properties/column_width.c index fd053d9..45eb7fc 100644 --- a/src/select/properties/column_width.c +++ b/src/select/properties/column_width.c @@ -14,57 +14,43 @@ #include "select/properties/properties.h" #include "select/properties/helpers.h" -css_error css__cascade_column_width(uint32_t opv, css_style *style, +css_error css__cascade_column_width(uint32_t opv, css_style *style, css_select_state *state) { - css_fixed length = 0; - uint32_t unit = UNIT_PX; - - if (isInherit(opv) == false) { - switch (getValue(opv)) { - case COLUMN_WIDTH_SET: - length = *((css_fixed *) style->bytecode); - advance_bytecode(style, sizeof(length)); - unit = *((uint32_t *) style->bytecode); - advance_bytecode(style, sizeof(unit)); - break; - case COLUMN_WIDTH_AUTO: - /** \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_length_normal(opv, style, state, set_column_width); } css_error css__set_column_width_from_hint(const css_hint *hint, css_computed_style *style) { - UNUSED(hint); - UNUSED(style); - - return CSS_OK; + return set_column_width(style, hint->status, + hint->data.length.value, hint->data.length.unit); } css_error css__initial_column_width(css_select_state *state) { - UNUSED(state); - - return CSS_OK; + return set_column_width(state->computed, CSS_COLUMN_WIDTH_AUTO, + INTTOFIX(1), CSS_UNIT_EM); } css_error css__compose_column_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { - UNUSED(parent); - UNUSED(child); - UNUSED(result); + css_fixed length = INTTOFIX(1); + css_unit unit = CSS_UNIT_EM; + uint8_t type = get_column_width(child, &length, &unit); + + if ((child->uncommon == NULL && parent->uncommon != NULL) || + type == CSS_COLUMN_WIDTH_INHERIT || + (child->uncommon != NULL && result != child)) { + if ((child->uncommon == NULL && parent->uncommon != NULL) || + type == CSS_COLUMN_WIDTH_INHERIT) { + type = get_column_width(parent, &length, &unit); + } + + return set_column_width(result, type, length, unit); + } return CSS_OK; } -- cgit v1.2.3