Simplify line-height calculation, deferring to nscss_len2px.
svn path=/trunk/netsurf/; revision=8783
This commit is contained in:
parent
2939ec04de
commit
2c00c55963
|
@ -1784,25 +1784,10 @@ int line_height(const css_computed_style *style)
|
||||||
|
|
||||||
if (lhtype == CSS_LINE_HEIGHT_NUMBER ||
|
if (lhtype == CSS_LINE_HEIGHT_NUMBER ||
|
||||||
lhunit == CSS_UNIT_PCT) {
|
lhunit == CSS_UNIT_PCT) {
|
||||||
css_fixed fs = 0, px_fs;
|
line_height = nscss_len2px(lhvalue, CSS_UNIT_EM, style);
|
||||||
css_unit fs_unit = CSS_UNIT_PX;
|
|
||||||
|
|
||||||
css_computed_font_size(style, &fs, &fs_unit);
|
if (lhtype != CSS_LINE_HEIGHT_NUMBER)
|
||||||
|
line_height = FDIVI(line_height, 100);
|
||||||
/* Convert to points */
|
|
||||||
fs = nscss_len2pt(fs, fs_unit);
|
|
||||||
fs_unit = CSS_UNIT_PT;
|
|
||||||
|
|
||||||
/* Clamp to configured minimum */
|
|
||||||
if (fs < FDIVI(INTTOFIX(option_font_min_size), 10))
|
|
||||||
fs = FDIVI(INTTOFIX(option_font_min_size), 10);
|
|
||||||
|
|
||||||
px_fs = nscss_len2px(fs, fs_unit, style);
|
|
||||||
|
|
||||||
if (lhtype == CSS_LINE_HEIGHT_NUMBER)
|
|
||||||
line_height = FMUL(lhvalue, px_fs);
|
|
||||||
else
|
|
||||||
line_height = FDIVI(FMUL(lhvalue, px_fs), 100);
|
|
||||||
} else {
|
} else {
|
||||||
assert(lhunit != CSS_UNIT_PCT);
|
assert(lhunit != CSS_UNIT_PCT);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue