mirror of
https://github.com/servo/servo.git
synced 2025-07-29 18:20:24 +01:00
selectors: Allow defining an implementation-dependent field in the matching context.
This commit is contained in:
parent
9b3fc43f5a
commit
1e27f2883b
6 changed files with 11 additions and 0 deletions
|
@ -130,6 +130,9 @@ where
|
|||
/// should match when matching_mode is ForStatelessPseudoElement.
|
||||
pub pseudo_element_matching_fn: Option<&'a Fn(&Impl::PseudoElement) -> bool>,
|
||||
|
||||
/// Extra implementation-dependent matching data.
|
||||
pub extra_data: Option<Impl::ExtraMatchingData>,
|
||||
|
||||
quirks_mode: QuirksMode,
|
||||
classes_and_ids_case_sensitivity: CaseSensitivity,
|
||||
_impl: ::std::marker::PhantomData<Impl>,
|
||||
|
@ -173,6 +176,7 @@ where
|
|||
scope_element: None,
|
||||
nesting_level: 0,
|
||||
pseudo_element_matching_fn: None,
|
||||
extra_data: None,
|
||||
_impl: ::std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ macro_rules! with_all_bounds {
|
|||
/// are parameterized on SelectorImpl. See
|
||||
/// <https://github.com/rust-lang/rust/issues/26925>
|
||||
pub trait SelectorImpl: Clone + Sized + 'static {
|
||||
type ExtraMatchingData: Sized + 'static;
|
||||
type AttrValue: $($InSelector)*;
|
||||
type Identifier: $($InSelector)* + PrecomputedHash;
|
||||
type ClassName: $($InSelector)* + PrecomputedHash;
|
||||
|
@ -2027,6 +2028,7 @@ pub mod tests {
|
|||
}
|
||||
|
||||
impl SelectorImpl for DummySelectorImpl {
|
||||
type ExtraMatchingData = ();
|
||||
type AttrValue = DummyAtom;
|
||||
type Identifier = DummyAtom;
|
||||
type ClassName = DummyAtom;
|
||||
|
|
|
@ -24,6 +24,7 @@ impl parser::PseudoElement for gecko_like_types::PseudoElement {
|
|||
// Boilerplate
|
||||
|
||||
impl SelectorImpl for Impl {
|
||||
type ExtraMatchingData = u64;
|
||||
type AttrValue = Atom;
|
||||
type Identifier = Atom;
|
||||
type ClassName = Atom;
|
||||
|
|
|
@ -278,6 +278,7 @@ impl NonTSPseudoClass {
|
|||
pub struct SelectorImpl;
|
||||
|
||||
impl ::selectors::SelectorImpl for SelectorImpl {
|
||||
type ExtraMatchingData = ();
|
||||
type AttrValue = Atom;
|
||||
type Identifier = Atom;
|
||||
type ClassName = Atom;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#![deny(warnings)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#![cfg_attr(feature = "servo", feature(never_type))]
|
||||
|
||||
#![recursion_limit = "500"] // For define_css_keyword_enum! in -moz-appearance
|
||||
|
||||
extern crate app_units;
|
||||
|
|
|
@ -377,6 +377,7 @@ impl ::selectors::SelectorImpl for SelectorImpl {
|
|||
type PseudoElement = PseudoElement;
|
||||
type NonTSPseudoClass = NonTSPseudoClass;
|
||||
|
||||
type ExtraMatchingData = !;
|
||||
type AttrValue = String;
|
||||
type Identifier = Atom;
|
||||
type ClassName = Atom;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue