diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-24 18:02:41 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-24 18:14:01 +0100 |
commit | 88aca4c99634d3a2948ed5130961ee7b8f942d43 (patch) | |
tree | 6dbc428448187c3570061b0eca8fc3e2dfc93f5c /Userland | |
parent | 30b1772eeb50e1875e5ba62fe3e5df86f50b4e6a (diff) | |
download | serenity-88aca4c99634d3a2948ed5130961ee7b8f942d43.zip |
LibWeb: Add fast-path for absolute lengths in Length::to_px()
Absolute lengths can be resolved immediately without looking up the
viewport size, etc.
Diffstat (limited to 'Userland')
-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 b149bb1c2a..349fed3d2a 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -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(); |