summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
diff options
context:
space:
mode:
authormartinfalisse <martinmotteditfalisse@gmail.com>2023-01-16 17:33:30 +0100
committerAndreas Kling <kling@serenityos.org>2023-01-21 14:35:00 +0100
commit0448547553815c5f4243befb5ee91c08508e720c (patch)
tree14785469cbabef9aa62f093bf76d3d1fb42ee27a /Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
parent9d99bd8258f2d27de67a8f0339e8fccb28e8b82b (diff)
downloadserenity-0448547553815c5f4243befb5ee91c08508e720c.zip
LibWeb: Parse min and max-content
Parse min and max-content as well as use its values in the GridTrackSize class.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
index 5df3bbb188..d498d2df15 100644
--- a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
+++ b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp
@@ -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();
}