LibWeb/CSS: Remove inaccurate VERIFY from CalculationResult::from_value

The goal of this VERIFY was to ensure that we didn't mess up the logic
for calculating the correct type. However, it's now unable to do so
because it doesn't have access to the CalculationContext, which
determines what type percentages are. This makes it crash when running
the simplification algorithm. The benefits of this check are small, and
it meant doing extra work, so let's just remove it.
This commit is contained in:
Sam Atkins 2025-01-27 17:13:53 +00:00 committed by Andreas Kling
parent b947ae60db
commit 581f5dfc86
Notes: github-actions[bot] 2025-01-30 18:33:13 +00:00

View file

@ -1735,11 +1735,6 @@ bool RemCalculationNode::equals(CalculationNode const& other) const
CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalculationResult::from_value(Value const& value, CalculationResolutionContext const& context, Optional<CSSNumericType> numeric_type)
{
auto const expected_numeric_type = numeric_type_from_calculated_style_value(value, {});
if (numeric_type.has_value()) {
VERIFY(numeric_type.value() == expected_numeric_type);
}
auto number = value.visit(
[](Number const& number) { return number.value(); },
[](Angle const& angle) { return angle.to_degrees(); },
@ -1765,7 +1760,7 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalculationResult:
[](Time const& time) { return time.to_seconds(); },
[](Percentage const& percentage) { return percentage.value(); });
return CalculationResult { number, numeric_type };
return CalculationResult { number, move(numeric_type) };
}
void CalculatedStyleValue::CalculationResult::add(CalculationResult const& other)