LibWeb/CSS: Use Optional instead of auto lengths in Size

Any type of Size which has no LengthPercentage value now uses an empty
optional instead of making an auto Length as before.

We also now serialize a `fit-content` Size as `fit-content` instead of
`fit-content(auto)`, though this doesn't affect test results and I
didn't identify where it's actually used.
This commit is contained in:
Sam Atkins 2025-08-28 12:29:58 +01:00
commit 60fc23e916
Notes: github-actions[bot] 2025-09-04 12:33:22 +00:00
3 changed files with 28 additions and 22 deletions

View file

@ -55,22 +55,22 @@ public:
CalculatedStyleValue const& calculated() const
{
VERIFY(is_calculated());
return m_length_percentage.calculated();
return m_length_percentage->calculated();
}
CSS::Length const& length() const
Length const& length() const
{
VERIFY(is_length());
return m_length_percentage.length();
return m_length_percentage->length();
}
CSS::Percentage const& percentage() const
Percentage const& percentage() const
{
VERIFY(is_percentage());
return m_length_percentage.percentage();
return m_length_percentage->percentage();
}
CSS::LengthPercentage const& fit_content_available_space() const
Optional<LengthPercentage> const& fit_content_available_space() const
{
VERIFY(is_fit_content());
return m_length_percentage;
@ -80,10 +80,10 @@ public:
bool operator==(Size const&) const = default;
private:
Size(Type type, LengthPercentage);
explicit Size(Type type, Optional<LengthPercentage> = {});
Type m_type {};
CSS::LengthPercentage m_length_percentage;
Optional<LengthPercentage> m_length_percentage;
};
}