stylo: don't double check that the root node is dirty in restyle_tree, since now we ensure it in the caller.

This commit is contained in:
Emilio Cobos Álvarez 2016-07-22 16:59:19 -07:00
parent a3020419d9
commit 96ea1a335c
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 16 additions and 10 deletions

View file

@ -148,7 +148,11 @@ pub trait DomTraversalContext<N: TNode> {
/// Process `node` on the way up, after its children have been processed.
fn process_postorder(&self, node: N);
/// Returns if the node should be processed by the preorder traversal.
/// Returns if the node should be processed by the preorder traversal (and
/// then by the post-order one).
///
/// Note that this is true unconditionally for servo, since it requires to
/// bubble the widths bottom-up for all the DOM.
fn should_process(&self, _node: N) -> bool { true }
/// Do an action over the child before pushing him to the work queue.

View file

@ -113,13 +113,13 @@ fn restyle_subtree(node: GeckoNode, raw_data: *mut RawServoStyleSet) {
timer: Timer::new(),
};
if node.is_dirty() || node.has_dirty_descendants() {
if per_doc_data.num_threads == 1 {
sequential::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context);
} else {
parallel::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context,
&mut per_doc_data.work_queue);
}
// We ensure this is true before calling Servo_RestyleSubtree()
debug_assert!(node.is_dirty() || node.has_dirty_descendants());
if per_doc_data.num_threads == 1 {
sequential::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context);
} else {
parallel::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context,
&mut per_doc_data.work_queue);
}
}

View file

@ -36,12 +36,14 @@ impl<'lc, 'ln> DomTraversalContext<GeckoNode<'ln>> for RecalcStyleOnly<'lc> {
recalc_style_at(&self.context, self.root, node);
}
fn process_postorder(&self, _: GeckoNode<'ln>) {}
/// In Gecko we use this traversal just for restyling, so we can stop once
/// we know there aren't more dirty nodes under ourselves.
fn should_process(&self, node: GeckoNode<'ln>) -> bool {
node.is_dirty() || node.has_dirty_descendants()
}
fn process_postorder(&self, _: GeckoNode<'ln>) {}
fn pre_process_child_hook(&self, parent: GeckoNode<'ln>, kid: GeckoNode<'ln>) {
// NOTE: At this point is completely safe to modify either the parent or
// the child, since we have exclusive access to them.