diff options
author | Andreas Kling <kling@serenityos.org> | 2023-05-03 13:59:05 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-03 13:59:05 +0200 |
commit | da768e7c460934b78a753067391509dfa5f31863 (patch) | |
tree | c087ff20f0d96c5d8b58ee4c8556f877044d27ef /Userland/Libraries/LibWeb/CSS/StyleProperties.cpp | |
parent | 968db96101f1f75dcce4f2c81187ee1428420810 (diff) | |
download | serenity-da768e7c460934b78a753067391509dfa5f31863.zip |
LibWeb: Don't crash on unresolvable line-height: calc() value
Instead, log the calc() value we failed to resolve, so we can debug it.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleProperties.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleProperties.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index 2adde0ada0..b3f616139d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -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(); } |