From 9a4646ccb841105404f153cfc5f76cfe3d61b35f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 18 Aug 2022 21:19:54 +0100 Subject: Select: Properties: Add copy handler for simple properties --- src/select/properties/justify_content.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/select/properties/justify_content.c') diff --git a/src/select/properties/justify_content.c b/src/select/properties/justify_content.c index 03c8bb4..385bab7 100644 --- a/src/select/properties/justify_content.c +++ b/src/select/properties/justify_content.c @@ -64,16 +64,25 @@ css_error css__initial_justify_content(css_select_state *state) CSS_JUSTIFY_CONTENT_FLEX_START); } +css_error css__copy_justify_content( + const css_computed_style *from, + css_computed_style *to) +{ + if (from == to) { + return CSS_OK; + } + + return set_justify_content(to, get_justify_content(from)); +} + css_error css__compose_justify_content(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_justify_content(child); - if (type == CSS_JUSTIFY_CONTENT_INHERIT) { - type = get_justify_content(parent); - } - - return set_justify_content(result, type); + return css__copy_justify_content( + type == CSS_JUSTIFY_CONTENT_INHERIT ? parent : child, + result); } -- cgit v1.2.3