LibWeb: Parse CSS fit-content(<length-percentage>) values

Before this change, we only parsed fit-content as a standalone keyword,
but CSS-SIZING-3 added it as a function as well. I don't know of
anything else in CSS that is overloaded like this, so it ends up looking
a little awkward in the implementation.

Note that a lot of code had already been prepped for fit-content values
to have an argument, we just weren't parsing it.
This commit is contained in:
Andreas Kling 2025-02-26 18:16:36 +01:00 committed by Andreas Kling
commit 8ab61843be
Notes: github-actions[bot] 2025-02-26 23:45:14 +00:00
25 changed files with 185 additions and 67 deletions

View file

@ -32,7 +32,7 @@ public:
static Size make_calculated(NonnullRefPtr<CalculatedStyleValue>);
static Size make_min_content();
static Size make_max_content();
static Size make_fit_content(Length available_space);
static Size make_fit_content(LengthPercentage available_space);
static Size make_fit_content();
static Size make_none();
@ -67,10 +67,10 @@ public:
return m_length_percentage.percentage();
}
CSS::Length const& fit_content_available_space() const
CSS::LengthPercentage const& fit_content_available_space() const
{
VERIFY(is_fit_content());
return m_length_percentage.length();
return m_length_percentage;
}
String to_string() const;