diff options
author | martinfalisse <martinmotteditfalisse@gmail.com> | 2022-09-07 15:09:32 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-09-14 00:09:14 +0200 |
commit | 9681eb89a6625256453a010304da4836952fddbf (patch) | |
tree | 0e29065b30ee6b67091f51535f988164d88569cf /Userland/Libraries | |
parent | ad221164d5e97e4b0c3f1b0d3041966ff49d6a8a (diff) | |
download | serenity-9681eb89a6625256453a010304da4836952fddbf.zip |
LibWeb: Add helper function for creating auto GridTrackSizes
Makes it more convenient to create auto GridTrackSizes. I think having
an auto GridTrackSize be defined by an auto Length value kind of
confusing, and this at least helps when creating one.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/GridTrackSize.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp index 480608e7b2..703101ea07 100644 --- a/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp +++ b/Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp @@ -30,6 +30,11 @@ GridTrackSize::GridTrackSize(float flexible_length) { } +GridTrackSize GridTrackSize::make_auto() +{ + return GridTrackSize(CSS::Length::make_auto()); +} + String GridTrackSize::to_string() const { switch (m_type) { diff --git a/Userland/Libraries/LibWeb/CSS/GridTrackSize.h b/Userland/Libraries/LibWeb/CSS/GridTrackSize.h index 8ce07fc755..46aa047791 100644 --- a/Userland/Libraries/LibWeb/CSS/GridTrackSize.h +++ b/Userland/Libraries/LibWeb/CSS/GridTrackSize.h @@ -26,6 +26,8 @@ public: GridTrackSize(Percentage); GridTrackSize(float); + static GridTrackSize make_auto(); + Type type() const { return m_type; } bool is_length() const { return m_type == Type::Length; } |