diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-04-17 13:37:59 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-04-18 03:48:15 +0200 |
commit | 83ea321096d7afc7b92c2bacd98aabbb8ca96d06 (patch) | |
tree | 5bc005e62d10d2f4e285ec4a9d30f8c2f47e5779 /components/selectors/matching.rs | |
parent | 66f14773c6c0ded0634751e1ada6fdf5c6ca8d69 (diff) | |
download | servo-83ea321096d7afc7b92c2bacd98aabbb8ca96d06.tar.gz servo-83ea321096d7afc7b92c2bacd98aabbb8ca96d06.zip |
style: Implement parsing / selector-matching for :is() and :where().
This implements the easy / straight-forward parts of the :where / :is
selectors.
The biggest missing piece is to handle properly invalidation when there
are combinators present inside the :where. That's the hard part of this,
actually.
But this is probably worth landing in the interim. This fixes some of
the visitors that were easy to fix.
Differential Revision: https://phabricator.services.mozilla.com/D70788
Diffstat (limited to 'components/selectors/matching.rs')
-rw-r--r-- | components/selectors/matching.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs index e8fd8afebca..d8d4ad59946 100644 --- a/components/selectors/matching.rs +++ b/components/selectors/matching.rs @@ -851,6 +851,14 @@ where matches_generic_nth_child(element, context, 0, 1, true, false, flags_setter) && matches_generic_nth_child(element, context, 0, 1, true, true, flags_setter) }, + Component::Is(ref list) | Component::Where(ref list) => context.shared.nest(|context| { + for selector in &**list { + if matches_complex_selector(selector.iter(), element, context, flags_setter) { + return true; + } + } + false + }), Component::Negation(ref negated) => context.shared.nest_for_negation(|context| { let mut local_context = LocalMatchingContext { matches_hover_and_active_quirk: MatchesHoverAndActiveQuirk::No, |