mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Do not assume OffscreenCanvasContext
to be 2d (#35629)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
6062995636
commit
e887e621f8
3 changed files with 30 additions and 18 deletions
|
@ -127,6 +127,19 @@ impl OffscreenCanvas {
|
|||
pub(crate) fn placeholder(&self) -> Option<&HTMLCanvasElement> {
|
||||
self.placeholder.as_deref()
|
||||
}
|
||||
|
||||
pub(crate) fn resize(&self, size: Size2D<u64>) {
|
||||
self.width.set(size.width);
|
||||
self.height.set(size.height);
|
||||
|
||||
if let Some(canvas_context) = self.context() {
|
||||
match &*canvas_context {
|
||||
OffscreenCanvasContext::OffscreenContext2d(rendering_context) => {
|
||||
rendering_context.set_canvas_bitmap_dimensions(self.get_size());
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl OffscreenCanvasMethods<crate::DomTypeHolder> for OffscreenCanvas {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue