mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 21:54:40 +03:00
LibWeb: Add PercentageOr<Length>::to_px() fast path for absolute lengths
We can avoid round-tripping through a temporary Length in the simple case here.
This commit is contained in:
parent
1e14264d13
commit
d8e8293b7e
Notes:
sideshowbarker
2024-07-17 11:30:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d8e8293b7e Pull-request: https://github.com/SerenityOS/serenity/pull/23423
@ -97,6 +97,12 @@ public:
|
||||
|
||||
CSSPixels to_px(Layout::Node const& layout_node, CSSPixels reference_value) const
|
||||
{
|
||||
if constexpr (IsSame<T, Length>) {
|
||||
if (auto const* length = m_value.template get_pointer<Length>()) {
|
||||
if (length->is_absolute())
|
||||
return length->absolute_length_to_px();
|
||||
}
|
||||
}
|
||||
return resolved(layout_node, reference_value).to_px(layout_node);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user