diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /servo/components/selectors | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/selectors')
-rw-r--r-- | servo/components/selectors/parser.rs | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/servo/components/selectors/parser.rs b/servo/components/selectors/parser.rs index 792d4eb8bc..9b0acb0671 100644 --- a/servo/components/selectors/parser.rs +++ b/servo/components/selectors/parser.rs @@ -2018,34 +2018,10 @@ impl<Impl: SelectorImpl> Component<Impl> { } } - /// Whether this component is valid after a pseudo-element. Only intended - /// for sanity-checking. - pub fn maybe_allowed_after_pseudo_element(&self) -> bool { - match *self { - Component::NonTSPseudoClass(..) => true, - Component::Negation(ref selectors) | - Component::Is(ref selectors) | - Component::Where(ref selectors) => selectors.slice().iter().all(|selector| { - selector - .iter_raw_match_order() - .all(|c| c.maybe_allowed_after_pseudo_element()) - }), - _ => false, - } - } - - /// Whether a given selector should match for stateless pseudo-elements. - /// - /// This is a bit subtle: Only selectors that return true in - /// `maybe_allowed_after_pseudo_element` should end up here, and - /// `NonTSPseudoClass` never matches (as it is a stateless pseudo after - /// all). + /// Whether a given selector (to the right of a pseudo-element) should match for stateless + /// pseudo-elements. Note that generally nothing matches for those, but since we have :not(), + /// we still need to traverse nested selector lists. fn matches_for_stateless_pseudo_element(&self) -> bool { - debug_assert!( - self.maybe_allowed_after_pseudo_element(), - "Someone messed up pseudo-element parsing: {:?}", - *self - ); match *self { Component::Negation(ref selectors) => !selectors.slice().iter().all(|selector| { selector |