mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 13:02:09 +02:00
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.
28 lines
867 B
C++
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 },
|
|
},
|
|
{});
|
|
}
|
|
|
|
}
|