mirror of
https://github.com/servo/servo.git
synced 2025-08-01 11:40:30 +01:00
Simplify the implementation of NodeIterator::next_child.
This commit is contained in:
parent
cb68fbd68e
commit
68f3daa7ef
1 changed files with 7 additions and 9 deletions
|
@ -1050,15 +1050,13 @@ impl NodeIterator {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_child<'b>(&self, node: JSRef<'b, Node>) -> Option<JSRef<'b, Node>> {
|
fn next_child<'b>(&self, node: JSRef<'b, Node>) -> Option<JSRef<'b, Node>> {
|
||||||
if !self.include_descendants_of_void && node.is_element() {
|
let skip = |element: JSRef<Element>| {
|
||||||
let elem: JSRef<Element> = ElementCast::to_ref(node).unwrap();
|
!self.include_descendants_of_void && element.is_void()
|
||||||
if elem.is_void() {
|
};
|
||||||
None
|
|
||||||
} else {
|
match ElementCast::to_ref(node) {
|
||||||
node.first_child().map(|child| (*child.root()).clone())
|
Some(element) if skip(element) => None,
|
||||||
}
|
_ => node.first_child().map(|child| (*child.root()).clone()),
|
||||||
} else {
|
|
||||||
node.first_child().map(|child| (*child.root()).clone())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue