diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2017-07-05 14:19:37 -0700 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2017-07-05 16:37:17 -0700 |
commit | 3330653dc80cc8947af17f1989fb7fbf390c4d2f (patch) | |
tree | 85556e4b7c09512eb64519fa6fa7675e52eb532a /components/layout/context.rs | |
parent | 296a215e5404eb0fd0c0a34cc1283cd0b84aaea9 (diff) | |
download | servo-3330653dc80cc8947af17f1989fb7fbf390c4d2f.tar.gz servo-3330653dc80cc8947af17f1989fb7fbf390c4d2f.zip |
Rip out the generic abstractions around ThreadLocalStyleContext.
MozReview-Commit-ID: 5WTLuk323Ac
Diffstat (limited to 'components/layout/context.rs')
-rw-r--r-- | components/layout/context.rs | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/components/layout/context.rs b/components/layout/context.rs index 22b407d1fb6..d261fe5d8a7 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -18,39 +18,12 @@ use script_layout_interface::{PendingImage, PendingImageState}; use script_traits::PaintWorkletExecutor; use script_traits::UntrustedNodeAddress; use servo_url::ServoUrl; -use std::borrow::{Borrow, BorrowMut}; use std::cell::{RefCell, RefMut}; use std::collections::HashMap; use std::hash::BuildHasherDefault; use std::sync::{Arc, Mutex}; use std::thread; -use style::context::{SharedStyleContext, ThreadLocalStyleContext}; -use style::dom::TElement; - -/// TLS data scoped to the traversal. -pub struct ScopedThreadLocalLayoutContext<E: TElement> { - pub style_context: ThreadLocalStyleContext<E>, -} - -impl<E: TElement> ScopedThreadLocalLayoutContext<E> { - pub fn new(context: &LayoutContext) -> Self { - ScopedThreadLocalLayoutContext { - style_context: ThreadLocalStyleContext::new(&context.style_context), - } - } -} - -impl<E: TElement> Borrow<ThreadLocalStyleContext<E>> for ScopedThreadLocalLayoutContext<E> { - fn borrow(&self) -> &ThreadLocalStyleContext<E> { - &self.style_context - } -} - -impl<E: TElement> BorrowMut<ThreadLocalStyleContext<E>> for ScopedThreadLocalLayoutContext<E> { - fn borrow_mut(&mut self) -> &mut ThreadLocalStyleContext<E> { - &mut self.style_context - } -} +use style::context::SharedStyleContext; thread_local!(static FONT_CONTEXT_KEY: RefCell<Option<FontContext>> = RefCell::new(None)); |