mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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.
This commit is contained in:
parent
8f7f62f810
commit
c5f01fe3b8
16 changed files with 212 additions and 205 deletions
|
@ -6,8 +6,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use construct::ConstructionResult;
|
||||
use context::SharedLayoutContext;
|
||||
use context::create_or_get_local_context;
|
||||
use context::{ScopedThreadLocalLayoutContext, SharedLayoutContext};
|
||||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
use euclid::size::Size2D;
|
||||
|
@ -646,10 +645,10 @@ pub fn process_resolved_style_request<'a, N>(shared: &SharedLayoutContext,
|
|||
// we'd need a mechanism to prevent detect when it's stale (since we don't
|
||||
// traverse display:none subtrees during restyle).
|
||||
let display_none_root = if element.get_data().is_none() {
|
||||
let tlc = create_or_get_local_context(shared);
|
||||
let mut tlc = ScopedThreadLocalLayoutContext::new(shared);
|
||||
let context = StyleContext {
|
||||
shared: &shared.style_context,
|
||||
thread_local: &tlc.style_context,
|
||||
thread_local: &mut tlc.style_context,
|
||||
};
|
||||
|
||||
Some(style_element_in_display_none_subtree(&context, element,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue