mirror of
https://github.com/servo/servo.git
synced 2025-10-01 09:09:15 +01:00
Stop using UnsafeNode in the StyleSharingCandidateCache.
This commit is contained in:
parent
c5f01fe3b8
commit
946e7fb7c3
7 changed files with 63 additions and 67 deletions
|
@ -25,13 +25,14 @@ use std::hash::BuildHasherDefault;
|
|||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use style::context::{SharedStyleContext, ThreadLocalStyleContext};
|
||||
use style::dom::TElement;
|
||||
|
||||
/// TLS data scoped to the traversal.
|
||||
pub struct ScopedThreadLocalLayoutContext {
|
||||
pub style_context: ThreadLocalStyleContext,
|
||||
pub struct ScopedThreadLocalLayoutContext<E: TElement> {
|
||||
pub style_context: ThreadLocalStyleContext<E>,
|
||||
}
|
||||
|
||||
impl ScopedThreadLocalLayoutContext {
|
||||
impl<E: TElement> ScopedThreadLocalLayoutContext<E> {
|
||||
pub fn new(shared: &SharedLayoutContext) -> Self {
|
||||
ScopedThreadLocalLayoutContext {
|
||||
style_context: ThreadLocalStyleContext::new(&shared.style_context),
|
||||
|
|
|
@ -54,7 +54,7 @@ impl<N> DomTraversal<N> for RecalcStyleAndConstructFlows
|
|||
where N: LayoutNode + TNode,
|
||||
N::ConcreteElement: TElement
|
||||
{
|
||||
type ThreadLocalContext = ScopedThreadLocalLayoutContext;
|
||||
type ThreadLocalContext = ScopedThreadLocalLayoutContext<N::ConcreteElement>;
|
||||
|
||||
fn process_preorder(&self, traversal_data: &mut PerLevelTraversalData,
|
||||
thread_local: &mut Self::ThreadLocalContext, node: N) {
|
||||
|
@ -115,7 +115,7 @@ pub trait PostorderNodeMutTraversal<ConcreteThreadSafeLayoutNode: ThreadSafeLayo
|
|||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
fn construct_flows_at<'a, N>(context: &LayoutContext<'a>,
|
||||
_thread_local: &ScopedThreadLocalLayoutContext,
|
||||
_thread_local: &ScopedThreadLocalLayoutContext<N::ConcreteElement>,
|
||||
root: OpaqueNode, node: N)
|
||||
where N: LayoutNode,
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue