ladybird/Libraries/LibWeb/CSS/Invalidation/StructuralMutationInvalidator.h
Andreas Kling a0459a3ff3 LibWeb: Avoid broad invalidation for nth-child filters
Property invalidation inside :nth-child(... of ...) used to become a
whole-subtree invalidation plan. That is broader than needed for
property changes that only affect the filtered sibling list, such as
:has() becoming true or false for one sibling.

Add an invalidation plan bit that marks the element and structurally
affected siblings instead. Keep whole-subtree invalidation when a
stronger plan already requires it, and cover both :nth-child and
:nth-last-child filters with :has() regression tests.
2026-06-12 15:13:29 +02:00

24 lines
594 B
C++

/*
* Copyright (c) 2026-present, the Ladybird developers
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/DOM/StyleInvalidationReason.h>
namespace Web::DOM {
class Node;
}
namespace Web::CSS::Invalidation {
void invalidate_style_after_same_parent_move(DOM::Node&, DOM::StyleInvalidationReason);
void invalidate_self_and_structurally_affected_siblings(DOM::Node&, DOM::StyleInvalidationReason);
void invalidate_structurally_affected_siblings(DOM::Node&, DOM::StyleInvalidationReason);
void mark_ancestors_as_having_child_needing_style_update(DOM::Node&);
}