Files
ladybird/Libraries/LibWeb/CSS/Invalidation/HasMutationFeatureCollector.h
Andreas Kling ea64c5e147 LibWeb: Move :has() mutation checks into a helper
Node.cpp currently knows too much about selector invalidation metadata
when deciding whether subtree mutations can affect :has() selectors.
Pull that logic into CSS/Invalidation/HasMutationFeatureCollector so DOM
mutation code can ask a focused helper instead of inspecting
StyleInvalidationData directly.

This is a behavior-preserving extraction. It keeps the existing
conservative fallbacks for featureless subtree-sensitive selectors and
still uses the existing element property matching helper for
pseudo-class metadata.
2026-04-29 15:47:23 +02:00

41 lines
766 B
C++

/*
* Copyright (c) 2026-present, the Ladybird developers
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
namespace Web::DOM {
class Element;
class Node;
}
namespace Web::CSS {
struct StyleInvalidationData;
class StyleScope;
namespace Invalidation {
class HasMutationFeatureCollector {
public:
explicit HasMutationFeatureCollector(StyleInvalidationData const&);
[[nodiscard]] bool has_any_metadata() const;
[[nodiscard]] bool subtree_has_feature_used_in_has_selector(DOM::Node&) const;
private:
[[nodiscard]] bool element_has_feature_used_in_has_selector(DOM::Element const&) const;
StyleInvalidationData const& m_data;
};
[[nodiscard]] bool subtree_has_feature_used_in_has_selector(DOM::Node&, StyleScope const&);
}
}