diff options
Diffstat (limited to 'src/select/properties/vertical_align.c')
-rw-r--r-- | src/select/properties/vertical_align.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/select/properties/vertical_align.c b/src/select/properties/vertical_align.c index 9fb7143..790e5f0 100644 --- a/src/select/properties/vertical_align.c +++ b/src/select/properties/vertical_align.c @@ -21,7 +21,7 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style, css_fixed length = 0; uint32_t unit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case VERTICAL_ALIGN_SET: value = CSS_VERTICAL_ALIGN_SET; @@ -55,13 +55,20 @@ css_error css__cascade_vertical_align(uint32_t opv, css_style *style, case VERTICAL_ALIGN_TEXT_BOTTOM: value = CSS_VERTICAL_ALIGN_TEXT_BOTTOM; break; + case VERTICAL_ALIGN_CALC: + advance_bytecode(style, sizeof(unit)); + advance_bytecode(style, sizeof(unit)); // TODO + return CSS_OK; + default: + assert(0 && "Invalid value"); + break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_vertical_align(state->computed, value, length, unit); } @@ -81,6 +88,21 @@ css_error css__initial_vertical_align(css_select_state *state) 0, CSS_UNIT_PX); } +css_error css__copy_vertical_align( + const css_computed_style *from, + css_computed_style *to) +{ + css_fixed length = 0; + css_unit unit = CSS_UNIT_PX; + uint8_t type = get_vertical_align(from, &length, &unit); + + if (from == to) { + return CSS_OK; + } + + return set_vertical_align(to, type, length, unit); +} + css_error css__compose_vertical_align(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) @@ -89,10 +111,8 @@ css_error css__compose_vertical_align(const css_computed_style *parent, css_unit unit = CSS_UNIT_PX; uint8_t type = get_vertical_align(child, &length, &unit); - if (type == CSS_VERTICAL_ALIGN_INHERIT) { - type = get_vertical_align(parent, &length, &unit); - } - - return set_vertical_align(result, type, length, unit); + return css__copy_vertical_align( + type == CSS_VERTICAL_ALIGN_INHERIT ? parent : child, + result); } |