mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Implement selector matching for :nth-child(An+B of selector list) and :nth-last-child(An+B of selector list)
Since we have been using a single hash map to cache all :nth-child indices (with no selector list), each different selector will need its own cache. As a side note, this patch does not address invalidation. Differential Revision: https://phabricator.services.mozilla.com/D166266
This commit is contained in:
parent
a973371cf2
commit
3076481c52
8 changed files with 223 additions and 71 deletions
|
@ -13,6 +13,7 @@ use crate::stylist::CascadeData;
|
|||
use selectors::matching::{
|
||||
MatchingContext, MatchingMode, NeedsSelectorFlags, QuirksMode, VisitedHandlingMode,
|
||||
};
|
||||
use selectors::NthIndexCache;
|
||||
use style_traits::dom::DocumentState;
|
||||
|
||||
/// A struct holding the members necessary to invalidate document state
|
||||
|
@ -43,11 +44,16 @@ pub struct DocumentStateInvalidationProcessor<'a, E: TElement, I> {
|
|||
impl<'a, E: TElement, I> DocumentStateInvalidationProcessor<'a, E, I> {
|
||||
/// Creates a new DocumentStateInvalidationProcessor.
|
||||
#[inline]
|
||||
pub fn new(rules: I, document_states_changed: DocumentState, quirks_mode: QuirksMode) -> Self {
|
||||
pub fn new(
|
||||
rules: I,
|
||||
document_states_changed: DocumentState,
|
||||
nth_index_cache: &'a mut NthIndexCache,
|
||||
quirks_mode: QuirksMode,
|
||||
) -> Self {
|
||||
let mut matching_context = MatchingContext::<'a, E::Impl>::new_for_visited(
|
||||
MatchingMode::Normal,
|
||||
None,
|
||||
None,
|
||||
nth_index_cache,
|
||||
VisitedHandlingMode::AllLinksVisitedAndUnvisited,
|
||||
quirks_mode,
|
||||
NeedsSelectorFlags::No,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue