2026-04-29 11:22:40 +02:00
|
|
|
/*
|
|
|
|
|
* 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)
|
|
|
|
|
{
|
2026-05-20 22:38:14 +02:00
|
|
|
DOM::StyleInvalidationOptions options;
|
|
|
|
|
options.invalidate_self = true;
|
|
|
|
|
|
2026-04-29 11:22:40 +02:00
|
|
|
element.invalidate_style(
|
|
|
|
|
DOM::StyleInvalidationReason::CustomElementStateChange,
|
|
|
|
|
{
|
|
|
|
|
{ .type = InvalidationSet::Property::Type::PseudoClass, .value = PseudoClass::Defined },
|
|
|
|
|
},
|
2026-05-20 22:38:14 +02:00
|
|
|
options);
|
2026-04-29 11:22:40 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-29 12:27:18 +02:00
|
|
|
void invalidate_style_after_custom_state_set_change(DOM::Element& element)
|
|
|
|
|
{
|
|
|
|
|
element.invalidate_style(DOM::StyleInvalidationReason::CustomStateSetChange);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 11:22:40 +02:00
|
|
|
}
|