Files
ladybird/Libraries/LibWeb/CSS/Invalidation/LinkInvalidator.cpp
Andreas Kling 84f4140226 LibWeb: Move hyperlink style invalidation into a helper
HTML and SVG link elements both encoded the same pseudo-class list for
hyperlink state changes. Move that CSS policy into LinkInvalidator and
have both call sites delegate to it.

This keeps element-specific code focused on detecting hyperlink state
changes, while the helper owns the affected selector features.
2026-04-29 15:47:23 +02:00

28 lines
867 B
C++

/*
* Copyright (c) 2026-present, the Ladybird developers
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/CSS/Invalidation/LinkInvalidator.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_hyperlink_state_change(DOM::Element& element)
{
element.invalidate_style(
DOM::StyleInvalidationReason::HTMLHyperlinkElementHrefChange,
{
{ .type = InvalidationSet::Property::Type::PseudoClass, .value = PseudoClass::AnyLink },
{ .type = InvalidationSet::Property::Type::PseudoClass, .value = PseudoClass::Link },
{ .type = InvalidationSet::Property::Type::PseudoClass, .value = PseudoClass::LocalLink },
},
{});
}
}