mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #6778 - nox:childnodes, r=jdm
Optimise Node.childNodes <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6778) <!-- Reviewable:end -->
This commit is contained in:
commit
2b9590c5a5
5 changed files with 253 additions and 32 deletions
|
@ -123,8 +123,7 @@ pub trait ParallelPreorderDomTraversal : PreorderDomTraversal {
|
|||
// Perform the appropriate traversal.
|
||||
self.process(node);
|
||||
|
||||
// NB: O(n).
|
||||
let child_count = node.children().count();
|
||||
let child_count = node.children_count();
|
||||
|
||||
// Reset the count of children.
|
||||
{
|
||||
|
|
|
@ -237,6 +237,10 @@ impl<'ln> LayoutNode<'ln> {
|
|||
self.node.next_sibling_ref().map(|node| self.new_with_this_lifetime(&node))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn children_count(&self) -> u32 {
|
||||
unsafe { self.node.children_count() }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ln> LayoutNode<'ln> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue