mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +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:
parent
30b1772eeb
commit
88aca4c996
1 changed files with 3 additions and 0 deletions
|
@ -97,6 +97,9 @@ float Length::to_px(Layout::Node const& layout_node) const
|
||||||
if (is_calculated())
|
if (is_calculated())
|
||||||
return m_calculated_style->resolve_length(layout_node)->to_px(layout_node);
|
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())
|
if (!layout_node.document().browsing_context())
|
||||||
return 0;
|
return 0;
|
||||||
auto viewport_rect = layout_node.document().browsing_context()->viewport_rect();
|
auto viewport_rect = layout_node.document().browsing_context()->viewport_rect();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue