diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index 09503162c0..8c1694f1cc 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -93,6 +93,9 @@ float Length::relative_length_to_px(Gfx::IntRect const& viewport_rect, Gfx::Font float Length::to_px(Layout::Node const& layout_node) const { + if (is_calculated()) + return m_calculated_style->resolve_length(layout_node)->to_px(layout_node); + if (!layout_node.document().browsing_context()) return 0; auto viewport_rect = layout_node.document().browsing_context()->viewport_rect(); diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index cbfd43d34f..60494aca0b 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -86,6 +86,8 @@ public: return 0; if (is_relative()) return relative_length_to_px(viewport_rect, font_metrics, root_font_size); + if (is_calculated()) + VERIFY_NOT_REACHED(); // We can't resolve a calculated length from here. :^( return absolute_length_to_px(); }