Speculatively evaluate paint functions during style.

This commit is contained in:
Alan Jeffrey 2017-07-18 14:57:22 -05:00
parent b35791f86f
commit 936dd3ef63
13 changed files with 279 additions and 52 deletions

View file

@ -66,6 +66,7 @@ use std::fmt;
use std::sync::Arc;
use std::sync::mpsc::{Receiver, Sender, RecvTimeoutError};
use style_traits::CSSPixel;
use style_traits::SpeculativePainter;
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
use webrender_api::{ClipId, DevicePixel, ImageKey};
use webvr_traits::{WebVREvent, WebVRMsg};
@ -817,7 +818,7 @@ impl From<RecvTimeoutError> for PaintWorkletError {
}
/// Execute paint code in the worklet thread pool.
pub trait Painter: Sync + Send {
pub trait Painter: SpeculativePainter {
/// https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image
fn draw_a_paint_image(&self,
size: TypedSize2D<f32, CSSPixel>,
@ -829,7 +830,7 @@ pub trait Painter: Sync + Send {
/// The result of executing paint code: the image together with any image URLs that need to be loaded.
/// TODO: this should return a WR display list. https://github.com/servo/servo/issues/17497
#[derive(Debug, Deserialize, Serialize, Clone)]
#[derive(Debug, Deserialize, Serialize, Clone, HeapSizeOf)]
pub struct DrawAPaintImageResult {
/// The image height
pub width: u32,