mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Simplify PrecedingNodeIterator::next().
This commit is contained in:
parent
0d732ebb5f
commit
71f56d6744
1 changed files with 11 additions and 25 deletions
|
@ -1166,34 +1166,20 @@ impl Iterator for PrecedingNodeIterator {
|
|||
Some(current) => current,
|
||||
};
|
||||
|
||||
if self.root == current {
|
||||
self.current = None;
|
||||
return None
|
||||
}
|
||||
|
||||
let node = current;
|
||||
if let Some(previous_sibling) = node.GetPreviousSibling() {
|
||||
self.current = if self.root == current {
|
||||
None
|
||||
} else if let Some(previous_sibling) = current.GetPreviousSibling() {
|
||||
if self.root == previous_sibling {
|
||||
self.current = None;
|
||||
return None
|
||||
None
|
||||
} else if let Some(last_child) = previous_sibling.descending_last_children().last() {
|
||||
Some(last_child)
|
||||
} else {
|
||||
Some(previous_sibling)
|
||||
}
|
||||
|
||||
if let Some(last_child) = previous_sibling.descending_last_children().last() {
|
||||
self.current = Some(last_child);
|
||||
return previous_sibling.descending_last_children().last()
|
||||
}
|
||||
|
||||
self.current = Some(previous_sibling);
|
||||
return node.GetPreviousSibling()
|
||||
} else {
|
||||
current.GetParentNode()
|
||||
};
|
||||
|
||||
if let Some(parent_node) = node.GetParentNode() {
|
||||
self.current = Some(parent_node);
|
||||
return node.GetParentNode()
|
||||
}
|
||||
|
||||
self.current = None;
|
||||
None
|
||||
self.current.clone()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue