1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

LibWeb: Ensure PercentageOr<T>::resolved() returns a concrete T

Which is to say, a T where `is_calculated()` is false.

As is becoming a repeating theme with CSS types, we have two states for
a FooPercentage that is a `calc()` expression: Either the FooPercentage
holds the CalculatedStyleValue directly, or it holds a Foo which itself
holds the CalculatedStyleValue. The first case was already handled to
return Foo, and with this patch, the second is too. :^)
This commit is contained in:
Sam Atkins 2022-07-27 13:45:05 +01:00 committed by Andreas Kling
parent 3fce4f7c91
commit 7b4004d682
9 changed files with 30 additions and 0 deletions

View file

@ -83,4 +83,10 @@ Optional<Frequency::Type> Frequency::unit_from_name(StringView name)
return {};
}
NonnullRefPtr<CalculatedStyleValue> Frequency::calculated_style_value() const
{
VERIFY(!m_calculated_style.is_null());
return *m_calculated_style;
}
}