servo: Merge #17364 - Implement paint worklet properties (from asajeffrey:script-paint-worklets-properties); r=jdm

<!-- Please describe your changes on the following line: -->

This is the final PR to get basic paint worklet support. It adds support for paint worklet properties (https://drafts.css-houdini.org/css-paint-api/#paint-definition-input-properties). When a paint worklet is registered, it specifies a list of CSS properties, and is provided with their computed values when it is invoked.

This is a dependent PR:
* "Implemented paint worklets invoking worklet scripts" is #17239.
* "Implemented paint worklets rendering contexts" is #17326.

There should be tests added for this, hopefully the existing wpt houdini tests.

---
<!-- 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
- [X] These changes fix #16839
- [x] 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. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: bc44246fc682d9f2362eaca6bba07b45c293eb42
This commit is contained in:
Alan Jeffrey
2017-07-11 16:24:18 -07:00
parent 14448329bc
commit fe03dc44ca
23 changed files with 344 additions and 102 deletions

View File

@@ -79,7 +79,7 @@ use net_traits::request::{CredentialsMode, Destination, RedirectMode, RequestIni
use net_traits::storage_thread::StorageType;
use profile_traits::mem::{self, OpaqueSender, Report, ReportKind, ReportsChan};
use profile_traits::time::{self, ProfilerCategory, profile};
use script_layout_interface::message::{self, NewLayoutThreadInfo, ReflowQueryType};
use script_layout_interface::message::{self, Msg, NewLayoutThreadInfo, ReflowQueryType};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use script_runtime::{ScriptPort, StackRootTLS, get_reports, new_rt_and_cx};
use script_traits::{CompositorEvent, ConstellationControlMsg};
@@ -718,8 +718,8 @@ impl ScriptThread {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };
script_thread.worklet_thread_pool.borrow_mut().get_or_insert_with(|| {
let chan = script_thread.chan.0.clone();
let init = WorkletGlobalScopeInit {
script_sender: script_thread.chan.0.clone(),
resource_threads: script_thread.resource_threads.clone(),
mem_profiler_chan: script_thread.mem_profiler_chan.clone(),
time_profiler_chan: script_thread.time_profiler_chan.clone(),
@@ -728,11 +728,20 @@ impl ScriptThread {
scheduler_chan: script_thread.scheduler_chan.clone(),
image_cache: script_thread.image_cache.clone(),
};
Rc::new(WorkletThreadPool::spawn(chan, init))
Rc::new(WorkletThreadPool::spawn(init))
}).clone()
})
}
pub fn send_to_layout(&self, pipeline_id: PipelineId, msg: Msg) {
let window = self.documents.borrow().find_window(pipeline_id);
let window = match window {
Some(window) => window,
None => return warn!("Message sent to layout after pipeline {} closed.", pipeline_id),
};
let _ = window.layout_chan().send(msg);
}
/// Creates a new script thread.
pub fn new(state: InitialScriptState,
port: Receiver<MainThreadScriptMsg>,