diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-08-18 21:19:54 +0100 |
---|---|---|
committer | Michael Drake <mdrake.unique@gmail.com> | 2022-08-29 13:49:20 +0100 |
commit | 9a4646ccb841105404f153cfc5f76cfe3d61b35f (patch) | |
tree | d911d9d26b080abfd3ea253c23b398ca96f81cc9 /src/select/properties/outline_color.c | |
parent | 010b9a79ece709d364dbf3930b72d2a7e0bac045 (diff) | |
download | libcss-9a4646ccb841105404f153cfc5f76cfe3d61b35f.tar.gz libcss-9a4646ccb841105404f153cfc5f76cfe3d61b35f.tar.bz2 |
Select: Properties: Add copy handler for simple properties
Diffstat (limited to 'src/select/properties/outline_color.c')
-rw-r--r-- | src/select/properties/outline_color.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/select/properties/outline_color.c b/src/select/properties/outline_color.c index 707dd7b..359960f 100644 --- a/src/select/properties/outline_color.c +++ b/src/select/properties/outline_color.c @@ -58,6 +58,20 @@ css_error css__initial_outline_color(css_select_state *state) return set_outline_color(state->computed, CSS_OUTLINE_COLOR_INVERT, 0); } +css_error css__copy_outline_color( + const css_computed_style *from, + css_computed_style *to) +{ + css_color color = 0; + uint8_t type = get_outline_color(from, &color); + + if (from == to) { + return CSS_OK; + } + + return set_outline_color(to, type, color); +} + css_error css__compose_outline_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) @@ -65,9 +79,7 @@ css_error css__compose_outline_color(const css_computed_style *parent, css_color color = 0; uint8_t type = get_outline_color(child, &color); - if (type == CSS_OUTLINE_COLOR_INHERIT) { - type = get_outline_color(parent, &color); - } - - return set_outline_color(result, type, color); + return css__copy_outline_color( + type == CSS_OUTLINE_COLOR_INHERIT ? parent : child, + result); } |