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