Auto merge of #16900 - emilio:pseudos, r=bholley

Bug 1364850: Move PseudoElement to be just another combinator in selectors. r=bholley

On top of https://github.com/servo/servo/pull/16890.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16900)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-17 05:40:14 -05:00 committed by GitHub
commit d8b7013fcd
19 changed files with 675 additions and 541 deletions

View file

@ -90,8 +90,8 @@ fn test_parse_stylesheet() {
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
selectors: SelectorList(vec![
Selector {
inner: SelectorInner::from_vec(vec![
Selector::new_for_unit_testing(
SelectorInner::from_vec(vec![
Component::DefaultNamespace(NsAtom::from("http://www.w3.org/1999/xhtml")),
Component::LocalName(LocalName {
name: local_name!("input"),
@ -106,9 +106,8 @@ fn test_parse_stylesheet() {
}),
}, "hidden".to_owned(), CaseSensitivity::CaseInsensitive)
]),
pseudo_element: None,
specificity: (0 << 20) + (1 << 10) + (1 << 0),
},
(0 << 20) + (1 << 10) + (1 << 0)
),
]),
block: Arc::new(stylesheet.shared_lock.wrap(block_from(vec![
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::none),
@ -124,28 +123,26 @@ fn test_parse_stylesheet() {
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
selectors: SelectorList(vec![
Selector {
inner: SelectorInner::from_vec(vec![
Selector::new_for_unit_testing(
SelectorInner::from_vec(vec![
Component::DefaultNamespace(NsAtom::from("http://www.w3.org/1999/xhtml")),
Component::LocalName(LocalName {
name: local_name!("html"),
lower_name: local_name!("html"),
}),
]),
pseudo_element: None,
specificity: (0 << 20) + (0 << 10) + (1 << 0),
},
Selector {
inner: SelectorInner::from_vec(vec![
(0 << 20) + (0 << 10) + (1 << 0)
),
Selector::new_for_unit_testing(
SelectorInner::from_vec(vec![
Component::DefaultNamespace(NsAtom::from("http://www.w3.org/1999/xhtml")),
Component::LocalName(LocalName {
name: local_name!("body"),
lower_name: local_name!("body"),
}),
]),
pseudo_element: None,
specificity: (0 << 20) + (0 << 10) + (1 << 0),
},
(0 << 20) + (0 << 10) + (1 << 0)
),
]),
block: Arc::new(stylesheet.shared_lock.wrap(block_from(vec![
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::block),
@ -158,17 +155,16 @@ fn test_parse_stylesheet() {
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
selectors: SelectorList(vec![
Selector {
inner: SelectorInner::from_vec(vec![
Selector::new_for_unit_testing(
SelectorInner::from_vec(vec![
Component::DefaultNamespace(NsAtom::from("http://www.w3.org/1999/xhtml")),
Component::ID(Atom::from("d1")),
Component::Combinator(Combinator::Child),
Component::DefaultNamespace(NsAtom::from("http://www.w3.org/1999/xhtml")),
Component::Class(Atom::from("ok")),
]),
pseudo_element: None,
specificity: (1 << 20) + (1 << 10) + (0 << 0),
},
(1 << 20) + (1 << 10) + (0 << 0)
),
]),
block: Arc::new(stylesheet.shared_lock.wrap(block_from(vec![
(PropertyDeclaration::BackgroundColor(

View file

@ -12,8 +12,8 @@ fn size_of_selectors_dummy_types() {
assert_eq!(size_of::<dummies::PseudoClass>(), size_of::<real::NonTSPseudoClass>());
assert_eq!(align_of::<dummies::PseudoClass>(), align_of::<real::NonTSPseudoClass>());
assert_eq!(size_of::<dummies::PseudoElementSelector>(), size_of::<real::PseudoElementSelector>());
assert_eq!(align_of::<dummies::PseudoElementSelector>(), align_of::<real::PseudoElementSelector>());
assert_eq!(size_of::<dummies::PseudoElement>(), size_of::<real::PseudoElement>());
assert_eq!(align_of::<dummies::PseudoElement>(), align_of::<real::PseudoElement>());
assert_eq!(size_of::<dummies::Atom>(), size_of::<style::Atom>());
assert_eq!(align_of::<dummies::Atom>(), align_of::<style::Atom>());