summaryrefslogtreecommitdiff
path: root/src/select/properties/orphans.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/orphans.c')
-rw-r--r--src/select/properties/orphans.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/select/properties/orphans.c b/src/select/properties/orphans.c
index f169b81..b0fee43 100644
--- a/src/select/properties/orphans.c
+++ b/src/select/properties/orphans.c
@@ -31,6 +31,20 @@ css_error css__initial_orphans(css_select_state *state)
return set_orphans(state->computed, CSS_ORPHANS_SET, 2);
}
+css_error css__copy_orphans(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ int32_t count = 0;
+ uint8_t type = get_orphans(from, &count);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_orphans(to, type, count);
+}
+
css_error css__compose_orphans(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -38,10 +52,8 @@ css_error css__compose_orphans(const css_computed_style *parent,
int32_t count = 0;
uint8_t type = get_orphans(child, &count);
- if (type == CSS_ORPHANS_INHERIT) {
- type = get_orphans(parent, &count);
- }
-
- return set_orphans(result, type, count);
+ return css__copy_orphans(
+ type == CSS_ORPHANS_INHERIT ? parent : child,
+ result);
}