Skip to content

Commit

Permalink
LibWeb/CSS: Remove inaccurate VERIFY from CalculationResult::from_value
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AtkinsSJ committed Jan 27, 2025
1 parent 5ca4e9f commit 435c16f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp
Original file line number Diff line number Diff line change
@@ -2438,11 +2438,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(); },
@@ -2468,7 +2463,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)

0 comments on commit 435c16f

Please sign in to comment.