mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Unify (Offscreen)CanvasRenderingContext2d
and make PaintRenderingContext2D
standalone (#35619)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
6199099d12
commit
1d7bb1337d
6 changed files with 237 additions and 290 deletions
|
@ -123,12 +123,7 @@ impl OffscreenCanvas {
|
|||
OffscreenCanvasContext::OffscreenContext2d(ref ctx) => Some(DomRoot::from_ref(ctx)),
|
||||
};
|
||||
}
|
||||
let context = OffscreenCanvasRenderingContext2D::new(
|
||||
&self.global(),
|
||||
self,
|
||||
self.placeholder.as_deref(),
|
||||
CanGc::note(),
|
||||
);
|
||||
let context = OffscreenCanvasRenderingContext2D::new(&self.global(), self, CanGc::note());
|
||||
*self.context.borrow_mut() = Some(OffscreenCanvasContext::OffscreenContext2d(
|
||||
Dom::from_ref(&*context),
|
||||
));
|
||||
|
@ -138,6 +133,10 @@ impl OffscreenCanvas {
|
|||
pub(crate) fn is_valid(&self) -> bool {
|
||||
self.Width() != 0 && self.Height() != 0
|
||||
}
|
||||
|
||||
pub(crate) fn placeholder(&self) -> Option<&HTMLCanvasElement> {
|
||||
self.placeholder.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
impl OffscreenCanvasMethods<crate::DomTypeHolder> for OffscreenCanvas {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue