LibWeb/CSS: Add Length::make_px(double) overload

Saves us a round-trip to CSSPixels and back when we already have a
double value.
This commit is contained in:
Sam Atkins 2025-01-23 16:48:03 +00:00 committed by Jelle Raaijmakers
commit e65ca3a7d2
Notes: github-actions[bot] 2025-01-24 12:56:55 +00:00
2 changed files with 7 additions and 1 deletions

View file

@ -43,9 +43,14 @@ Length Length::make_auto()
return Length(0, Type::Auto);
}
Length Length::make_px(double value)
{
return Length(value, Type::Px);
}
Length Length::make_px(CSSPixels value)
{
return Length(value.to_double(), Type::Px);
return make_px(value.to_double());
}
Length Length::percentage_of(Percentage const& percentage) const