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.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/select/properties/flex_direction.c b/src/select/properties/flex_direction.c
index 79703be..1d979be 100644
--- a/src/select/properties/flex_direction.c
+++ b/src/select/properties/flex_direction.c
@@ -21,7 +21,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style,
UNUSED(style);
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FLEX_DIRECTION_ROW:
value = CSS_FLEX_DIRECTION_ROW;
@@ -39,7 +39,7 @@ css_error css__cascade_flex_direction(uint32_t opv, css_style *style,
}
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_flex_direction(state->computed, value);
}
@@ -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);
}