diff options
Diffstat (limited to 'src/select/properties/display.c')
-rw-r--r-- | src/select/properties/display.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/select/properties/display.c b/src/select/properties/display.c index 510d24a..5455d20 100644 --- a/src/select/properties/display.c +++ b/src/select/properties/display.c @@ -21,7 +21,7 @@ css_error css__cascade_display(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case DISPLAY_INLINE: value = CSS_DISPLAY_INLINE; @@ -77,11 +77,17 @@ css_error css__cascade_display(uint32_t opv, css_style *style, case DISPLAY_INLINE_FLEX: value = CSS_DISPLAY_INLINE_FLEX; break; + case DISPLAY_GRID: + value = CSS_DISPLAY_GRID; + break; + case DISPLAY_INLINE_GRID: + value = CSS_DISPLAY_INLINE_GRID; + break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_display(state->computed, value); } @@ -99,16 +105,25 @@ css_error css__initial_display(css_select_state *state) return set_display(state->computed, CSS_DISPLAY_INLINE); } +css_error css__copy_display( + const css_computed_style *from, + css_computed_style *to) +{ + if (from == to) { + return CSS_OK; + } + + return set_display(to, get_display(from)); +} + css_error css__compose_display(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_display(child); - if (type == CSS_DISPLAY_INHERIT) { - type = get_display(parent); - } - - return set_display(result, type); + return css__copy_display( + type == CSS_DISPLAY_INHERIT ? parent : child, + result); } |