From ef033b8362b143f3671863313bcd792c4bf17f45 Mon Sep 17 00:00:00 2001 From: Alan Jeffrey Date: Wed, 14 Jun 2017 18:14:54 -0500 Subject: Implemented paint worklet properties. --- components/layout/context.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'components/layout/context.rs') 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> = RefCell::new(None)); @@ -69,8 +72,8 @@ pub struct LayoutContext<'a> { WebRenderImageInfo, BuildHasherDefault>>>, - /// The executor for worklets - pub paint_worklet_executor: Option>, + /// Paint worklets + pub registered_painters: Arc>>, /// 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, + pub painter: Arc, +} -- cgit v1.2.3