Remove the ComputedValue traits and style_struct_traits

This commit is contained in:
Simon Sapin 2016-07-19 20:29:22 +02:00
parent b2a7e44373
commit 789807b7b0
60 changed files with 589 additions and 652 deletions

View file

@ -18,12 +18,12 @@ use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex, RwLock};
/// This structure is used to create a local style context from a shared one.
pub struct LocalStyleContextCreationInfo<Impl: SelectorImplExt> {
new_animations_sender: Sender<Animation<Impl>>,
pub struct LocalStyleContextCreationInfo {
new_animations_sender: Sender<Animation>,
}
impl<Impl: SelectorImplExt> LocalStyleContextCreationInfo<Impl> {
pub fn new(animations_sender: Sender<Animation<Impl>>) -> Self {
impl LocalStyleContextCreationInfo {
pub fn new(animations_sender: Sender<Animation>) -> Self {
LocalStyleContextCreationInfo {
new_animations_sender: animations_sender,
}
@ -48,28 +48,28 @@ pub struct SharedStyleContext<Impl: SelectorImplExt> {
pub goal: ReflowGoal,
/// The animations that are currently running.
pub running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation<Impl>>>>>,
pub running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
/// The list of animations that have expired since the last style recalculation.
pub expired_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation<Impl>>>>>,
pub expired_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
///The CSS error reporter for all CSS loaded in this layout thread
pub error_reporter: Box<ParseErrorReporter + Sync>,
/// Data needed to create the local style context from the shared one.
pub local_context_creation_data: Mutex<LocalStyleContextCreationInfo<Impl>>,
pub local_context_creation_data: Mutex<LocalStyleContextCreationInfo>,
}
pub struct LocalStyleContext<Impl: SelectorImplExt> {
pub applicable_declarations_cache: RefCell<ApplicableDeclarationsCache<Impl::ComputedValues>>,
pub style_sharing_candidate_cache: RefCell<StyleSharingCandidateCache<Impl::ComputedValues>>,
pub struct LocalStyleContext {
pub applicable_declarations_cache: RefCell<ApplicableDeclarationsCache>,
pub style_sharing_candidate_cache: RefCell<StyleSharingCandidateCache>,
/// A channel on which new animations that have been triggered by style
/// recalculation can be sent.
pub new_animations_sender: Sender<Animation<Impl>>,
pub new_animations_sender: Sender<Animation>,
}
impl<Impl: SelectorImplExt> LocalStyleContext<Impl> {
pub fn new(local_context_creation_data: &LocalStyleContextCreationInfo<Impl>) -> Self {
impl LocalStyleContext {
pub fn new(local_context_creation_data: &LocalStyleContextCreationInfo) -> Self {
LocalStyleContext {
applicable_declarations_cache: RefCell::new(ApplicableDeclarationsCache::new()),
style_sharing_candidate_cache: RefCell::new(StyleSharingCandidateCache::new()),
@ -80,7 +80,7 @@ impl<Impl: SelectorImplExt> LocalStyleContext<Impl> {
pub trait StyleContext<'a, Impl: SelectorImplExt> {
fn shared_context(&self) -> &'a SharedStyleContext<Impl>;
fn local_context(&self) -> &LocalStyleContext<Impl>;
fn local_context(&self) -> &LocalStyleContext;
}
/// Why we're doing reflow.