summaryrefslogtreecommitdiff
path: root/src/select/properties/display.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-08-18 21:19:54 +0100
committerMichael Drake <mdrake.unique@gmail.com>2022-08-29 13:49:20 +0100
commit9a4646ccb841105404f153cfc5f76cfe3d61b35f (patch)
treed911d9d26b080abfd3ea253c23b398ca96f81cc9 /src/select/properties/display.c
parent010b9a79ece709d364dbf3930b72d2a7e0bac045 (diff)
downloadlibcss-9a4646ccb841105404f153cfc5f76cfe3d61b35f.tar.gz
libcss-9a4646ccb841105404f153cfc5f76cfe3d61b35f.tar.bz2
Select: Properties: Add copy handler for simple properties
Diffstat (limited to 'src/select/properties/display.c')
-rw-r--r--src/select/properties/display.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/select/properties/display.c b/src/select/properties/display.c
index 3e15d5f..bfe0a5f 100644
--- a/src/select/properties/display.c
+++ b/src/select/properties/display.c
@@ -99,16 +99,25 @@ css_error css__initial_display(css_select_state *state)
return set_display(state->computed, CSS_DISPLAY_INLINE);
}
+css_error css__copy_display(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_display(to, get_display(from));
+}
+
css_error css__compose_display(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_display(child);
- if (type == CSS_DISPLAY_INHERIT) {
- type = get_display(parent);
- }
-
- return set_display(result, type);
+ return css__copy_display(
+ type == CSS_DISPLAY_INHERIT ? parent : child,
+ result);
}