mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Rip out the generic abstractions around ThreadLocalStyleContext.
MozReview-Commit-ID: 5WTLuk323Ac
This commit is contained in:
parent
296a215e54
commit
3330653dc8
7 changed files with 52 additions and 102 deletions
|
@ -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));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue