summaryrefslogtreecommitdiff
path: root/src/select/properties/flex_direction.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/flex_direction.c')
-rw-r--r--src/select/properties/flex_direction.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/select/properties/flex_direction.c b/src/select/properties/flex_direction.c
index 7dc46db..1d979be 100644
--- a/src/select/properties/flex_direction.c
+++ b/src/select/properties/flex_direction.c
@@ -57,16 +57,25 @@ css_error css__initial_flex_direction(css_select_state *state)
return set_flex_direction(state->computed, CSS_FLEX_DIRECTION_ROW);
}
+css_error css__copy_flex_direction(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_flex_direction(to, get_flex_direction(from));
+}
+
css_error css__compose_flex_direction(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_flex_direction(child);
- if (type == CSS_FLEX_DIRECTION_INHERIT) {
- type = get_flex_direction(parent);
- }
-
- return set_flex_direction(result, type);
+ return css__copy_flex_direction(
+ type == CSS_FLEX_DIRECTION_INHERIT ? parent : child,
+ result);
}