mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Implemented the plumbing for paint worklets.
This commit is contained in:
parent
7e273d6c9b
commit
fd17dcd604
23 changed files with 600 additions and 156 deletions
|
@ -51,6 +51,7 @@ use dom::storage::Storage;
|
|||
use dom::testrunner::TestRunner;
|
||||
use dom::windowproxy::WindowProxy;
|
||||
use dom::worklet::Worklet;
|
||||
use dom::workletglobalscope::WorkletGlobalScopeType;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
use fetch;
|
||||
|
@ -279,6 +280,8 @@ pub struct Window {
|
|||
|
||||
/// Worklets
|
||||
test_worklet: MutNullableJS<Worklet>,
|
||||
/// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet
|
||||
paint_worklet: MutNullableJS<Worklet>,
|
||||
}
|
||||
|
||||
impl Window {
|
||||
|
@ -373,6 +376,14 @@ impl Window {
|
|||
self.webvr_thread.clone()
|
||||
}
|
||||
|
||||
fn new_paint_worklet(&self) -> Root<Worklet> {
|
||||
debug!("Creating new paint worklet.");
|
||||
let worklet = Worklet::new(self, WorkletGlobalScopeType::Paint);
|
||||
let executor = Arc::new(worklet.executor());
|
||||
let _ = self.layout_chan.send(Msg::SetPaintWorkletExecutor(executor));
|
||||
worklet
|
||||
}
|
||||
|
||||
pub fn permission_state_invocation_results(&self) -> &DOMRefCell<HashMap<String, PermissionState>> {
|
||||
&self.permission_state_invocation_results
|
||||
}
|
||||
|
@ -1011,6 +1022,11 @@ impl WindowMethods for Window {
|
|||
fetch::Fetch(&self.upcast(), input, init)
|
||||
}
|
||||
|
||||
// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet
|
||||
fn PaintWorklet(&self) -> Root<Worklet> {
|
||||
self.paint_worklet.or_init(|| self.new_paint_worklet())
|
||||
}
|
||||
|
||||
fn TestRunner(&self) -> Root<TestRunner> {
|
||||
self.test_runner.or_init(|| TestRunner::new(self.upcast()))
|
||||
}
|
||||
|
@ -1856,6 +1872,7 @@ impl Window {
|
|||
pending_layout_images: DOMRefCell::new(HashMap::new()),
|
||||
unminified_js_dir: DOMRefCell::new(None),
|
||||
test_worklet: Default::default(),
|
||||
paint_worklet: Default::default(),
|
||||
};
|
||||
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue