From d4aa40a9fecf91881a9621165416f926cc35e7a6 Mon Sep 17 00:00:00 2001 From: Callum Law Date: Wed, 27 Aug 2025 16:40:11 +1200 Subject: [PATCH] LibWeb: Use computed not just absolutized value when computing keyframes No functionality changes as we don't yet implement computing any property values using this method. --- Libraries/LibWeb/CSS/StyleComputer.cpp | 36 +++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp index bcfb47680fa..f9c0e160401 100644 --- a/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -1103,6 +1103,9 @@ void StyleComputer::collect_animation_into(DOM::Element& element, Optional> specified_values; + for (auto const& [property_id, value] : keyframe_values.properties) { bool is_use_initial = false; @@ -1118,7 +1121,7 @@ void StyleComputer::collect_animation_into(DOM::Element& element, Optional StyleValue const& { @@ -1161,9 +1164,34 @@ void StyleComputer::collect_animation_into(DOM::Element& element, Optional(PropertyID)> get_property_specified_value = [&](PropertyID property_id) -> NonnullRefPtr { + if (auto keyframe_value = specified_values.get(property_id); keyframe_value.has_value() && keyframe_value.value()) + return *keyframe_value.value(); + + return computed_properties.property(property_id); + }; + + for (auto const& [property_id, style_value] : specified_values) { + if (!style_value) + continue; + + auto const& computed_value = compute_value_of_property(property_id, *style_value, get_property_specified_value, property_value_computation_context); + result.set(property_id, computed_value->absolutized(viewport_rect(), font_metrics, m_root_element_font_metrics)); + } + return result; }; HashMap> computed_start_values = compute_keyframe_values(keyframe_values);