Introduce an NthIndexCache type and pipe it from ThreadLocalStyleContext to MatchingContext.

Some future refactoring here to pass fewer things as parameters would be nice.
This commit is contained in:
Bobby Holley 2017-09-20 12:43:29 -07:00
parent 05c03d5104
commit 48466bf876
11 changed files with 83 additions and 24 deletions

View file

@ -413,10 +413,12 @@ where
let map = &mut self.context.thread_local.selector_flags;
let bloom_filter = self.context.thread_local.bloom_filter.filter();
let nth_index_cache = &mut self.context.thread_local.nth_index_cache;
let mut matching_context =
MatchingContext::new_for_visited(
MatchingMode::Normal,
Some(bloom_filter),
Some(nth_index_cache),
visited_handling,
self.context.shared.quirks_mode(),
);
@ -486,11 +488,13 @@ where
}
let bloom_filter = self.context.thread_local.bloom_filter.filter();
let nth_index_cache = &mut self.context.thread_local.nth_index_cache;
let mut matching_context =
MatchingContext::new_for_visited(
MatchingMode::ForStatelessPseudoElement,
Some(bloom_filter),
Some(nth_index_cache),
visited_handling,
self.context.shared.quirks_mode(),
);