From 487d0abd7c0d0ec062bb45618749a8937bffd042 Mon Sep 17 00:00:00 2001 From: Callum Law Date: Sun, 24 Aug 2025 15:31:24 +1200 Subject: [PATCH] LibWeb: Only consider longhands when recomputing inherited style Only longhands have computed values so checking shorthand values is unnecessary --- Libraries/LibWeb/DOM/Element.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index fcc31720d78..5224ebd3c4a 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -805,8 +805,10 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_inherited_style() CSS::RequiredInvalidationAfterStyleChange invalidation; HashMap> old_values_with_relative_units; - for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) { + for (auto i = to_underlying(CSS::first_longhand_property_id); i <= to_underlying(CSS::last_longhand_property_id); ++i) { auto property_id = static_cast(i); + // FIXME: We should use the specified value rather than the cascaded value as the cascaded value may include + // unresolved CSS-wide keywords (e.g. 'initial' or 'inherit') rather than the resolved value. auto const& preabsolutized_value = m_cascaded_properties->property(property_id); RefPtr old_value = computed_properties->maybe_null_property(property_id); // Update property if it uses relative units as it might have been affected by a change in ancestor element style.