style: Add parsing support for ::part().

Disabled for now of course. This should be pretty uncontroversial I'd think.

Differential Revision: https://phabricator.services.mozilla.com/D28060
This commit is contained in:
Emilio Cobos Álvarez 2019-05-01 17:25:13 +00:00
parent 9f73576f6a
commit a23ad3be50
10 changed files with 106 additions and 17 deletions

View file

@ -340,6 +340,10 @@ where
}
}
fn is_part(&self, _name: &Atom) -> bool {
unimplemented!();
}
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
match self.snapshot() {
Some(snapshot) if snapshot.has_attrs() => snapshot.has_class(name, case_sensitivity),

View file

@ -98,6 +98,7 @@ impl Dependency {
// an eager pseudo, and return only Descendants here if not.
Some(Combinator::PseudoElement) => DependencyInvalidationKind::ElementAndDescendants,
Some(Combinator::SlotAssignment) => DependencyInvalidationKind::SlottedElements,
Some(Combinator::Part) => unimplemented!("Need to add invalidation for shadow parts"),
}
}
}

View file

@ -158,7 +158,10 @@ impl<'a> Invalidation<'a> {
// We should be able to do better here!
match self.selector.combinator_at_parse_order(self.offset - 1) {
Combinator::Descendant | Combinator::LaterSibling | Combinator::PseudoElement => true,
Combinator::SlotAssignment | Combinator::NextSibling | Combinator::Child => false,
Combinator::Part |
Combinator::SlotAssignment |
Combinator::NextSibling |
Combinator::Child => false,
}
}
@ -171,6 +174,9 @@ impl<'a> Invalidation<'a> {
Combinator::Child | Combinator::Descendant | Combinator::PseudoElement => {
InvalidationKind::Descendant(DescendantInvalidationKind::Dom)
},
Combinator::Part => {
unimplemented!("Need to add invalidation for shadow parts");
},
Combinator::SlotAssignment => {
InvalidationKind::Descendant(DescendantInvalidationKind::Slotted)
},