From afa95c2815a71e5974eb6b09e0f5a5387cce3d7f Mon Sep 17 00:00:00 2001 From: Callum Law Date: Wed, 2 Jul 2025 19:12:33 +1200 Subject: [PATCH] LibWeb: Mark `CalculatedStyleValue::resolve_*` methods as deprecated The existing resolve methods are not to spec and we are working to replace them with new ones based on the `simplify_a_calculation_tree` method. These are marked as deprecated rather than replaced outright as work will need to be done on the caller side to be made compatible with the new methods, for instance the new methods can fail to resolve (e.g. if we are missing required context), where the existing methods will always resolve (albeit sometimes with an incorrect value). No functionality changes. --- Libraries/LibWeb/CSS/Angle.cpp | 2 +- Libraries/LibWeb/CSS/CSSStyleValue.cpp | 2 +- Libraries/LibWeb/CSS/CalculatedOr.cpp | 18 +++++++++--------- Libraries/LibWeb/CSS/ComputedProperties.cpp | 18 +++++++++--------- Libraries/LibWeb/CSS/Frequency.cpp | 2 +- Libraries/LibWeb/CSS/Length.cpp | 4 ++-- Libraries/LibWeb/CSS/ParsedFontFace.cpp | 6 +++--- .../LibWeb/CSS/Parser/DescriptorParsing.cpp | 2 +- .../LibWeb/CSS/Parser/PropertyParsing.cpp | 2 +- Libraries/LibWeb/CSS/Parser/ValueParsing.cpp | 2 +- Libraries/LibWeb/CSS/StyleComputer.cpp | 4 ++-- .../LibWeb/CSS/StyleValues/CSSColorValue.cpp | 13 ++++++------- Libraries/LibWeb/CSS/StyleValues/CSSRGB.cpp | 4 ++-- .../CSS/StyleValues/CalculatedStyleValue.cpp | 18 +++++++++--------- .../CSS/StyleValues/CalculatedStyleValue.h | 18 +++++++++--------- .../StyleValues/ColorFunctionStyleValue.cpp | 4 ++-- .../StyleValues/FilterValueListStyleValue.cpp | 4 ++-- .../StyleValues/TransformationStyleValue.cpp | 2 +- Libraries/LibWeb/CSS/Time.cpp | 2 +- Libraries/LibWeb/CSS/Transformation.cpp | 6 +++--- Libraries/LibWeb/Layout/LayoutState.cpp | 2 +- Libraries/LibWeb/Layout/Node.cpp | 4 ++-- 22 files changed, 69 insertions(+), 70 deletions(-) diff --git a/Libraries/LibWeb/CSS/Angle.cpp b/Libraries/LibWeb/CSS/Angle.cpp index 5985313364e..219658b4dc9 100644 --- a/Libraries/LibWeb/CSS/Angle.cpp +++ b/Libraries/LibWeb/CSS/Angle.cpp @@ -88,7 +88,7 @@ Optional Angle::unit_from_name(StringView name) Angle Angle::resolve_calculated(NonnullRefPtr const& calculated, Layout::Node const& layout_node, Angle const& reference_value) { - return calculated->resolve_angle( + return calculated->resolve_angle_deprecated( { .percentage_basis = reference_value, .length_resolution_context = Length::ResolutionContext::for_layout_node(layout_node), diff --git a/Libraries/LibWeb/CSS/CSSStyleValue.cpp b/Libraries/LibWeb/CSS/CSSStyleValue.cpp index 7a0c8119edb..a86a6a39fc7 100644 --- a/Libraries/LibWeb/CSS/CSSStyleValue.cpp +++ b/Libraries/LibWeb/CSS/CSSStyleValue.cpp @@ -450,7 +450,7 @@ int CSSStyleValue::to_font_weight() const return round_to(as_number().number()); } if (is_calculated()) { - auto maybe_weight = as_calculated().resolve_integer({}); + auto maybe_weight = as_calculated().resolve_integer_deprecated({}); if (maybe_weight.has_value()) return maybe_weight.value(); } diff --git a/Libraries/LibWeb/CSS/CalculatedOr.cpp b/Libraries/LibWeb/CSS/CalculatedOr.cpp index ec21a2bb467..99ce172162b 100644 --- a/Libraries/LibWeb/CSS/CalculatedOr.cpp +++ b/Libraries/LibWeb/CSS/CalculatedOr.cpp @@ -19,7 +19,7 @@ namespace Web::CSS { Optional AngleOrCalculated::resolve_calculated(NonnullRefPtr const& calculated, CalculationResolutionContext const& context) const { - return calculated->resolve_angle(context); + return calculated->resolve_angle_deprecated(context); } NonnullRefPtr AngleOrCalculated::create_style_value() const @@ -29,7 +29,7 @@ NonnullRefPtr AngleOrCalculated::create_style_value() const Optional FlexOrCalculated::resolve_calculated(NonnullRefPtr const& calculated, CalculationResolutionContext const& context) const { - return calculated->resolve_flex(context); + return calculated->resolve_flex_deprecated(context); } NonnullRefPtr FlexOrCalculated::create_style_value() const @@ -39,7 +39,7 @@ NonnullRefPtr FlexOrCalculated::create_style_value() const Optional FrequencyOrCalculated::resolve_calculated(NonnullRefPtr const& calculated, CalculationResolutionContext const& context) const { - return calculated->resolve_frequency(context); + return calculated->resolve_frequency_deprecated(context); } NonnullRefPtr FrequencyOrCalculated::create_style_value() const @@ -49,7 +49,7 @@ NonnullRefPtr FrequencyOrCalculated::create_style_value() c Optional IntegerOrCalculated::resolve_calculated(NonnullRefPtr const& calculated, CalculationResolutionContext const& context) const { - return calculated->resolve_integer(context); + return calculated->resolve_integer_deprecated(context); } NonnullRefPtr IntegerOrCalculated::create_style_value() const @@ -59,7 +59,7 @@ NonnullRefPtr IntegerOrCalculated::create_style_value() con Optional LengthOrCalculated::resolve_calculated(NonnullRefPtr const& calculated, CalculationResolutionContext const& context) const { - return calculated->resolve_length(context); + return calculated->resolve_length_deprecated(context); } NonnullRefPtr LengthOrCalculated::create_style_value() const @@ -69,7 +69,7 @@ NonnullRefPtr LengthOrCalculated::create_style_value() cons Optional NumberOrCalculated::resolve_calculated(NonnullRefPtr const& calculated, CalculationResolutionContext const& context) const { - return calculated->resolve_number(context); + return calculated->resolve_number_deprecated(context); } NonnullRefPtr NumberOrCalculated::create_style_value() const @@ -79,7 +79,7 @@ NonnullRefPtr NumberOrCalculated::create_style_value() cons Optional PercentageOrCalculated::resolve_calculated(NonnullRefPtr const& calculated, CalculationResolutionContext const& context) const { - return calculated->resolve_percentage(context); + return calculated->resolve_percentage_deprecated(context); } NonnullRefPtr PercentageOrCalculated::create_style_value() const @@ -89,7 +89,7 @@ NonnullRefPtr PercentageOrCalculated::create_style_value() Optional ResolutionOrCalculated::resolve_calculated(NonnullRefPtr const& calculated, CalculationResolutionContext const& context) const { - return calculated->resolve_resolution(context); + return calculated->resolve_resolution_deprecated(context); } NonnullRefPtr ResolutionOrCalculated::create_style_value() const @@ -99,7 +99,7 @@ NonnullRefPtr ResolutionOrCalculated::create_style_value() Optional