selectors: Deindent some selector-matching code.

MozReview-Commit-ID: B0ixSTcRS4S
This commit is contained in:
Emilio Cobos Álvarez 2017-10-26 17:21:06 +02:00
parent dd5cd29a61
commit 22dc480272
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -533,10 +533,12 @@ where
return SelectorMatchingResult::NotMatchedAndRestartFromClosestLaterSibling;
}
match combinator {
None => SelectorMatchingResult::Matched,
Some(c) => {
let (mut next_element, candidate_not_found) = match c {
let combinator = match combinator {
None => return SelectorMatchingResult::Matched,
Some(c) => c,
};
let (mut next_element, candidate_not_found) = match combinator {
Combinator::NextSibling | Combinator::LaterSibling => {
// Only ancestor combinators are allowed while looking for
// relevant links, so switch to not looking.
@ -571,33 +573,39 @@ where
flags_setter,
Rightmost::No,
);
match (result, c) {
match (result, combinator) {
// Return the status immediately.
(SelectorMatchingResult::Matched, _) => return result,
(SelectorMatchingResult::NotMatchedGlobally, _) => return result,
(SelectorMatchingResult::Matched, _) |
(SelectorMatchingResult::NotMatchedGlobally, _) |
(_, Combinator::NextSibling) => {
return result;
}
// Upgrade the failure status to
// NotMatchedAndRestartFromClosestDescendant.
(_, Combinator::PseudoElement) |
(_, Combinator::Child) => return SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant,
(_, Combinator::Child) => {
return SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant;
}
// Return the status directly.
(_, Combinator::NextSibling) => return result,
// If the failure status is NotMatchedAndRestartFromClosestDescendant
// and combinator is Combinator::LaterSibling, give up this Combinator::LaterSibling matching
// and restart from the closest descendant combinator.
(SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant, Combinator::LaterSibling)
=> return result,
// If the failure status is
// NotMatchedAndRestartFromClosestDescendant and combinator is
// Combinator::LaterSibling, give up this Combinator::LaterSibling
// matching and restart from the closest descendant combinator.
(SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant, Combinator::LaterSibling) => {
return result;
}
// The Combinator::Descendant combinator and the status is
// NotMatchedAndRestartFromClosestLaterSibling or
// NotMatchedAndRestartFromClosestDescendant,
// or the Combinator::LaterSibling combinator and the status is
// NotMatchedAndRestartFromClosestDescendant
// can continue to matching on the next candidate element.
// NotMatchedAndRestartFromClosestDescendant, or the
// Combinator::LaterSibling combinator and the status is
// NotMatchedAndRestartFromClosestDescendant, we can continue to
// matching on the next candidate element.
_ => {},
}
next_element = if siblings {
element.prev_sibling_element()
} else {
@ -605,8 +613,6 @@ where
};
}
}
}
}
/// Determines whether the given element matches the given single selector.
#[inline]