Skip to content

Commit 1f99f95

Browse files
committed
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.
1 parent ed1a7ae commit 1f99f95

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Userland/Libraries/LibWeb/CSS/StyleProperties.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ CSSPixels StyleProperties::line_height(CSSPixelRect const& viewport_rect, Gfx::F
161161
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);
162162
}
163163

164-
if (line_height->is_calculated())
165-
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);
164+
if (line_height->is_calculated()) {
165+
// FIXME: Handle `line-height: calc(...)` despite not having a LayoutNode here.
166+
return font_metrics.line_spacing();
167+
}
166168

167169
return font_metrics.line_spacing();
168170
}

0 commit comments

Comments
 (0)