LibWeb: Remove auto length from SourceSet

The spec is a bit awkward here: A few algorithms create an "empty"
SourceSet, and then assign its source-size value a few steps later, so
we have a temporary state with no length. In order to avoid complicating
the types with Optional, I've chosen to just assign it to 0px.
Previously we used `auto`, but `auto` is not a valid value here - it is
used inside the "parse a sizes attribute" algorithm, but that always
returns an actual length (or calc).
This commit is contained in:
Sam Atkins 2025-08-27 17:25:40 +01:00
commit 240536acaa
Notes: github-actions[bot] 2025-09-04 12:33:41 +00:00
3 changed files with 18 additions and 15 deletions

View file

@ -17,7 +17,9 @@
namespace Web::HTML {
SourceSet::SourceSet()
: m_source_size(CSS::Length::make_auto())
// Note: m_source_size always gets reassigned to its proper value during one of the construction algorithms.
// 0px is just a fake value here so that we don't have to muddy the type system by using Optional.
: m_source_size(CSS::Length::make_px(0))
{
}