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

@ -346,8 +346,11 @@ static NonnullRefPtr<StyleValue const> style_value_for_size(Size const& size)
return KeywordStyleValue::create(Keyword::MinContent);
if (size.is_max_content())
return KeywordStyleValue::create(Keyword::MaxContent);
if (size.is_fit_content())
return FitContentStyleValue::create(size.fit_content_available_space());
if (size.is_fit_content()) {
if (auto available_space = size.fit_content_available_space(); available_space.has_value())
return FitContentStyleValue::create(available_space.release_value());
return FitContentStyleValue::create();
}
TODO();
}