Struct selectors::context::MatchingContext [−][src]
pub struct MatchingContext<'a, Impl> where
Impl: SelectorImpl, { pub bloom_filter: Option<&'a BloomFilter>, pub nth_index_cache: Option<&'a mut NthIndexCache>, pub scope_element: Option<OpaqueElement>, pub current_host: Option<OpaqueElement>, pub pseudo_element_matching_fn: Option<&'a dyn Fn(&Impl::PseudoElement) -> bool>, pub extra_data: Impl::ExtraMatchingData, // some fields omitted }
Data associated with the matching process for a element. This context is used across many selectors for an element, so it’s not appropriate for transient data that applies to only a single selector.
Fields
bloom_filter: Option<&'a BloomFilter>
Input with the bloom filter used to fast-reject selectors.
nth_index_cache: Option<&'a mut NthIndexCache>
An optional cache to speed up nth-index-like selectors.
scope_element: Option<OpaqueElement>
The element which is going to match :scope pseudo-class. It can be either one :scope element, or the scoping element.
Note that, although in theory there can be multiple :scope elements, in current specs, at most one is specified, and when there is one, scoping element is not relevant anymore, so we use a single field for them.
When this is None, :scope will match the root element.
See https://drafts.csswg.org/selectors-4/#scope-pseudo
current_host: Option<OpaqueElement>
The current shadow host we’re collecting :host rules for.
pseudo_element_matching_fn: Option<&'a dyn Fn(&Impl::PseudoElement) -> bool>
An optional hook function for checking whether a pseudo-element should match when matching_mode is ForStatelessPseudoElement.
extra_data: Impl::ExtraMatchingData
Extra implementation-dependent matching data.
Implementations
impl<'a, Impl> MatchingContext<'a, Impl> where
Impl: SelectorImpl,
[src]
impl<'a, Impl> MatchingContext<'a, Impl> where
Impl: SelectorImpl,
[src]pub fn new(
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
quirks_mode: QuirksMode
) -> Self
[src]
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
quirks_mode: QuirksMode
) -> Self
Constructs a new MatchingContext
.
pub fn new_for_visited(
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
visited_handling: VisitedHandlingMode,
quirks_mode: QuirksMode
) -> Self
[src]
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
visited_handling: VisitedHandlingMode,
quirks_mode: QuirksMode
) -> Self
Constructs a new MatchingContext
for use in visited matching.
pub fn is_nested(&self) -> bool
[src]
Whether we’re matching a nested selector.
pub fn in_negation(&self) -> bool
[src]
Whether we’re matching inside a :not(..) selector.
pub fn quirks_mode(&self) -> QuirksMode
[src]
The quirks mode of the document.
pub fn matching_mode(&self) -> MatchingMode
[src]
The matching-mode for this selector-matching operation.
pub fn classes_and_ids_case_sensitivity(&self) -> CaseSensitivity
[src]
The case-sensitivity for class and ID selectors
pub fn nest<F, R>(&mut self, f: F) -> R where
F: FnOnce(&mut Self) -> R,
[src]
F: FnOnce(&mut Self) -> R,
Runs F with a deeper nesting level.
pub fn nest_for_negation<F, R>(&mut self, f: F) -> R where
F: FnOnce(&mut Self) -> R,
[src]
F: FnOnce(&mut Self) -> R,
Runs F with a deeper nesting level, and marking ourselves in a negation, for a :not(..) selector, for example.
pub fn visited_handling(&self) -> VisitedHandlingMode
[src]
pub fn with_visited_handling_mode<F, R>(
&mut self,
handling_mode: VisitedHandlingMode,
f: F
) -> R where
F: FnOnce(&mut Self) -> R,
[src]
&mut self,
handling_mode: VisitedHandlingMode,
f: F
) -> R where
F: FnOnce(&mut Self) -> R,
Runs F with a different VisitedHandlingMode.
pub fn with_shadow_host<F, E, R>(&mut self, host: Option<E>, f: F) -> R where
E: Element,
F: FnOnce(&mut Self) -> R,
[src]
E: Element,
F: FnOnce(&mut Self) -> R,
Runs F with a given shadow host which is the root of the tree whose rules we’re matching.
pub fn shadow_host(&self) -> Option<OpaqueElement>
[src]
Returns the current shadow host whose shadow root we’re matching rules against.
Auto Trait Implementations
impl<'a, Impl> !RefUnwindSafe for MatchingContext<'a, Impl>
impl<'a, Impl> !RefUnwindSafe for MatchingContext<'a, Impl>
impl<'a, Impl> !Send for MatchingContext<'a, Impl>
impl<'a, Impl> !Send for MatchingContext<'a, Impl>
impl<'a, Impl> !Sync for MatchingContext<'a, Impl>
impl<'a, Impl> !Sync for MatchingContext<'a, Impl>
impl<'a, Impl> Unpin for MatchingContext<'a, Impl> where
Impl: Unpin,
<Impl as SelectorImpl>::ExtraMatchingData: Unpin,
impl<'a, Impl> Unpin for MatchingContext<'a, Impl> where
Impl: Unpin,
<Impl as SelectorImpl>::ExtraMatchingData: Unpin,
impl<'a, Impl> !UnwindSafe for MatchingContext<'a, Impl>
impl<'a, Impl> !UnwindSafe for MatchingContext<'a, Impl>