mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibWeb: Calculate font-size in NodeWidthStyle::apply_style()
Previously, this made the same "everything is px" assumption as in `StyleProperties::load_font()`, so I've replaced it with the calculation from there.
This commit is contained in:
parent
8c39fee34d
commit
3c541452b7
Notes:
sideshowbarker
2024-07-18 05:33:24 +09:00
Author: https://github.com/AtkinsSJ
Commit: 3c541452b7
Pull-request: https://github.com/SerenityOS/serenity/pull/9421
Reviewed-by: https://github.com/TobyAsE
1 changed files with 7 additions and 3 deletions
|
@ -223,9 +223,13 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style)
|
||||||
m_line_height = specified_style.line_height(*this);
|
m_line_height = specified_style.line_height(*this);
|
||||||
|
|
||||||
{
|
{
|
||||||
// FIXME: This doesn't work right for relative font-sizes
|
constexpr int default_font_size = 10;
|
||||||
auto length = specified_style.length_or_fallback(CSS::PropertyID::FontSize, CSS::Length(10, CSS::Length::Type::Px));
|
auto parent_font_size = parent() == nullptr ? default_font_size : parent()->font_size();
|
||||||
m_font_size = length.raw_value();
|
auto length = specified_style.length_or_fallback(CSS::PropertyID::FontSize, CSS::Length(default_font_size, CSS::Length::Type::Px));
|
||||||
|
// FIXME: em sizes return 0 here, for some reason
|
||||||
|
m_font_size = length.resolved_or_zero(*this, parent_font_size).to_px(*this);
|
||||||
|
if (m_font_size == 0)
|
||||||
|
m_font_size = default_font_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bgimage = specified_style.property(CSS::PropertyID::BackgroundImage);
|
auto bgimage = specified_style.property(CSS::PropertyID::BackgroundImage);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue