summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-03-18 21:15:51 +0100
committerAndreas Kling <kling@serenityos.org>2023-03-18 21:15:51 +0100
commit1f99f9523dbf483cc9c41d6fc763b4cd641e04da (patch)
tree07f2c685ae3bb9f704b3723a9a1c2f4329657d6f /Userland
parented1a7aee4315ffbc97286124971c43ab582de752 (diff)
downloadserenity-1f99f9523dbf483cc9c41d6fc763b4cd641e04da.zip
LibWeb: Add temporary hack for `line-height: calc(...)`
At the moment, we can't resolve CSS calc() values without having a LayoutNode. The new StyleProperties::line_height() overload was trying to do exactly that, which led to an assertion. This patch makes `line-height: calc(...)` behave the same as `line-height: normal` for now and adds a FIXME.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index ed9b8418b3..0621ee1935 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -161,8 +161,10 @@ CSSPixels StyleProperties::line_height(CSSPixelRect const& viewport_rect, Gfx::F
return Length(percentage.as_fraction(), Length::Type::Em).to_px(viewport_rect, font_metrics, font_size, root_font_size, parent_line_height, root_line_height);
}
- if (line_height->is_calculated())
- return CSS::Length::make_calculated(const_cast<CalculatedStyleValue&>(line_height->as_calculated())).to_px(viewport_rect, font_metrics, font_size, root_font_size, parent_line_height, root_line_height);
+ if (line_height->is_calculated()) {
+ // FIXME: Handle `line-height: calc(...)` despite not having a LayoutNode here.
+ return font_metrics.line_spacing();
+ }
return font_metrics.line_spacing();
}