mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
a40b2b610a
commit
bd23e05c47
3 changed files with 65 additions and 19 deletions
|
@ -871,23 +871,29 @@ where
|
|||
// This will usually be the very next component, except for
|
||||
// the fact that we store compound selectors the other way
|
||||
// around, so there could also be state pseudo-classes.
|
||||
let pseudo_selector = next_invalidation
|
||||
let pseudo = next_invalidation
|
||||
.dependency
|
||||
.selector
|
||||
.iter_raw_parse_order_from(next_invalidation.offset)
|
||||
.skip_while(|c| matches!(**c, Component::NonTSPseudoClass(..)))
|
||||
.flat_map(|c| {
|
||||
if let Component::PseudoElement(ref pseudo) = *c {
|
||||
return Some(pseudo);
|
||||
}
|
||||
|
||||
// TODO: Would be nice to make this a diagnostic_assert! of
|
||||
// sorts.
|
||||
debug_assert!(
|
||||
c.maybe_allowed_after_pseudo_element(),
|
||||
"Someone seriously messed up selector parsing: \
|
||||
{:?} at offset {:?}: {:?}",
|
||||
next_invalidation.dependency, next_invalidation.offset, c,
|
||||
);
|
||||
|
||||
None
|
||||
})
|
||||
.next()
|
||||
.unwrap();
|
||||
|
||||
let pseudo = match *pseudo_selector {
|
||||
Component::PseudoElement(ref pseudo) => pseudo,
|
||||
_ => unreachable!(
|
||||
"Someone seriously messed up selector parsing: \
|
||||
{:?} at offset {:?}: {:?}",
|
||||
next_invalidation.dependency, next_invalidation.offset, pseudo_selector,
|
||||
),
|
||||
};
|
||||
|
||||
// FIXME(emilio): This is not ideal, and could not be
|
||||
// accurate if we ever have stateful element-backed eager
|
||||
// pseudos.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue