diff options
Diffstat (limited to 'src/select/properties/font_style.c')
-rw-r--r-- | src/select/properties/font_style.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/select/properties/font_style.c b/src/select/properties/font_style.c index 0ba1fdd..fe605b8 100644 --- a/src/select/properties/font_style.c +++ b/src/select/properties/font_style.c @@ -21,7 +21,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style, UNUSED(style); - if (isInherit(opv) == false) { + if (hasFlagValue(opv) == false) { switch (getValue(opv)) { case FONT_STYLE_NORMAL: value = CSS_FONT_STYLE_NORMAL; @@ -36,7 +36,7 @@ css_error css__cascade_font_style(uint32_t opv, css_style *style, } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { + getFlagValue(opv))) { return set_font_style(state->computed, value); } @@ -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); } |