diff --git a/components/selectors/context.rs b/components/selectors/context.rs index ca7a2bfcb60..79e0b69b4e8 100644 --- a/components/selectors/context.rs +++ b/components/selectors/context.rs @@ -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, + quirks_mode: QuirksMode, classes_and_ids_case_sensitivity: CaseSensitivity, _impl: ::std::marker::PhantomData, @@ -173,6 +176,7 @@ where scope_element: None, nesting_level: 0, pseudo_element_matching_fn: None, + extra_data: None, _impl: ::std::marker::PhantomData, } } diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs index a6902d105c7..dead7875d0f 100644 --- a/components/selectors/parser.rs +++ b/components/selectors/parser.rs @@ -84,6 +84,7 @@ macro_rules! with_all_bounds { /// are parameterized on SelectorImpl. See /// 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; diff --git a/components/selectors/size_of_tests.rs b/components/selectors/size_of_tests.rs index 46b966ec5f3..8f0d6da94ef 100644 --- a/components/selectors/size_of_tests.rs +++ b/components/selectors/size_of_tests.rs @@ -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; diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index b70054fe84a..417e5caec99 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -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; diff --git a/components/style/lib.rs b/components/style/lib.rs index d4d3855a481..01e9cb7f191 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -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; diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index a06de17734e..b9b3a5a3b20 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -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;