1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +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

@ -23,6 +23,13 @@ Length LengthOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue
return calculated->resolve_length(layout_node).value();
}
Length LengthOrCalculated::resolved(Length::ResolutionContext const& context) const
{
if (is_calculated())
return calculated()->resolve_length(context).value();
return value();
}
Percentage PercentageOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&) const
{
return calculated->resolve_percentage().value();