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

@ -633,10 +633,12 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
debug!("TreeStyleInvalidator::process_invalidation({:?}, {:?}, {:?})",
self.element, invalidation, invalidation_kind);
// FIXME(bholley): Consider passing an nth-index cache here.
let mut context =
MatchingContext::new_for_visited(
MatchingMode::Normal,
None,
None,
VisitedHandlingMode::AllLinksVisitedAndUnvisited,
self.shared_context.quirks_mode(),
);
@ -946,12 +948,14 @@ impl<'a, 'b: 'a, E> InvalidationCollector<'a, 'b, E>
// whether any parent had a snapshot, and whether those snapshots were
// taken due to an element class/id change, but it's not clear it'd be
// worth it.
//
// FIXME(bholley): Consider passing an nth-index cache here.
let mut now_context =
MatchingContext::new_for_visited(MatchingMode::Normal, None,
MatchingContext::new_for_visited(MatchingMode::Normal, None, None,
VisitedHandlingMode::AllLinksUnvisited,
self.shared_context.quirks_mode());
let mut then_context =
MatchingContext::new_for_visited(MatchingMode::Normal, None,
MatchingContext::new_for_visited(MatchingMode::Normal, None, None,
VisitedHandlingMode::AllLinksUnvisited,
self.shared_context.quirks_mode());