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

LibWeb: Let CSS::Size contain a CalculatedStyleValue

Technically this was already true, but now we explicitly allow it
instead of that calc value being hidden inside a Length or Percentage.
This commit is contained in:
Sam Atkins 2023-03-30 10:50:40 +01:00 committed by Andreas Kling
parent ac4350748e
commit 62a8cf2bb8
4 changed files with 19 additions and 1 deletions

View file

@ -41,6 +41,11 @@ Size Size::make_percentage(Percentage percentage)
return Size { Type::Percentage, move(percentage) };
}
Size Size::make_calculated(NonnullRefPtr<Web::CSS::CalculatedStyleValue> calculated)
{
return Size { Type::Calculated, move(calculated) };
}
Size Size::make_min_content()
{
return Size { Type::MinContent, Length::make_auto() };
@ -79,6 +84,7 @@ ErrorOr<String> Size::to_string() const
switch (m_type) {
case Type::Auto:
return "auto"_string;
case Type::Calculated:
case Type::Length:
case Type::Percentage:
return m_length_percentage.to_string();