mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
style: Reuse list_matches_complex_selector() where possible
It can be reused for the Is, Where, and Negation components. Differential Revision: https://phabricator.services.mozilla.com/D166267
This commit is contained in:
parent
93de6edbc9
commit
fa297196ef
1 changed files with 6 additions and 16 deletions
|
@ -824,22 +824,12 @@ where
|
|||
nth_of_data.nth_data(),
|
||||
nth_of_data.selectors(),
|
||||
),
|
||||
Component::Is(ref list) | Component::Where(ref list) => context.shared.nest(|context| {
|
||||
for selector in &**list {
|
||||
if matches_complex_selector(selector.iter(), element, context) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}),
|
||||
Component::Negation(ref list) => context.shared.nest_for_negation(|context| {
|
||||
for selector in &**list {
|
||||
if matches_complex_selector(selector.iter(), element, context) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
true
|
||||
}),
|
||||
Component::Is(ref list) | Component::Where(ref list) => context
|
||||
.shared
|
||||
.nest(|context| list_matches_complex_selector(list, element, context)),
|
||||
Component::Negation(ref list) => context
|
||||
.shared
|
||||
.nest_for_negation(|context| !list_matches_complex_selector(list, element, context)),
|
||||
Component::Has(ref list) => context
|
||||
.shared
|
||||
.nest(|context| has_children_matching(list, element, context)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue