mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +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.nth_data(),
|
||||||
nth_of_data.selectors(),
|
nth_of_data.selectors(),
|
||||||
),
|
),
|
||||||
Component::Is(ref list) | Component::Where(ref list) => context.shared.nest(|context| {
|
Component::Is(ref list) | Component::Where(ref list) => context
|
||||||
for selector in &**list {
|
.shared
|
||||||
if matches_complex_selector(selector.iter(), element, context) {
|
.nest(|context| list_matches_complex_selector(list, element, context)),
|
||||||
return true;
|
Component::Negation(ref list) => context
|
||||||
}
|
.shared
|
||||||
}
|
.nest_for_negation(|context| !list_matches_complex_selector(list, element, context)),
|
||||||
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::Has(ref list) => context
|
Component::Has(ref list) => context
|
||||||
.shared
|
.shared
|
||||||
.nest(|context| has_children_matching(list, element, context)),
|
.nest(|context| has_children_matching(list, element, context)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue