servo/components/shared/canvas/lib.rs
sagudev ae69646371
canvas: Make 2D context state creation failable and use dom_canvas_backend pref for backend selection (#38310)
Before script just crashed in those cases because IPCSender was dropped,
now we send `None` to tell script about the failure and fail getContext
or registerPainter accordingly.
This PR also unifies `dom_canvas_{backends}_enabled` prefs into
`dom_canvas_backend` which is more flexible in multi-backends scenarios.

Reviewable per commit.

Testing: Added servo specific WPT test.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-28 09:13:07 +00:00

25 lines
611 B
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![crate_name = "canvas_traits"]
#![crate_type = "rlib"]
#![deny(unsafe_code)]
use crossbeam_channel::Sender;
use euclid::default::Size2D;
use webrender_api::ImageKey;
use crate::canvas::CanvasId;
pub mod canvas;
#[macro_use]
pub mod webgl;
pub enum ConstellationCanvasMsg {
Create {
sender: Sender<Option<(CanvasId, ImageKey)>>,
size: Size2D<u64>,
},
Exit(Sender<()>),
}