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

LibWeb: Allow percentage tokens again when parsing calc()

I unintentionally broke this in my LengthPercentage PR, but it was not
convenient to fix until now.
This commit is contained in:
Sam Atkins 2022-01-27 14:47:39 +00:00 committed by Andreas Kling
parent ce0de4b2b4
commit b54cd17c1e
3 changed files with 15 additions and 5 deletions

View file

@ -574,6 +574,7 @@ Optional<CalculatedStyleValue::ResolvedType> CalculatedStyleValue::CalcValue::re
return value.visit(
[](float) -> Optional<CalculatedStyleValue::ResolvedType> { return { ResolvedType::Number }; },
[](Length const&) -> Optional<CalculatedStyleValue::ResolvedType> { return { ResolvedType::Length }; },
[](Percentage const&) -> Optional<CalculatedStyleValue::ResolvedType> { return { ResolvedType::Percentage }; },
[](NonnullOwnPtr<CalcSum> const& sum) { return sum->resolved_type(); });
}
@ -604,6 +605,9 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcValue::resolve
[&](Length const& length) -> CalculatedStyleValue::CalculationResult {
return CalculatedStyleValue::CalculationResult { length };
},
[&](Percentage const& percentage) -> CalculatedStyleValue::CalculationResult {
return CalculatedStyleValue::CalculationResult { percentage };
},
[&](NonnullOwnPtr<CalcSum> const& sum) -> CalculatedStyleValue::CalculationResult {
return sum->resolve(layout_node, percentage_basis);
});