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".
This commit is contained in:
Manuel Zahariev 2025-05-26 10:34:26 -07:00 committed by Alexander Kalenik
commit 99c6eb0c35
Notes: github-actions[bot] 2025-06-03 01:52:56 +00:00

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
* Copyright (c) 2025, Manuel Zahariev <manuel@duck.com>
*
* 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.