diff options
Diffstat (limited to 'src/select/properties/position.c')
-rw-r--r-- | src/select/properties/position.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/select/properties/position.c b/src/select/properties/position.c index c7cc6bf..738dbff 100644 --- a/src/select/properties/position.c +++ b/src/select/properties/position.c @@ -57,16 +57,25 @@ css_error css__initial_position(css_select_state *state) return set_position(state->computed, CSS_POSITION_STATIC); } +css_error css__copy_position( + const css_computed_style *from, + css_computed_style *to) +{ + if (from == to) { + return CSS_OK; + } + + return set_position(to, get_position(from)); +} + css_error css__compose_position(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_position(child); - if (type == CSS_POSITION_INHERIT) { - type = get_position(parent); - } - - return set_position(result, type); + return css__copy_position( + type == CSS_POSITION_INHERIT ? parent : child, + result); } |