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