1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09: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
Notes: sideshowbarker 2024-07-17 16:49:24 +09:00

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