aboutsummaryrefslogtreecommitdiffstats
path: root/src/css_properties.cpp
diff options
context:
space:
mode:
authorstasoid <stasoid@yahoo.com>2022-12-09 21:58:44 +0600
committerstasoid <stasoid@yahoo.com>2022-12-09 21:58:44 +0600
commitc46240eb7c22a3e018c041f9717d83c640b07be3 (patch)
tree192aab65ae93acb5d98c798c926a44ff9aa462cc /src/css_properties.cpp
parentae9fe10f4839f3cc298d59eeb4d36b8276aa4536 (diff)
distinguish between computed and used line-height (fixes #232)
Diffstat (limited to 'src/css_properties.cpp')
-rw-r--r--src/css_properties.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/css_properties.cpp b/src/css_properties.cpp
index 9b1213c2..a2db77f0 100644
--- a/src/css_properties.cpp
+++ b/src/css_properties.cpp
@@ -215,19 +215,17 @@ void litehtml::css_properties::compute(const element* el, const document::ptr& d
m_css_text_indent = el->get_length_property(_text_indent_, true, 0, offset(m_css_text_indent));
doc->cvt_units(m_css_text_indent, font_size);
- m_line_height = el->get_length_property(_line_height_, true, normal, offset(m_line_height));
- if(m_line_height.is_predefined())
+ m_computed_line_height = el->get_length_property(_line_height_, true, normal, offset(m_computed_line_height));
+ if(m_computed_line_height.is_predefined())
{
- m_line_height = (float) m_font_metrics.height;
- m_lh_predefined = true;
- } else if(m_line_height.units() == css_units_none)
+ m_line_height = m_font_metrics.height;
+ } else if(m_computed_line_height.units() == css_units_none)
{
- m_line_height = (float)(int) (m_line_height.val() * font_size);
- m_lh_predefined = false;
+ m_line_height = (int) (m_computed_line_height.val() * font_size);
} else
{
- m_line_height = (float) doc->to_pixels(m_line_height, font_size, font_size);
- m_lh_predefined = false;
+ m_line_height = doc->to_pixels(m_computed_line_height, font_size, font_size);
+ m_computed_line_height = (float) m_line_height;
}
m_list_style_type = (list_style_type) el->get_enum_property(_list_style_type_, true, list_style_type_disc, offset(m_list_style_type));
@@ -430,7 +428,7 @@ std::vector<std::tuple<litehtml::string, litehtml::string>> litehtml::css_proper
ret.emplace_back(std::make_tuple("max_height", m_css_max_width.to_string()));
ret.emplace_back(std::make_tuple("offsets", m_css_offsets.to_string()));
ret.emplace_back(std::make_tuple("text_indent", m_css_text_indent.to_string()));
- ret.emplace_back(std::make_tuple("line_height", m_line_height.to_string()));
+ ret.emplace_back(std::make_tuple("line_height", std::to_string(m_line_height)));
ret.emplace_back(std::make_tuple("list_style_type", index_value(m_list_style_type, list_style_type_strings)));
ret.emplace_back(std::make_tuple("list_style_position", index_value(m_list_style_position, list_style_position_strings)));
ret.emplace_back(std::make_tuple("border_spacing_x", m_css_border_spacing_x.to_string()));