From 9681eb89a6625256453a010304da4836952fddbf Mon Sep 17 00:00:00 2001 From: martinfalisse Date: Wed, 7 Sep 2022 15:09:32 +0200 Subject: [PATCH] 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. --- Userland/Libraries/LibWeb/CSS/GridTrackSize.cpp | 5 +++++ Userland/Libraries/LibWeb/CSS/GridTrackSize.h | 2 ++ 2 files changed, 7 insertions(+) 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; }