mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Remove a few more unuseful traversals now we can.
This commit is contained in:
parent
354dc66029
commit
c3a727ebda
5 changed files with 64 additions and 73 deletions
|
@ -1287,6 +1287,31 @@ impl TreeIterator {
|
|||
depth: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn next_skipping_children(&mut self) -> Option<Root<Node>> {
|
||||
let current = match self.current.take() {
|
||||
None => return None,
|
||||
Some(current) => current,
|
||||
};
|
||||
|
||||
self.next_skipping_children_impl(current)
|
||||
}
|
||||
|
||||
fn next_skipping_children_impl(&mut self, current: Root<Node>) -> Option<Root<Node>> {
|
||||
for ancestor in current.inclusive_ancestors() {
|
||||
if self.depth == 0 {
|
||||
break;
|
||||
}
|
||||
if let Some(next_sibling) = ancestor.GetNextSibling() {
|
||||
self.current = Some(next_sibling);
|
||||
return Some(current);
|
||||
}
|
||||
self.depth -= 1;
|
||||
}
|
||||
debug_assert!(self.depth == 0);
|
||||
self.current = None;
|
||||
Some(current)
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for TreeIterator {
|
||||
|
@ -1303,19 +1328,8 @@ impl Iterator for TreeIterator {
|
|||
self.depth += 1;
|
||||
return Some(current);
|
||||
};
|
||||
for ancestor in current.inclusive_ancestors() {
|
||||
if self.depth == 0 {
|
||||
break;
|
||||
}
|
||||
if let Some(next_sibling) = ancestor.GetNextSibling() {
|
||||
self.current = Some(next_sibling);
|
||||
return Some(current);
|
||||
}
|
||||
self.depth -= 1;
|
||||
}
|
||||
debug_assert!(self.depth == 0);
|
||||
self.current = None;
|
||||
Some(current)
|
||||
|
||||
self.next_skipping_children_impl(current)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,15 +199,6 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
|
|||
self.node.set_flag(DIRTY_ON_VIEWPORT_SIZE_CHANGE, true);
|
||||
}
|
||||
|
||||
fn set_descendants_dirty_on_viewport_size_changed(&self) {
|
||||
for ref child in self.children() {
|
||||
unsafe {
|
||||
child.set_dirty_on_viewport_size_changed();
|
||||
}
|
||||
child.set_descendants_dirty_on_viewport_size_changed();
|
||||
}
|
||||
}
|
||||
|
||||
fn can_be_fragmented(&self) -> bool {
|
||||
unsafe { self.node.get_flag(CAN_BE_FRAGMENTED) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue