summaryrefslogtreecommitdiff
path: root/src/select/properties/font_size.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/font_size.c')
-rw-r--r--src/select/properties/font_size.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/select/properties/font_size.c b/src/select/properties/font_size.c
index a0269be..3ee9ce0 100644
--- a/src/select/properties/font_size.c
+++ b/src/select/properties/font_size.c
@@ -21,7 +21,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
css_fixed size = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case FONT_SIZE_DIMENSION:
value = CSS_FONT_SIZE_DIMENSION;
@@ -65,7 +65,7 @@ css_error css__cascade_font_size(uint32_t opv, css_style *style,
unit = css__to_css_unit(unit);
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
- isInherit(opv))) {
+ getFlagValue(opv))) {
return set_font_size(state->computed, value, size, unit);
}
@@ -85,6 +85,21 @@ css_error css__initial_font_size(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_font_size(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed size = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_font_size(from, &size, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_font_size(to, type, size, unit);
+}
+
css_error css__compose_font_size(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -93,10 +108,8 @@ css_error css__compose_font_size(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_font_size(child, &size, &unit);
- if (type == CSS_FONT_SIZE_INHERIT) {
- type = get_font_size(parent, &size, &unit);
- }
-
- return set_font_size(result, type, size, unit);
+ return css__copy_font_size(
+ type == CSS_FONT_SIZE_INHERIT ? parent : child,
+ result);
}