LibWeb/CSS: Replace resolve_percentage_deprecated() with undeprecated

This commit is contained in:
Sam Atkins 2025-09-24 14:25:03 +01:00 committed by Tim Ledbetter
commit 995b7eb7b4
Notes: github-actions[bot] 2025-09-24 15:36:24 +00:00
6 changed files with 4 additions and 13 deletions

View file

@ -106,7 +106,7 @@ NonnullRefPtr<StyleValue const> NumberOrCalculated::create_style_value() const
Optional<Percentage> PercentageOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue const> const& calculated, CalculationResolutionContext const& context) const Optional<Percentage> PercentageOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue const> const& calculated, CalculationResolutionContext const& context) const
{ {
return calculated->resolve_percentage_deprecated(context); return calculated->resolve_percentage(context);
} }
NonnullRefPtr<StyleValue const> PercentageOrCalculated::create_style_value() const NonnullRefPtr<StyleValue const> PercentageOrCalculated::create_style_value() const

View file

@ -64,7 +64,7 @@ ParsedFontFace ParsedFontFace::from_descriptors(CSSFontFaceDescriptors const& de
return value.as_percentage().percentage(); return value.as_percentage().percentage();
if (value.is_calculated()) { if (value.is_calculated()) {
// FIXME: These should probably be simplified already? // FIXME: These should probably be simplified already?
return value.as_calculated().resolve_percentage_deprecated({}); return value.as_calculated().resolve_percentage({});
} }
if (value.to_keyword() == Keyword::Normal) if (value.to_keyword() == Keyword::Normal)
return {}; return {};

View file

@ -191,7 +191,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_descriptor_v
} }
// All calculations in descriptors must be resolvable at parse-time. // All calculations in descriptors must be resolvable at parse-time.
if (percentage_value->is_calculated()) { if (percentage_value->is_calculated()) {
auto percentage = percentage_value->as_calculated().resolve_percentage_deprecated({}); auto percentage = percentage_value->as_calculated().resolve_percentage({});
if (percentage.has_value() && percentage->value() >= 0) if (percentage.has_value() && percentage->value() >= 0)
return PercentageStyleValue::create(percentage.release_value()); return PercentageStyleValue::create(percentage.release_value());
return nullptr; return nullptr;

View file

@ -3029,14 +3029,6 @@ Optional<Length> CalculatedStyleValue::resolve_length(CalculationResolutionConte
return {}; return {};
} }
Optional<Percentage> CalculatedStyleValue::resolve_percentage_deprecated(CalculationResolutionContext const& context) const
{
auto result = m_calculation->resolve(context);
if (result.type().has_value() && result.type()->matches_percentage())
return Percentage { result.value() };
return {};
}
Optional<Percentage> CalculatedStyleValue::resolve_percentage(CalculationResolutionContext const& context) const Optional<Percentage> CalculatedStyleValue::resolve_percentage(CalculationResolutionContext const& context) const
{ {
auto result = resolve_value(context); auto result = resolve_value(context);

View file

@ -92,7 +92,6 @@ public:
Optional<Length> resolve_length(CalculationResolutionContext const&) const; Optional<Length> resolve_length(CalculationResolutionContext const&) const;
bool resolves_to_percentage() const { return m_resolved_type.matches_percentage(); } bool resolves_to_percentage() const { return m_resolved_type.matches_percentage(); }
Optional<Percentage> resolve_percentage_deprecated(CalculationResolutionContext const&) const;
Optional<Percentage> resolve_percentage(CalculationResolutionContext const&) const; Optional<Percentage> resolve_percentage(CalculationResolutionContext const&) const;
bool resolves_to_resolution() const { return m_resolved_type.matches_resolution(m_context.percentages_resolve_as); } bool resolves_to_resolution() const { return m_resolved_type.matches_resolution(m_context.percentages_resolve_as); }

View file

@ -37,7 +37,7 @@ float FilterOperation::Color::resolved_amount() const
return amount.calculated()->resolve_number(context).value(); return amount.calculated()->resolve_number(context).value();
if (amount.calculated()->resolves_to_percentage()) if (amount.calculated()->resolves_to_percentage())
return amount.calculated()->resolve_percentage_deprecated(context)->as_fraction(); return amount.calculated()->resolve_percentage(context)->as_fraction();
} }
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();