diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2017-09-20 12:43:29 -0700 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2017-09-20 23:22:38 -0700 |
commit | 48466bf8761d3a9c6064eb2b39fc74e790e26cb7 (patch) | |
tree | fa7aaab6ebd8c516d1410af8a927e68268c4662e /components/script/dom/node.rs | |
parent | 05c03d5104ae6d0790c153e4fa8df7ac7015db18 (diff) | |
download | servo-48466bf8761d3a9c6064eb2b39fc74e790e26cb7.tar.gz servo-48466bf8761d3a9c6064eb2b39fc74e790e26cb7.zip |
Introduce an NthIndexCache type and pipe it from ThreadLocalStyleContext to MatchingContext.
Some future refactoring here to pass fewer things as parameters would be nice.
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index b83cdcbd37e..6b16cc242db 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -363,7 +363,9 @@ impl<'a> Iterator for QuerySelectorIterator { self.iterator.by_ref().filter_map(|node| { // TODO(cgaebel): Is it worth it to build a bloom filter here // (instead of passing `None`)? Probably. - let mut ctx = MatchingContext::new(MatchingMode::Normal, None, + // + // FIXME(bholley): Consider an nth-index cache here. + let mut ctx = MatchingContext::new(MatchingMode::Normal, None, None, node.owner_doc().quirks_mode()); if let Some(element) = Root::downcast(node) { if matches_selector_list(selectors, &element, &mut ctx) { @@ -754,7 +756,8 @@ impl Node { Err(_) => Err(Error::Syntax), // Step 3. Ok(selectors) => { - let mut ctx = MatchingContext::new(MatchingMode::Normal, None, + // FIXME(bholley): Consider an nth-index cache here. + let mut ctx = MatchingContext::new(MatchingMode::Normal, None, None, self.owner_doc().quirks_mode()); Ok(self.traverse_preorder().filter_map(Root::downcast).find(|element| { matches_selector_list(&selectors, element, &mut ctx) |