mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script: Move FontContext
from Window
to GlobalScope
(#38918)
This change makes it so that every `GlobalScope` can contain an optional `FontContext`. This will be necessary for every `GlobalScope` that accesses canvas. Currently, `FontContext` is created and accessed via the canvas worker thread, but this means that web fonts are not available to canvas. This change will eventually make it possible for canvas to share web fonts with the `Document` that owns them. Testing: This should not change behavior and is thus covered by existing tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
909ceee830
commit
4f68508624
18 changed files with 281 additions and 193 deletions
|
@ -11,6 +11,7 @@ use constellation_traits::{WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
|
|||
use crossbeam_channel::{Receiver, Sender, unbounded};
|
||||
use devtools_traits::DevtoolScriptControlMsg;
|
||||
use dom_struct::dom_struct;
|
||||
use fonts::FontContext;
|
||||
use headers::{HeaderMapExt, ReferrerPolicy as ReferrerPolicyHeader};
|
||||
use ipc_channel::ipc::IpcReceiver;
|
||||
use ipc_channel::router::ROUTER;
|
||||
|
@ -283,6 +284,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
#[cfg(feature = "webgpu")] gpu_id_hub: Arc<IdentityHub>,
|
||||
control_receiver: Receiver<DedicatedWorkerControlMsg>,
|
||||
insecure_requests_policy: InsecureRequestsPolicy,
|
||||
font_context: Option<Arc<FontContext>>,
|
||||
) -> DedicatedWorkerGlobalScope {
|
||||
DedicatedWorkerGlobalScope {
|
||||
workerglobalscope: WorkerGlobalScope::new_inherited(
|
||||
|
@ -296,6 +298,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
#[cfg(feature = "webgpu")]
|
||||
gpu_id_hub,
|
||||
insecure_requests_policy,
|
||||
font_context,
|
||||
),
|
||||
task_queue: TaskQueue::new(receiver, own_sender.clone()),
|
||||
own_sender,
|
||||
|
@ -324,6 +327,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
#[cfg(feature = "webgpu")] gpu_id_hub: Arc<IdentityHub>,
|
||||
control_receiver: Receiver<DedicatedWorkerControlMsg>,
|
||||
insecure_requests_policy: InsecureRequestsPolicy,
|
||||
font_context: Option<Arc<FontContext>>,
|
||||
) -> DomRoot<DedicatedWorkerGlobalScope> {
|
||||
let scope = Box::new(DedicatedWorkerGlobalScope::new_inherited(
|
||||
init,
|
||||
|
@ -342,6 +346,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
gpu_id_hub,
|
||||
control_receiver,
|
||||
insecure_requests_policy,
|
||||
font_context,
|
||||
));
|
||||
DedicatedWorkerGlobalScopeBinding::Wrap::<crate::DomTypeHolder>(
|
||||
GlobalScope::get_cx(),
|
||||
|
@ -370,6 +375,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
context_sender: Sender<ThreadSafeJSContext>,
|
||||
insecure_requests_policy: InsecureRequestsPolicy,
|
||||
policy_container: PolicyContainer,
|
||||
font_context: Option<Arc<FontContext>>,
|
||||
) -> JoinHandle<()> {
|
||||
let serialized_worker_url = worker_url.to_string();
|
||||
let webview_id = WebViewId::installed();
|
||||
|
@ -485,6 +491,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
gpu_id_hub,
|
||||
control_receiver,
|
||||
insecure_requests_policy,
|
||||
font_context,
|
||||
);
|
||||
debugger_global.fire_add_debuggee(
|
||||
CanGc::note(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue