1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb: Calculate calc() lengths in to_px()

to_px() has the layout node available, so let's use it.
This commit is contained in:
Sam Atkins 2022-02-18 16:20:16 +00:00 committed by Andreas Kling
parent 67066c5140
commit 6df3f9920d
2 changed files with 5 additions and 0 deletions

View file

@ -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();