From 581f5dfc86c7970273c7018358dbf6c1da30348b Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 27 Jan 2025 17:13:53 +0000 Subject: [PATCH] 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. --- Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp index e02a3e05c51..82ebab4b9aa 100644 --- a/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp @@ -1735,11 +1735,6 @@ bool RemCalculationNode::equals(CalculationNode const& other) const CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalculationResult::from_value(Value const& value, CalculationResolutionContext const& context, Optional 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)