diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-02-18 16:20:16 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-18 19:04:37 +0100 |
commit | 6df3f9920dfd356de39cacec467ebbf348de23e1 (patch) | |
tree | efd4ed4b166c34c198307017de32c9735ea8a382 /Userland/Libraries/LibWeb/CSS/Length.cpp | |
parent | 67066c5140b1a2f026f099cec3fe90525cdf41ec (diff) | |
download | serenity-6df3f9920dfd356de39cacec467ebbf348de23e1.zip |
LibWeb: Calculate calc() lengths in to_px()
to_px() has the layout node available, so let's use it.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Length.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Length.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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(); |