diff options
Diffstat (limited to 'src/select/properties/border_spacing.c')
-rw-r--r-- | src/select/properties/border_spacing.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c index 0077aac..1f70aff 100644 --- a/src/select/properties/border_spacing.c +++ b/src/select/properties/border_spacing.c @@ -23,7 +23,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style, uint32_t hunit = UNIT_PX; uint32_t vunit = UNIT_PX; - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { value = CSS_BORDER_SPACING_SET; hlength = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(hlength)); @@ -40,7 +40,7 @@ css_error css__cascade_border_spacing(uint32_t opv, css_style *style, vunit = css__to_css_unit(vunit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_border_spacing(state->computed, value, hlength, hunit, vlength, vunit); } @@ -62,6 +62,22 @@ css_error css__initial_border_spacing(css_select_state *state) 0, CSS_UNIT_PX, 0, CSS_UNIT_PX); } +css_error css__copy_border_spacing( + const css_computed_style *from, + css_computed_style *to) +{ + css_fixed hlength = 0, vlength = 0; + css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX; + uint8_t type = get_border_spacing(from, &hlength, &hunit, + &vlength, &vunit); + + if (from == to) { + return CSS_OK; + } + + return set_border_spacing(to, type, hlength, hunit, vlength, vunit); +} + css_error css__compose_border_spacing(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) @@ -71,10 +87,7 @@ css_error css__compose_border_spacing(const css_computed_style *parent, uint8_t type = get_border_spacing(child, &hlength, &hunit, &vlength, &vunit); - if (type == CSS_BORDER_SPACING_INHERIT) { - type = get_border_spacing(parent, - &hlength, &hunit, &vlength, &vunit); - } - - return set_border_spacing(result, type, hlength, hunit, vlength, vunit); + return css__copy_border_spacing( + type == CSS_BORDER_SPACING_INHERIT ? parent : child, + result); } |