1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:17:34 +00:00

LibWeb: Add fast-path for absolute lengths in Length::to_px()

Absolute lengths can be resolved immediately without looking up the
viewport size, etc.
This commit is contained in:
Andreas Kling 2022-03-24 18:02:41 +01:00
parent 30b1772eeb
commit 88aca4c996

View file

@ -97,6 +97,9 @@ 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 (is_absolute())
return absolute_length_to_px();
if (!layout_node.document().browsing_context())
return 0;
auto viewport_rect = layout_node.document().browsing_context()->viewport_rect();