1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:18:12 +00:00

LibWeb: Add Length::resolved() overload for CSSPixels

Since we always pass the px value as an argument to resolved(), we can
pass it directly as CSSPixels instead of wrapping it in Length. This
approach allows us to avoid converting to a double, resulting in fewer
precision issues.
This commit is contained in:
Aliaksandr Kalenik 2023-08-29 18:57:09 +02:00 committed by Alexander Kalenik
parent 5eb0f65cc0
commit 0fb571c1c2
14 changed files with 154 additions and 75 deletions

View file

@ -24,6 +24,11 @@ CSS::Length Size::resolved(Layout::Node const& node, Length const& reference_val
return m_length_percentage.resolved(node, reference_value);
}
CSS::Length Size::resolved(Layout::Node const& node, CSSPixels reference_value) const
{
return m_length_percentage.resolved(node, reference_value);
}
Size Size::make_auto()
{
return Size { Type::Auto, Length::make_auto() };