From 99c6eb0c35c6c041c016aa675a873daa6978a104 Mon Sep 17 00:00:00 2001 From: Manuel Zahariev Date: Mon, 26 May 2025 10:34:26 -0700 Subject: [PATCH] LibWeb/CSS: Invalidate layout tree for changes to counter definitions A change to a counter "definition" propagates to all subsequent instances of this counter: descendents, siblings and their descendents (the "next tree slice"). Rebuilding the layout tree (from the parent node) covers at least the "next_tree_slice". --- Libraries/LibWeb/CSS/StyleInvalidation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Libraries/LibWeb/CSS/StyleInvalidation.cpp b/Libraries/LibWeb/CSS/StyleInvalidation.cpp index 9c7e80ddb8a..377532ef1c6 100644 --- a/Libraries/LibWeb/CSS/StyleInvalidation.cpp +++ b/Libraries/LibWeb/CSS/StyleInvalidation.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2024, Aliaksandr Kalenik + * Copyright (c) 2025, Manuel Zahariev * * SPDX-License-Identifier: BSD-2-Clause */ @@ -40,6 +41,11 @@ RequiredInvalidationAfterStyleChange compute_property_invalidation(CSS::Property return RequiredInvalidationAfterStyleChange::full(); } + if (AK::first_is_one_of(property_id, CSS::PropertyID::CounterReset, CSS::PropertyID::CounterSet, CSS::PropertyID::CounterIncrement)) { + invalidation.rebuild_layout_tree = property_value_changed; + return invalidation; + } + // OPTIMIZATION: Special handling for CSS `visibility`: if (property_id == CSS::PropertyID::Visibility) { // We don't need to relayout if the visibility changes from visible to hidden or vice versa. Only collapse requires relayout.