summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-07-20 13:58:12 +0000
committerJames Bursa <james@netsurf-browser.org>2003-07-20 13:58:12 +0000
commite13bb8daa87c01c0f5a478a96b7fa822955770cd (patch)
treea378950ce42e588f8a2172f44c92b18021f5c1f1
parentc17ede41d153ed94aff7842c87bf967e1adcdd03 (diff)
downloadnetsurf-e13bb8daa87c01c0f5a478a96b7fa822955770cd.tar.gz
netsurf-e13bb8daa87c01c0f5a478a96b7fa822955770cd.tar.bz2
[project @ 2003-07-20 13:58:12 by bursa]
Line-height fixes. svn path=/import/netsurf/; revision=240
-rw-r--r--css/ruleset.c4
-rw-r--r--render/layout.c7
2 files changed, 7 insertions, 4 deletions
diff --git a/css/ruleset.c b/css/ruleset.c
index d8eae5ce5..714e541c3 100644
--- a/css/ruleset.c
+++ b/css/ruleset.c
@@ -407,9 +407,9 @@ void parse_line_height(struct css_style * const s, const struct node * const v)
} else if (v->type == NODE_DIMENSION &&
parse_length(&s->line_height.value.length, v) == 0) {
s->line_height.size = CSS_LINE_HEIGHT_LENGTH;
- } else if (v->type == NODE_NUMBER && atof(v->data) == 0.0) {
+ } else if (v->type == NODE_NUMBER) {
s->line_height.size = CSS_LINE_HEIGHT_ABSOLUTE;
- s->line_height.value.absolute = 0.0;
+ s->line_height.value.absolute = atof(v->data);
}
}
diff --git a/render/layout.c b/render/layout.c
index 6ebc589f2..5153b8261 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -304,12 +304,15 @@ signed long line_height(struct css_style * style)
{
assert(style != 0);
assert(style->line_height.size == CSS_LINE_HEIGHT_LENGTH ||
- style->line_height.size == CSS_LINE_HEIGHT_ABSOLUTE);
+ style->line_height.size == CSS_LINE_HEIGHT_ABSOLUTE ||
+ style->line_height.size == CSS_LINE_HEIGHT_PERCENT);
if (style->line_height.size == CSS_LINE_HEIGHT_LENGTH)
return len(&style->line_height.value.length, style);
- else
+ else if (style->line_height.size == CSS_LINE_HEIGHT_ABSOLUTE)
return style->line_height.value.absolute * len(&style->font_size.value.length, 0);
+ else
+ return style->line_height.value.percent * len(&style->font_size.value.length, 0) / 100.0;
}