summaryrefslogtreecommitdiff
path: root/src/select/properties/font_style.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/font_style.c')
-rw-r--r--src/select/properties/font_style.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/select/properties/font_style.c b/src/select/properties/font_style.c
index 6c240ec..fe605b8 100644
--- a/src/select/properties/font_style.c
+++ b/src/select/properties/font_style.c
@@ -54,16 +54,25 @@ css_error css__initial_font_style(css_select_state *state)
return set_font_style(state->computed, CSS_FONT_STYLE_NORMAL);
}
+css_error css__copy_font_style(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_style(to, get_font_style(from));
+}
+
css_error css__compose_font_style(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
{
uint8_t type = get_font_style(child);
- if (type == CSS_FONT_STYLE_INHERIT) {
- type= get_font_style(parent);
- }
-
- return set_font_style(result, type);
+ return css__copy_font_style(
+ type == CSS_FONT_STYLE_INHERIT ? parent : child,
+ result);
}