Introduce SelectorInner and use it for top-level matching.

MozReview-Commit-ID: DxG6USsPIkh
This commit is contained in:
Bobby Holley 2017-04-15 15:03:46 -07:00
parent 11745fb983
commit 9524c5cb57
9 changed files with 138 additions and 109 deletions

View file

@ -68,7 +68,7 @@ use script_layout_interface::{LayoutElementType, LayoutNodeType, TrustedNodeAddr
use script_layout_interface::message::Msg;
use script_traits::DocumentActivity;
use script_traits::UntrustedNodeAddress;
use selectors::matching::matches;
use selectors::matching::matches_selector_list;
use selectors::parser::SelectorList;
use servo_url::ServoUrl;
use std::borrow::ToOwned;
@ -332,7 +332,7 @@ impl<'a> Iterator for QuerySelectorIterator {
// (instead of passing `None`)? Probably.
self.iterator.by_ref().filter_map(|node| {
if let Some(element) = Root::downcast(node) {
if matches(selectors, &element, None) {
if matches_selector_list(selectors, &element, None) {
return Some(Root::upcast(element));
}
}
@ -695,7 +695,7 @@ impl Node {
// Step 3.
Ok(selectors) => {
Ok(self.traverse_preorder().filter_map(Root::downcast).find(|element| {
matches(&selectors.0, element, None)
matches_selector_list(&selectors.0, element, None)
}))
}
}