diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-03-23 13:32:49 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-03-31 08:46:11 -0700 |
commit | 66dd8c8a6c5368f3b4d063e25d7a3cbaa4393cb4 (patch) | |
tree | 76205542db731469ad0178ced805b67fb1c3dfbf /components/layout/context.rs | |
parent | c1cc31b9d66f3c61dd0aa7e6a1a43991187d09a5 (diff) | |
download | servo-66dd8c8a6c5368f3b4d063e25d7a3cbaa4393cb4.tar.gz servo-66dd8c8a6c5368f3b4d063e25d7a3cbaa4393cb4.zip |
layout: Implement CSS transitions per CSS-TRANSITIONS § 2.
Transition events are not yet supported, and the only animatable
properties are `top`, `right`, `bottom`, and `left`. However, all other
features of transitions are supported. There are no automated tests at
present because I'm not sure how best to test it, but three manual tests
are included.
Diffstat (limited to 'components/layout/context.rs')
-rw-r--r-- | components/layout/context.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/components/layout/context.rs b/components/layout/context.rs index abb510df0d2..ae1c75e89e6 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -10,19 +10,20 @@ use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache}; use geom::{Rect, Size2D}; use gfx::display_list::OpaqueNode; -use gfx::font_context::FontContext; use gfx::font_cache_task::FontCacheTask; -use script::layout_interface::LayoutChan; -use script_traits::UntrustedNodeAddress; +use gfx::font_context::FontContext; use msg::constellation_msg::ConstellationChan; use net::local_image_cache::LocalImageCache; -use util::geometry::Au; +use script::layout_interface::{Animation, LayoutChan}; +use script_traits::UntrustedNodeAddress; use std::boxed; use std::cell::Cell; use std::ptr; +use std::sync::mpsc::Sender; use std::sync::{Arc, Mutex}; use style::selector_matching::Stylist; use url::Url; +use util::geometry::Au; struct LocalLayoutContext { font_context: FontContext, @@ -32,7 +33,8 @@ struct LocalLayoutContext { thread_local!(static LOCAL_CONTEXT_KEY: Cell<*mut LocalLayoutContext> = Cell::new(ptr::null_mut())); -fn create_or_get_local_context(shared_layout_context: &SharedLayoutContext) -> *mut LocalLayoutContext { +fn create_or_get_local_context(shared_layout_context: &SharedLayoutContext) + -> *mut LocalLayoutContext { LOCAL_CONTEXT_KEY.with(|ref r| { if r.get().is_null() { let context = box LocalLayoutContext { @@ -51,6 +53,7 @@ fn create_or_get_local_context(shared_layout_context: &SharedLayoutContext) -> * }) } +/// Layout information shared among all workers. This must be thread-safe. pub struct SharedLayoutContext { /// The local image cache. pub image_cache: Arc<Mutex<LocalImageCache<UntrustedNodeAddress>>>, @@ -76,7 +79,7 @@ pub struct SharedLayoutContext { pub stylist: *const Stylist, /// The root node at which we're starting the layout. - pub reflow_root: OpaqueNode, + pub reflow_root: Option<OpaqueNode>, /// The URL. pub url: Url, @@ -87,9 +90,14 @@ pub struct SharedLayoutContext { /// Starts at zero, and increased by one every time a layout completes. /// This can be used to easily check for invalid stale data. pub generation: u32, + + /// A channel on which new animations that have been triggered by style recalculation can be + /// sent. + pub new_animations_sender: Sender<Animation>, } pub struct SharedLayoutContextWrapper(pub *const SharedLayoutContext); + unsafe impl Send for SharedLayoutContextWrapper {} pub struct LayoutContext<'a> { |