diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2016-12-16 11:50:11 -0800 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2016-12-21 11:10:39 -0800 |
commit | c5f01fe3b89c2a381fb891e9728fa2951b87a747 (patch) | |
tree | cca5add7c82e7f24255f4706696c02f2ed5bce3f /components/layout/sequential.rs | |
parent | 8f7f62f8104bf576c38f7cfa1fedfaf2c51c0049 (diff) | |
download | servo-c5f01fe3b89c2a381fb891e9728fa2951b87a747.tar.gz servo-c5f01fe3b89c2a381fb891e9728fa2951b87a747.zip |
Introduce and use Scoped TLS.
It turns out that it's problematic to embed ThreadLocalStyleContext within
LayoutContext, because parameterizing the former on TElement (which we do
in the next patch) infects all the traversal stuff with the trait parameters,
which we don't really want.
In general, it probably makes sense to use separate scoped TLS types for
the separate DOM and Flow tree passes, so we can add a different ScopedTLS
type for the Flow pass if we ever need it.
We also reorder the |scope| and |shared| parameters in parallel.rs, because
it aligns more with the order in style/parallel.rs. I did this when I was
adding a TLS parameter to all these functions, which I realized we don't need
for now.
Diffstat (limited to 'components/layout/sequential.rs')
-rw-r--r-- | components/layout/sequential.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index e5f62fe1cea..b8c62aaafb0 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -5,7 +5,7 @@ //! Implements sequential traversals over the DOM and flow trees. use app_units::Au; -use context::{LayoutContext, SharedLayoutContext, ThreadLocalLayoutContext}; +use context::{LayoutContext, SharedLayoutContext}; use display_list_builder::DisplayListBuildState; use euclid::point::Point2D; use floats::SpeculatedFloatPlacement; @@ -34,8 +34,7 @@ pub fn resolve_generated_content(root: &mut Flow, shared: &SharedLayoutContext) } } - let tlc = ThreadLocalLayoutContext::new(shared); - let layout_context = LayoutContext::new(shared, &*tlc); + let layout_context = LayoutContext::new(shared); let mut traversal = ResolveGeneratedContent::new(&layout_context); doit(root, 0, &mut traversal) } @@ -58,8 +57,7 @@ pub fn traverse_flow_tree_preorder(root: &mut Flow, } } - let tlc = ThreadLocalLayoutContext::new(shared); - let layout_context = LayoutContext::new(shared, &*tlc); + let layout_context = LayoutContext::new(shared); if opts::get().bubble_inline_sizes_separately { let bubble_inline_sizes = BubbleISizes { layout_context: &layout_context }; |