1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:37:45 +00:00

LibWeb: Implement Flex and FlexStyleValue types

This commit is contained in:
Sam Atkins 2023-09-28 15:18:14 +01:00 committed by Sam Atkins
parent f1d7ea67c0
commit b0317bb3a1
15 changed files with 258 additions and 6 deletions

View file

@ -8,6 +8,7 @@
#include <AK/Variant.h>
#include <LibWeb/CSS/Angle.h>
#include <LibWeb/CSS/Flex.h>
#include <LibWeb/CSS/Frequency.h>
#include <LibWeb/CSS/Length.h>
#include <LibWeb/CSS/Percentage.h>
@ -24,6 +25,11 @@ public:
{
}
Dimension(Flex&& value)
: m_value(move(value))
{
}
Dimension(Frequency&& value)
: m_value(move(value))
{
@ -59,6 +65,9 @@ public:
return percentage();
}
bool is_flex() const { return m_value.has<Flex>(); }
Flex flex() const { return m_value.get<Flex>(); }
bool is_frequency() const { return m_value.has<Frequency>(); }
Frequency frequency() const { return m_value.get<Frequency>(); }
@ -99,7 +108,7 @@ public:
}
private:
Variant<Angle, Frequency, Length, Percentage, Resolution, Time> m_value;
Variant<Angle, Flex, Frequency, Length, Percentage, Resolution, Time> m_value;
};
}