summaryrefslogtreecommitdiff
path: root/src/select/properties/line_height.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/properties/line_height.c')
-rw-r--r--src/select/properties/line_height.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/select/properties/line_height.c b/src/select/properties/line_height.c
index 091a575..7300b5d 100644
--- a/src/select/properties/line_height.c
+++ b/src/select/properties/line_height.c
@@ -21,7 +21,7 @@ css_error css__cascade_line_height(uint32_t opv, css_style *style,
css_fixed val = 0;
uint32_t unit = UNIT_PX;
- if (isInherit(opv) == false) {
+ if (hasFlagValue(opv) == false) {
switch (getValue(opv)) {
case LINE_HEIGHT_NUMBER:
value = CSS_LINE_HEIGHT_NUMBER;
@@ -44,7 +44,7 @@ css_error css__cascade_line_height(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_line_height(state->computed, value, val, unit);
}
@@ -64,6 +64,21 @@ css_error css__initial_line_height(css_select_state *state)
0, CSS_UNIT_PX);
}
+css_error css__copy_line_height(
+ const css_computed_style *from,
+ css_computed_style *to)
+{
+ css_fixed length = 0;
+ css_unit unit = CSS_UNIT_PX;
+ uint8_t type = get_line_height(from, &length, &unit);
+
+ if (from == to) {
+ return CSS_OK;
+ }
+
+ return set_line_height(to, type, length, unit);
+}
+
css_error css__compose_line_height(const css_computed_style *parent,
const css_computed_style *child,
css_computed_style *result)
@@ -72,10 +87,8 @@ css_error css__compose_line_height(const css_computed_style *parent,
css_unit unit = CSS_UNIT_PX;
uint8_t type = get_line_height(child, &length, &unit);
- if (type == CSS_LINE_HEIGHT_INHERIT) {
- type = get_line_height(parent, &length, &unit);
- }
-
- return set_line_height(result, type, length, unit);
+ return css__copy_line_height(
+ type == CSS_LINE_HEIGHT_INHERIT ? parent : child,
+ result);
}