diff options
author | Alan Jeffrey <ajeffrey@mozilla.com> | 2017-06-14 18:14:54 -0500 |
---|---|---|
committer | Alan Jeffrey <ajeffrey@mozilla.com> | 2017-07-11 17:28:56 -0500 |
commit | ef033b8362b143f3671863313bcd792c4bf17f45 (patch) | |
tree | 24da8ea60c03dc7d8ed07a675dbff79135a07ba8 /components/layout/context.rs | |
parent | de331c6bc8f987521d600043285d32f42be07048 (diff) | |
download | servo-ef033b8362b143f3671863313bcd792c4bf17f45.tar.gz servo-ef033b8362b143f3671863313bcd792c4bf17f45.zip |
Implemented paint worklet properties.
Diffstat (limited to 'components/layout/context.rs')
-rw-r--r-- | components/layout/context.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/components/layout/context.rs b/components/layout/context.rs index d261fe5d8a7..cda3811421a 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -4,6 +4,7 @@ //! Data needed by the layout thread. +use fnv::FnvHashMap; use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}; use gfx::font_cache_thread::FontCacheThread; @@ -15,8 +16,9 @@ use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; use opaque_node::OpaqueNodeMethods; use parking_lot::RwLock; use script_layout_interface::{PendingImage, PendingImageState}; -use script_traits::PaintWorkletExecutor; +use script_traits::Painter; use script_traits::UntrustedNodeAddress; +use servo_atoms::Atom; use servo_url::ServoUrl; use std::cell::{RefCell, RefMut}; use std::collections::HashMap; @@ -24,6 +26,7 @@ use std::hash::BuildHasherDefault; use std::sync::{Arc, Mutex}; use std::thread; use style::context::SharedStyleContext; +use style::properties::PropertyId; thread_local!(static FONT_CONTEXT_KEY: RefCell<Option<FontContext>> = RefCell::new(None)); @@ -69,8 +72,8 @@ pub struct LayoutContext<'a> { WebRenderImageInfo, BuildHasherDefault<FnvHasher>>>>, - /// The executor for worklets - pub paint_worklet_executor: Option<Arc<PaintWorkletExecutor>>, + /// Paint worklets + pub registered_painters: Arc<RwLock<FnvHashMap<Atom, RegisteredPainter>>>, /// A list of in-progress image loads to be shared with the script thread. /// A None value means that this layout was not initiated by the script thread. @@ -175,3 +178,10 @@ impl<'a> LayoutContext<'a> { } } } + +/// A registered paint worklet. +pub struct RegisteredPainter { + pub name: Atom, + pub properties: FnvHashMap<Atom, PropertyId>, + pub painter: Arc<Painter>, +} |