mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
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:
parent
a3020419d9
commit
96ea1a335c
3 changed files with 16 additions and 10 deletions
|
@ -148,7 +148,11 @@ pub trait DomTraversalContext<N: TNode> {
|
||||||
/// Process `node` on the way up, after its children have been processed.
|
/// Process `node` on the way up, after its children have been processed.
|
||||||
fn process_postorder(&self, node: N);
|
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 }
|
fn should_process(&self, _node: N) -> bool { true }
|
||||||
|
|
||||||
/// Do an action over the child before pushing him to the work queue.
|
/// Do an action over the child before pushing him to the work queue.
|
||||||
|
|
|
@ -113,13 +113,13 @@ fn restyle_subtree(node: GeckoNode, raw_data: *mut RawServoStyleSet) {
|
||||||
timer: Timer::new(),
|
timer: Timer::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if node.is_dirty() || node.has_dirty_descendants() {
|
// We ensure this is true before calling Servo_RestyleSubtree()
|
||||||
if per_doc_data.num_threads == 1 {
|
debug_assert!(node.is_dirty() || node.has_dirty_descendants());
|
||||||
sequential::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context);
|
if per_doc_data.num_threads == 1 {
|
||||||
} else {
|
sequential::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context);
|
||||||
parallel::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context,
|
} else {
|
||||||
&mut per_doc_data.work_queue);
|
parallel::traverse_dom::<GeckoNode, RecalcStyleOnly>(node, &shared_style_context,
|
||||||
}
|
&mut per_doc_data.work_queue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,14 @@ impl<'lc, 'ln> DomTraversalContext<GeckoNode<'ln>> for RecalcStyleOnly<'lc> {
|
||||||
recalc_style_at(&self.context, self.root, node);
|
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 {
|
fn should_process(&self, node: GeckoNode<'ln>) -> bool {
|
||||||
node.is_dirty() || node.has_dirty_descendants()
|
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>) {
|
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
|
// NOTE: At this point is completely safe to modify either the parent or
|
||||||
// the child, since we have exclusive access to them.
|
// the child, since we have exclusive access to them.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue