mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Speculatively evaluate paint functions during style.
This commit is contained in:
parent
b35791f86f
commit
936dd3ef63
13 changed files with 279 additions and 52 deletions
|
@ -18,10 +18,12 @@ use font_metrics::FontMetricsProvider;
|
|||
#[cfg(feature = "gecko")] use gecko_bindings::structs;
|
||||
#[cfg(feature = "servo")] use parking_lot::RwLock;
|
||||
use properties::ComputedValues;
|
||||
#[cfg(feature = "servo")] use properties::PropertyId;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{EAGER_PSEUDO_COUNT, SnapshotMap};
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
use servo_arc::Arc;
|
||||
#[cfg(feature = "servo")] use servo_atoms::Atom;
|
||||
use shared_lock::StylesheetGuards;
|
||||
use sharing::StyleSharingCandidateCache;
|
||||
use std::fmt;
|
||||
|
@ -30,6 +32,7 @@ use std::ops;
|
|||
#[cfg(feature = "servo")] use std::sync::mpsc::Sender;
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::DevicePixel;
|
||||
#[cfg(feature = "servo")] use style_traits::SpeculativePainter;
|
||||
use stylist::Stylist;
|
||||
use thread_state;
|
||||
use time;
|
||||
|
@ -151,6 +154,10 @@ pub struct SharedStyleContext<'a> {
|
|||
#[cfg(feature = "servo")]
|
||||
pub expired_animations: Arc<RwLock<FnvHashMap<OpaqueNode, Vec<Animation>>>>,
|
||||
|
||||
/// Paint worklets
|
||||
#[cfg(feature = "servo")]
|
||||
pub registered_speculative_painters: &'a RegisteredSpeculativePainters,
|
||||
|
||||
/// Data needed to create the thread-local style context from the shared one.
|
||||
#[cfg(feature = "servo")]
|
||||
pub local_context_creation_data: Mutex<ThreadLocalStyleContextCreationInfo>,
|
||||
|
@ -677,3 +684,19 @@ pub enum ReflowGoal {
|
|||
/// We're reflowing in order to satisfy a script query. No display list will be created.
|
||||
ForScriptQuery,
|
||||
}
|
||||
|
||||
/// A registered painter
|
||||
#[cfg(feature = "servo")]
|
||||
pub trait RegisteredSpeculativePainter: SpeculativePainter {
|
||||
/// The name it was registered with
|
||||
fn name(&self) -> Atom;
|
||||
/// The properties it was registered with
|
||||
fn properties(&self) -> &FnvHashMap<Atom, PropertyId>;
|
||||
}
|
||||
|
||||
/// A set of registered painters
|
||||
#[cfg(feature = "servo")]
|
||||
pub trait RegisteredSpeculativePainters: Sync {
|
||||
/// Look up a speculative painter
|
||||
fn get(&self, name: &Atom) -> Option<&RegisteredSpeculativePainter>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue