aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/offscreencanvas.rs
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2025-02-23 17:31:06 +0100
committerGitHub <noreply@github.com>2025-02-23 16:31:06 +0000
commit1d7bb1337d3fc4355ea0296d17a2f196541ad7d0 (patch)
tree7ef33cfd8187af570d9e86b763b66bc675763d86 /components/script/dom/offscreencanvas.rs
parent6199099d12411b1a43d239bbe8409936ff6623b7 (diff)
downloadservo-1d7bb1337d3fc4355ea0296d17a2f196541ad7d0.tar.gz
servo-1d7bb1337d3fc4355ea0296d17a2f196541ad7d0.zip
Unify `(Offscreen)CanvasRenderingContext2d` and make `PaintRenderingContext2D` standalone (#35619)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Diffstat (limited to 'components/script/dom/offscreencanvas.rs')
-rw-r--r--components/script/dom/offscreencanvas.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/components/script/dom/offscreencanvas.rs b/components/script/dom/offscreencanvas.rs
index ead9bd1b42e..7476d5edaca 100644
--- a/components/script/dom/offscreencanvas.rs
+++ b/components/script/dom/offscreencanvas.rs
@@ -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 {