style: Fix a no-longer valid assumption in pseudo-element matching / invalidation code.

After bug 1632647, we can have pseudo-classes inside :not / :is /
:where, which the invalidation and matching code weren't handling.

Add a few tests for this stuff working as expected.

Differential Revision: https://phabricator.services.mozilla.com/D76160
This commit is contained in:
Emilio Cobos Álvarez 2020-05-20 23:53:34 +00:00
parent a40b2b610a
commit bd23e05c47
3 changed files with 65 additions and 19 deletions

View file

@ -322,14 +322,13 @@ where
},
}
// The only other parser-allowed Component in this sequence is a state
// class. We just don't match in that case.
if let Some(s) = iter.next() {
debug_assert!(
matches!(*s, Component::NonTSPseudoClass(..)),
"Someone messed up pseudo-element parsing"
);
return false;
for component in &mut iter {
// The only other parser-allowed Components in this sequence are
// state pseudo-classes, or one of the other things that can contain
// them.
if !component.matches_for_stateless_pseudo_element() {
return false;
}
}
// Advance to the non-pseudo-element part of the selector.