diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-01-23 19:55:06 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-01-24 08:41:29 +0100 |
commit | f00b628c3abf07b46d544e2f82fdd24602195f7a (patch) | |
tree | 0313e601161c22c58626b951d6a7092fb63097f3 /components/layout_thread/lib.rs | |
parent | 7e2329ea4eb81f9153a64f63264ebb29d771e82d (diff) | |
download | servo-f00b628c3abf07b46d544e2f82fdd24602195f7a.tar.gz servo-f00b628c3abf07b46d544e2f82fdd24602195f7a.zip |
style: Expose the traversal kind to the style system.
This way we'll be able to take different paths for the sequential and parallel
traversals in some concrete cases.
This is a preliminar patch to fix bug 1332525.
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r-- | components/layout_thread/lib.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 5d0524925a5..a2eea76bba0 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -124,7 +124,7 @@ use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets}; use style::stylist::Stylist; use style::thread_state; use style::timer::Timer; -use style::traversal::DomTraversal; +use style::traversal::{DomTraversal, TraversalDriver}; /// Information needed by the layout thread. pub struct LayoutThread { @@ -1173,7 +1173,13 @@ impl LayoutThread { data.reflow_info.goal); // NB: Type inference falls apart here for some reason, so we need to be very verbose. :-( - let traversal = RecalcStyleAndConstructFlows::new(shared_layout_context); + let traversal_driver = if self.parallel_flag && self.parallel_traversal.is_some() { + TraversalDriver::Parallel + } else { + TraversalDriver::Sequential + }; + + let traversal = RecalcStyleAndConstructFlows::new(shared_layout_context, traversal_driver); let dom_depth = Some(0); // This is always the root node. let token = { let stylist = &<RecalcStyleAndConstructFlows as @@ -1189,7 +1195,8 @@ impl LayoutThread { self.time_profiler_chan.clone(), || { // Perform CSS selector matching and flow construction. - if let (true, Some(pool)) = (self.parallel_flag, self.parallel_traversal.as_mut()) { + if traversal_driver.is_parallel() { + let pool = self.parallel_traversal.as_mut().unwrap(); // Parallel mode parallel::traverse_dom::<ServoLayoutElement, RecalcStyleAndConstructFlows>( &traversal, element, dom_depth, token, pool); |