Extract canvas operations for reuse by OffscreenCanvas.

This commit is contained in:
Maharsh 2019-05-14 02:15:20 -04:00 committed by Josh Matthews
parent 6fb7a8cdc7
commit 85c20db495
257 changed files with 1857 additions and 1870 deletions

View file

@ -93,7 +93,12 @@ impl OffscreenCanvas {
};
}
let size = self.get_size();
let context = OffscreenCanvasRenderingContext2D::new(&self.global(), self, size);
let context = OffscreenCanvasRenderingContext2D::new(
&self.global(),
self,
size,
self.placeholder.as_ref().map(|c| &**c),
);
*self.context.borrow_mut() = Some(OffscreenCanvasContext::OffscreenContext2d(
Dom::from_ref(&*context),
));