diff options
Diffstat (limited to 'src/select/properties/border_spacing.c')
-rw-r--r-- | src/select/properties/border_spacing.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/select/properties/border_spacing.c b/src/select/properties/border_spacing.c index 8eb01cb..1f70aff 100644 --- a/src/select/properties/border_spacing.c +++ b/src/select/properties/border_spacing.c @@ -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); } |