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

LibWeb: Parse min and max-content

Parse min and max-content as well as use its values in the GridTrackSize
class.
This commit is contained in:
martinfalisse 2023-01-16 17:33:30 +01:00 committed by Andreas Kling
parent 9d99bd8258
commit 0448547553
3 changed files with 23 additions and 4 deletions

View file

@ -33,6 +33,13 @@ GridSize::GridSize(float flexible_length)
{
}
GridSize::GridSize(Type type)
: m_length { Length::make_auto() }
{
VERIFY(type == Type::MinContent || type == Type::MaxContent);
m_type = type;
}
GridSize::GridSize()
: m_length { Length::make_auto() }
{
@ -54,6 +61,10 @@ ErrorOr<String> GridSize::to_string() const
return m_percentage.to_string();
case Type::FlexibleLength:
return String::formatted("{}fr", m_flexible_length);
case Type::MaxContent:
return String::from_utf8("max-content"sv);
case Type::MinContent:
return String::from_utf8("min-content"sv);
}
VERIFY_NOT_REACHED();
}