diff options
author | sagudev <16504129+sagudev@users.noreply.github.com> | 2025-03-25 07:38:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-25 06:38:02 +0000 |
commit | 62737b3830a24f327018da1a7c006b2289a3fc31 (patch) | |
tree | bfa11105970241651afb0ea7a0ee47eecbf0348a /components/script/dom/htmlcanvaselement.rs | |
parent | ed995e61a62c560121cf3a32746c633bb0accdf4 (diff) | |
download | servo-62737b3830a24f327018da1a7c006b2289a3fc31.tar.gz servo-62737b3830a24f327018da1a7c006b2289a3fc31.zip |
canvas: Update the image as part of update the rendering (#35996)
* Create `update_rendering` in `CanvasState` instead of manually updating in layout
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Mark as dirty and do flushes
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* fixup rebase
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Update components/script/dom/htmlcanvaselement.rs
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/dom/htmlcanvaselement.rs')
-rw-r--r-- | components/script/dom/htmlcanvaselement.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index 42a526ce348..37d7aa91f90 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -180,6 +180,21 @@ impl HTMLCanvasElement { } } + pub(crate) fn mark_as_dirty(&self) { + if let Some(ref context) = *self.context.borrow() { + match *context { + CanvasContext::Context2d(ref context) => context.mark_as_dirty(), + CanvasContext::WebGL(ref context) => context.mark_as_dirty(), + CanvasContext::WebGL2(ref context) => context.mark_as_dirty(), + #[cfg(feature = "webgpu")] + CanvasContext::WebGPU(ref context) => context.mark_as_dirty(), + CanvasContext::Placeholder(ref _context) => { + // TODO: Should this be marked as dirty? + }, + } + } + } + pub(crate) fn set_natural_width(&self, value: u32, can_gc: CanGc) { let value = if value > UNSIGNED_LONG_MAX { DEFAULT_WIDTH |