diff options
Diffstat (limited to 'components/style/context.rs')
-rw-r--r-- | components/style/context.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/components/style/context.rs b/components/style/context.rs index 44485915c2c..93dfde0932b 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -17,6 +17,7 @@ use parking_lot::RwLock; use selector_parser::PseudoElement; use selectors::matching::ElementSelectorFlags; use servo_config::opts; +use shared_lock::ReadGuards; use std::collections::HashMap; use std::env; use std::fmt; @@ -61,10 +62,13 @@ pub enum QuirksMode { /// /// There's exactly one of these during a given restyle traversal, and it's /// shared among the worker threads. -pub struct SharedStyleContext { +pub struct SharedStyleContext<'a> { /// The CSS selector stylist. pub stylist: Arc<Stylist>, + /// Guards for pre-acquired locks + pub guards: ReadGuards<'a>, + /// The animations that are currently running. pub running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>, @@ -85,7 +89,7 @@ pub struct SharedStyleContext { pub quirks_mode: QuirksMode, } -impl SharedStyleContext { +impl<'a> SharedStyleContext<'a> { /// Return a suitable viewport size in order to be used for viewport units. pub fn viewport_size(&self) -> Size2D<Au> { self.stylist.device.au_viewport_size() @@ -306,7 +310,7 @@ impl<E: TElement> Drop for ThreadLocalStyleContext<E> { /// shared style context, and a mutable reference to a local one. pub struct StyleContext<'a, E: TElement + 'a> { /// The shared style context reference. - pub shared: &'a SharedStyleContext, + pub shared: &'a SharedStyleContext<'a>, /// The thread-local style context (mutable) reference. pub thread_local: &'a mut ThreadLocalStyleContext<E>, } |