LibWeb/CSS: Remove the "Auto" type from Length

This has always been a bit of a hack. Initially it made sense as a lot
of properties that accept a length also accept `auto`, but while
convenient, that leads to problems: It's easy to forget to check if a
length is `auto`, and places that don't accept it end up with an
invalid state lurking in the type system, which makes things unclear.
This commit is contained in:
Sam Atkins 2025-09-01 14:03:25 +01:00
commit 930ee495e7
Notes: github-actions[bot] 2025-09-04 12:32:29 +00:00
10 changed files with 8 additions and 66 deletions

View file

@ -321,8 +321,6 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_property(PropertyID property_i
static NonnullRefPtr<StyleValue const> style_value_for_length_percentage(LengthPercentage const& length_percentage)
{
if (length_percentage.is_auto())
return KeywordStyleValue::create(Keyword::Auto);
if (length_percentage.is_percentage())
return PercentageStyleValue::create(length_percentage.percentage());
if (length_percentage.is_length())