diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2014-11-06 14:39:07 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2014-11-07 12:24:25 +0000 |
commit | ad85983173b7cf21c5b46f7fb3798afdb38e9fea (patch) | |
tree | 439979631b3b4de50be4eb7c93835030d75c54c0 /src/select/properties | |
parent | a5c3cbf24c7112238643b58b346d6169ef904881 (diff) | |
download | libcss-ad85983173b7cf21c5b46f7fb3798afdb38e9fea.tar.gz libcss-ad85983173b7cf21c5b46f7fb3798afdb38e9fea.tar.bz2 |
Implement selection for column-gap property.
Diffstat (limited to 'src/select/properties')
-rw-r--r-- | src/select/properties/column_gap.c | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/src/select/properties/column_gap.c b/src/select/properties/column_gap.c index 8b7a841..641f529 100644 --- a/src/select/properties/column_gap.c +++ b/src/select/properties/column_gap.c @@ -17,54 +17,40 @@ css_error css__cascade_column_gap(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_GAP_SET: - length = *((css_fixed *) style->bytecode); - advance_bytecode(style, sizeof(length)); - unit = *((uint32_t *) style->bytecode); - advance_bytecode(style, sizeof(unit)); - break; - case COLUMN_GAP_NORMAL: - /** \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_gap); } css_error css__set_column_gap_from_hint(const css_hint *hint, css_computed_style *style) { - UNUSED(hint); - UNUSED(style); - - return CSS_OK; + return set_column_gap(style, hint->status, + hint->data.length.value, hint->data.length.unit); } css_error css__initial_column_gap(css_select_state *state) { - UNUSED(state); - - return CSS_OK; + return set_column_gap(state->computed, CSS_COLUMN_GAP_NORMAL, + INTTOFIX(1), CSS_UNIT_EM); } css_error css__compose_column_gap(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_gap(child, &length, &unit); + + if ((child->uncommon == NULL && parent->uncommon != NULL) || + type == CSS_COLUMN_GAP_INHERIT || + (child->uncommon != NULL && result != child)) { + if ((child->uncommon == NULL && parent->uncommon != NULL) || + type == CSS_COLUMN_GAP_INHERIT) { + type = get_column_gap(parent, &length, &unit); + } + + return set_column_gap(result, type, length, unit); + } return CSS_OK; } |