1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

LibWeb: Don't crash on unresolvable line-height: calc() value

Instead, log the calc() value we failed to resolve, so we can debug it.
This commit is contained in:
Andreas Kling 2023-05-03 13:59:05 +02:00
parent 968db96101
commit da768e7c46

View file

@ -206,8 +206,14 @@ CSSPixels StyleProperties::line_height(Layout::Node const& layout_node) const
return Length(percentage.as_fraction(), Length::Type::Em).to_px(layout_node);
}
if (line_height->is_calculated())
return line_height->as_calculated().resolve_length(layout_node)->to_px(layout_node);
if (line_height->is_calculated()) {
auto resolved = line_height->as_calculated().resolve_length(layout_node);
if (!resolved.has_value()) {
dbgln("FIXME: Failed to resolve calc() line-height: {}", line_height->as_calculated().to_string().release_value_but_fixme_should_propagate_errors());
return layout_node.font().pixel_metrics().line_spacing();
}
return resolved->to_px(layout_node);
}
return layout_node.font().pixel_metrics().line_spacing();
}