1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibWeb: Allow calc() values in image sizes attribute

Note that we currently can't resolve calc() values without a layout
node, so when normalizing an image's source set, we'll flush any pending
layout updates and hope that gives us an up-to-date layout node.

I've left a FIXME about implementing this in a more elegant and less
layout-thrashy way, as that will require more architectural work.
This commit is contained in:
Andreas Kling 2023-07-28 15:52:06 +02:00
parent 9997f46593
commit 95097e47a7
7 changed files with 77 additions and 28 deletions

View file

@ -91,7 +91,7 @@ public:
static ErrorOr<RefPtr<StyleValue>> parse_css_value(Badge<StyleComputer>, ParsingContext const&, PropertyID, Vector<ComponentValue> const&);
static ErrorOr<RefPtr<CalculatedStyleValue>> parse_calculated_value(Badge<StyleComputer>, ParsingContext const&, Vector<ComponentValue> const&);
CSS::Length parse_as_sizes_attribute();
[[nodiscard]] LengthOrCalculated parse_as_sizes_attribute();
private:
Parser(ParsingContext const&, Vector<Token>);
@ -256,6 +256,7 @@ private:
Optional<Color> parse_rgb_or_hsl_color(StringView function_name, Vector<ComponentValue> const&);
Optional<Color> parse_color(ComponentValue const&);
Optional<Length> parse_length(ComponentValue const&);
[[nodiscard]] Optional<LengthOrCalculated> parse_source_size_value(ComponentValue const&);
Optional<Ratio> parse_ratio(TokenStream<ComponentValue>&);
Optional<UnicodeRange> parse_unicode_range(TokenStream<ComponentValue>&);
Optional<UnicodeRange> parse_unicode_range(StringView);