diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2017-07-26 13:13:00 -0700 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2017-08-11 10:53:08 -0700 |
commit | f4ccbf36877ea9628c92a5a274b466409dbde15e (patch) | |
tree | e595e4e70a6555ba37b9641e8b188ccfe443279f /components/style/parallel.rs | |
parent | 32790be78d5e65152416c304fdf6f62eba05c924 (diff) | |
download | servo-f4ccbf36877ea9628c92a5a274b466409dbde15e.tar.gz servo-f4ccbf36877ea9628c92a5a274b466409dbde15e.zip |
Hoist StyleNew{Children,Subtree} into their own paths.
The buggy animation handling isn't a regression, since currently we pass
UnstyledChildrenOnly in those cases, which blocks the animation traversal
in Servo_TraverseSubtree.
In general I really wanted to handle these two paths together. But there's
enough broken with the NewChildren path that I wanted to scope the buginess
as tightly as possible. And I really need to separate the handling here from
StyleDocument() to make the restyle root stuff work.
MozReview-Commit-ID: 9F0mcQl7AAX
Diffstat (limited to 'components/style/parallel.rs')
-rw-r--r-- | components/style/parallel.rs | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/components/style/parallel.rs b/components/style/parallel.rs index 3703559cd98..db5466e12a3 100644 --- a/components/style/parallel.rs +++ b/components/style/parallel.rs @@ -59,47 +59,26 @@ pub fn traverse_dom<E, D>(traversal: &D, where E: TElement, D: DomTraversal<E>, { - let dump_stats = traversal.shared_context().options.dump_style_statistics; - let start_time = if dump_stats { Some(time::precise_time_s()) } else { None }; - - // Set up the SmallVec. We need to move this, and in most cases this is just - // one node, so keep it small. - let mut nodes = SmallVec::<[SendNode<E::ConcreteNode>; 8]>::new(); - debug_assert!(traversal.is_parallel()); - // Handle Gecko's eager initial styling. We don't currently support it - // in conjunction with bottom-up traversal. If we did, we'd need to put - // it on the context to make it available to the bottom-up phase. - let depth = if token.traverse_unstyled_children_only() { - debug_assert!(!D::needs_postorder_traversal()); - for kid in root.as_node().traversal_children() { - if kid.as_element().map_or(false, |el| el.get_data().is_none()) { - nodes.push(unsafe { SendNode::new(kid) }); - } - } - root.depth() + 1 - } else { - nodes.push(unsafe { SendNode::new(root.as_node()) }); - root.depth() - }; + debug_assert!(token.should_traverse()); - if nodes.is_empty() { - return; - } + let dump_stats = traversal.shared_context().options.dump_style_statistics; + let start_time = if dump_stats { Some(time::precise_time_s()) } else { None }; let traversal_data = PerLevelTraversalData { - current_dom_depth: depth, + current_dom_depth: root.depth(), }; let tls = ScopedTLS::<ThreadLocalStyleContext<E>>::new(pool); - let root = root.as_node().opaque(); + let send_root = unsafe { SendNode::new(root.as_node()) }; pool.install(|| { rayon::scope(|scope| { - let nodes = nodes; - traverse_nodes(&*nodes, + let root = send_root; + let root_opaque = root.opaque(); + traverse_nodes(&[root], DispatchMode::TailCall, 0, - root, + root_opaque, traversal_data, scope, pool, |