diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-06-07 11:57:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-07 11:57:07 -0700 |
commit | bf46da065db58549a74c489d521f9375f4137637 (patch) | |
tree | f13d373c0cde75888eaba2c1db38dc04129669b3 /components/script/dom/window.rs | |
parent | eaefcbe55186b874b96c6dffc7e8dd2b6283634d (diff) | |
parent | fd17dcd60442e71f75010a34c6bcfe1c04aca3e5 (diff) | |
download | servo-bf46da065db58549a74c489d521f9375f4137637.tar.gz servo-bf46da065db58549a74c489d521f9375f4137637.zip |
Auto merge of #17150 - asajeffrey:script-paint-worklets-plumbing, r=jdm
Implemented the plumbing for paint worklets
<!-- Please describe your changes on the following line: -->
This PR implements the plumbing for paint worklets:
* Adding CSS values for paint worklets.
* Implementing a skeleton for the `PaintWorkletGlobalScope` webidl.
* Implementing an executor for paint worklet tasks, and passing it from script to layout.
* Building the display list items for paint worklet images.
This PR does not implement registering or calling paint worklets in JS.
Before it merges, this PR needs a reftest added for basic paint worklet functionality.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] There are tests for these changes
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17150)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index fc793c206c4..e627721bd05 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -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 { |