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.
This commit is contained in:
Callum Law 2025-07-02 19:12:33 +12:00 committed by Sam Atkins
commit afa95c2815
Notes: github-actions[bot] 2025-07-16 12:06:57 +00:00
22 changed files with 69 additions and 70 deletions

View file

@ -781,14 +781,14 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)
computed_values.set_transition_delay(transition_delay.time());
} else if (transition_delay_property.is_calculated()) {
auto const& transition_delay = transition_delay_property.as_calculated();
computed_values.set_transition_delay(transition_delay.resolve_time({ .length_resolution_context = CSS::Length::ResolutionContext::for_layout_node(*this) }).value());
computed_values.set_transition_delay(transition_delay.resolve_time_deprecated({ .length_resolution_context = CSS::Length::ResolutionContext::for_layout_node(*this) }).value());
}
auto resolve_border_width = [&](CSS::PropertyID width_property) -> CSSPixels {
auto const& value = computed_style.property(width_property);
if (value.is_calculated())
return max(CSSPixels { 0 },
value.as_calculated().resolve_length({ .length_resolution_context = CSS::Length::ResolutionContext::for_layout_node(*this) })->to_px(*this));
value.as_calculated().resolve_length_deprecated({ .length_resolution_context = CSS::Length::ResolutionContext::for_layout_node(*this) })->to_px(*this));
if (value.is_length()) {
// FIXME: Currently, interpolation can set property values outside of their valid range.
// We should instead clamp property values to the valid range when interpolating.