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

@ -264,7 +264,7 @@ private:
Optional<Gfx::UnicodeRange> parse_unicode_range(StringView);
Vector<Gfx::UnicodeRange> parse_unicode_ranges(TokenStream<ComponentValue>&);
Optional<GridSize> parse_grid_size(ComponentValue const&);
Optional<GridFitContent> parse_fit_content(Vector<ComponentValue> const&);
Optional<GridFitContent> parse_grid_fit_content(Vector<ComponentValue> const&);
Optional<GridMinMax> parse_min_max(Vector<ComponentValue> const&);
Optional<GridRepeat> parse_repeat(Vector<ComponentValue> const&);
Optional<ExplicitGridTrack> parse_track_sizing_function(ComponentValue const&);
@ -275,6 +275,8 @@ private:
Optional<ShapeRadius> parse_shape_radius(TokenStream<ComponentValue>&);
RefPtr<CSSStyleValue> parse_basic_shape_value(TokenStream<ComponentValue>&);
RefPtr<FitContentStyleValue> parse_fit_content_value(TokenStream<ComponentValue>&);
template<typename TElement>
Optional<Vector<TElement>> parse_color_stop_list(TokenStream<ComponentValue>& tokens, auto parse_position);
Optional<Vector<LinearColorStopListElement>> parse_linear_color_stop_list(TokenStream<ComponentValue>&);