Files
ladybird/Libraries/LibWeb/CSS/Invalidation/CustomElementInvalidator.cpp
Andreas Kling ca08d5a901 LibWeb: Move custom state set invalidation into the helper
CustomStateSet directly selected the style invalidation reason used when
its JS-visible set is modified. Move that mapping into
CSS::Invalidation::CustomElementInvalidator.

This keeps the custom-state container focused on its set contents while
CSS invalidation owns the style work required by :state() selectors.
2026-04-29 15:47:23 +02:00

31 lines
836 B
C++

/*
* Copyright (c) 2026-present, the Ladybird developers
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/CSS/Invalidation/CustomElementInvalidator.h>
#include <LibWeb/CSS/InvalidationSet.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/DOM/StyleInvalidationReason.h>
namespace Web::CSS::Invalidation {
void invalidate_style_after_custom_element_state_change(DOM::Element& element)
{
element.invalidate_style(
DOM::StyleInvalidationReason::CustomElementStateChange,
{
{ .type = InvalidationSet::Property::Type::PseudoClass, .value = PseudoClass::Defined },
},
{});
}
void invalidate_style_after_custom_state_set_change(DOM::Element& element)
{
element.invalidate_style(DOM::StyleInvalidationReason::CustomStateSetChange);
}
}