2020-01-18 09:38:21 +01:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2019-10-08 15:33:58 +02:00
|
|
|
#pragma once
|
|
|
|
|
2020-03-07 10:32:51 +01:00
|
|
|
#include <LibWeb/CSS/Selector.h>
|
2020-07-26 19:37:56 +02:00
|
|
|
#include <LibWeb/DOM/Element.h>
|
2019-10-08 15:33:58 +02:00
|
|
|
|
2020-07-26 19:37:56 +02:00
|
|
|
namespace Web::SelectorEngine {
|
2020-03-07 10:27:02 +01:00
|
|
|
|
2024-07-13 09:19:30 -07:00
|
|
|
enum class SelectorKind {
|
|
|
|
Normal,
|
|
|
|
Relative,
|
|
|
|
};
|
|
|
|
|
2025-01-03 20:39:25 +03:00
|
|
|
struct MatchContext {
|
|
|
|
GC::Ptr<CSS::CSSStyleSheet const> style_sheet_for_rule {};
|
2025-01-29 03:31:46 +01:00
|
|
|
GC::Ptr<DOM::Element const> subject {};
|
2025-09-03 14:58:35 +02:00
|
|
|
GC::Ptr<DOM::Element const> slotted_element {}; // Only set when matching a ::slotted() pseudo-element
|
2025-01-29 03:31:46 +01:00
|
|
|
bool collect_per_element_selector_involvement_metadata { false };
|
2025-04-17 13:39:30 +02:00
|
|
|
CSS::PseudoClassBitmap attempted_pseudo_class_matches {};
|
2025-01-03 20:39:25 +03:00
|
|
|
};
|
|
|
|
|
2025-03-20 16:56:46 +00:00
|
|
|
bool matches(CSS::Selector const&, DOM::Element const&, GC::Ptr<DOM::Element const> shadow_host, MatchContext& context, Optional<CSS::PseudoElement> = {}, GC::Ptr<DOM::ParentNode const> scope = {}, SelectorKind selector_kind = SelectorKind::Normal, GC::Ptr<DOM::Element const> anchor = nullptr);
|
2020-03-07 10:27:02 +01:00
|
|
|
|
|
|
|
}
|