ladybird/Libraries/LibWeb/CSS/Invalidation/HasMutationFeatureCollector.h
Jelle Raaijmakers d8a55dad1c LibWeb: Target :active and :open invalidation
Changing :active or :open used the broad style invalidation path, so
large subtrees were recomputed even when only the target element and
selector-matched relatives could be affected.

Reuse the :has() feature collector to keep conservative fallback for
observable :has() cases, then use pseudo-class property invalidation
for the common targeted path.
2026-06-18 13:42:51 +02:00

41 lines
903 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 {
enum class PseudoClass;
struct StyleInvalidationData;
class StyleScope;
namespace Invalidation {
class HasMutationFeatureCollector {
public:
explicit HasMutationFeatureCollector(StyleInvalidationData const&);
[[nodiscard]] bool has_any_metadata() const;
[[nodiscard]] bool element_has_feature_used_in_has_selector(DOM::Element const&) const;
[[nodiscard]] bool subtree_has_feature_used_in_has_selector(DOM::Node&) const;
private:
StyleInvalidationData const& m_data;
};
[[nodiscard]] bool element_has_feature_used_in_has_selector(DOM::Element const&, PseudoClass, StyleScope const&);
[[nodiscard]] bool subtree_has_feature_used_in_has_selector(DOM::Node&, StyleScope const&);
}
}