mirror of
https://github.com/servo/servo
synced 2026-05-09 08:32:31 +02:00
This change makes it so that the `HTMLCanvasElement` is responsible for managing the `ImageKey` for associated `RenderingContext`s. Only canvases display their contents into WebRender directly, so this makes it so that keys are not generated for `OffscreenCanvas`. The main goal here is that `ImageKey`s are always associated with a particular `WebView`, which isn't possible in the various canvas backends yet. This is important because each `WebView` may soon have a different WebRender instance entirely with its own set of `ImageKey`s. This also allows for clearing `ImageKey`s when canvases are disconnected from the DOM in a future change. One tricky thing here is placeholder canvases, which are meant to be driven from workers. It seems that the implementation isn't correct for these at the moment as they need to be updated to the specification. Instead, what is happening is that any existing context / image is completely lost when converting to an `OffscreenCanvas`. Testing: This shouldn't change observable behavior, so is covered by existing tests. Fixes: This is part of #40261. --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>