Use selectors::SelectorList

This commit is contained in:
Simon Sapin 2016-11-21 19:48:11 +01:00
parent 81a3de3299
commit f044659b7c
5 changed files with 19 additions and 35 deletions

View file

@ -63,7 +63,7 @@ fn test_parse_stylesheet() {
url: NsAtom::from("http://www.w3.org/1999/xhtml")
}))),
CssRule::Style(Arc::new(RwLock::new(StyleRule {
selectors: vec![
selectors: SelectorList(vec![
Selector {
complex_selector: Arc::new(ComplexSelector {
compound_selector: vec![
@ -89,7 +89,7 @@ fn test_parse_stylesheet() {
pseudo_element: None,
specificity: (0 << 20) + (1 << 10) + (1 << 0),
},
],
]),
block: Arc::new(RwLock::new(PropertyDeclarationBlock {
declarations: vec![
(PropertyDeclaration::Display(DeclaredValue::Value(
@ -102,7 +102,7 @@ fn test_parse_stylesheet() {
})),
}))),
CssRule::Style(Arc::new(RwLock::new(StyleRule {
selectors: vec![
selectors: SelectorList(vec![
Selector {
complex_selector: Arc::new(ComplexSelector {
compound_selector: vec![
@ -137,7 +137,7 @@ fn test_parse_stylesheet() {
pseudo_element: None,
specificity: (0 << 20) + (0 << 10) + (1 << 0),
},
],
]),
block: Arc::new(RwLock::new(PropertyDeclarationBlock {
declarations: vec![
(PropertyDeclaration::Display(DeclaredValue::Value(
@ -148,7 +148,7 @@ fn test_parse_stylesheet() {
})),
}))),
CssRule::Style(Arc::new(RwLock::new(StyleRule {
selectors: vec![
selectors: SelectorList(vec![
Selector {
complex_selector: Arc::new(ComplexSelector {
compound_selector: vec![
@ -172,7 +172,7 @@ fn test_parse_stylesheet() {
pseudo_element: None,
specificity: (1 << 20) + (1 << 10) + (0 << 0),
},
],
]),
block: Arc::new(RwLock::new(PropertyDeclarationBlock {
declarations: vec![
(PropertyDeclaration::BackgroundColor(DeclaredValue::Value(

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::Parser;
use html5ever_atoms::LocalName;
use parking_lot::RwLock;
use selectors::parser::LocalName as LocalNameSelector;
@ -19,7 +18,7 @@ use style::thread_state;
/// Each sublist of the result contains the Rules for one StyleRule.
fn get_mock_rules(css_selectors: &[&str]) -> Vec<Vec<Rule>> {
css_selectors.iter().enumerate().map(|(i, selectors)| {
let selectors = SelectorParser::parse_author_origin_no_namespace(selectors).unwrap().0;
let selectors = SelectorParser::parse_author_origin_no_namespace(selectors).unwrap();
let rule = Arc::new(RwLock::new(StyleRule {
selectors: selectors,
@ -34,7 +33,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> Vec<Vec<Rule>> {
}));
let guard = rule.read();
guard.selectors.iter().map(|s| {
guard.selectors.0.iter().map(|s| {
Rule {
selector: s.complex_selector.clone(),
style_rule: rule.clone(),