Implement HTMLCanvasElement.transferControlToOffscreen (#34959)

This follows the spec by introducing a new "Placeholder" canvas context
mode. The underlying offscreen canvas is kept accessible from the DOM
element to allow for the drawImage() implementation to work with canvases
that have transfered their control.

Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
webbeef 2025-01-12 20:09:02 -08:00 committed by GitHub
parent 90c5685d61
commit c936dd6c4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 139 additions and 42 deletions

View file

@ -8,14 +8,5 @@
[Verify that resizing an OffscreenCanvas with a 2d context propagates the new size to its placeholder canvas asynchronously.]
expected: FAIL
[Verify that drawImage uses the size of the frame as the intinsic size of a placeholder canvas.]
expected: FAIL
[Verify that writing to the width and height attributes of an OffscreenCanvas works when there is a webgl context attached.]
expected: FAIL
[Verify that writing to the width or height attribute of a placeholder canvas throws an exception]
expected: FAIL
[Verify that writing to the width or height attribute of a placeholder canvas throws an exception even when not changing the value of the attribute.]
expected: FAIL

View file

@ -1,3 +0,0 @@
[offscreencanvas.transfer.lowlatency.nocrash.html]
[Tests that transferring a low latency canvas does not cause a crash. See crbug.com/1255153]
expected: FAIL

View file

@ -1,10 +0,0 @@
[offscreencanvas.transfercontrol.to.offscreen.html]
[Test that calling transferControlToOffscreen twice throws an exception]
expected: FAIL
[Test that an OffscreenCanvas generated by transferControlToOffscreen gets correct width and height]
expected: FAIL
[Test that calling getContext on a placeholder canvas that has already transferred its control throws an exception]
expected: FAIL

View file

@ -7915,12 +7915,6 @@
[HTMLSlotElement interface: calling assign((Element or Text)...) on document.createElement("slot") with too few arguments must throw TypeError]
expected: FAIL
[HTMLCanvasElement interface: operation transferControlToOffscreen()]
expected: FAIL
[HTMLCanvasElement interface: document.createElement("canvas") must inherit property "transferControlToOffscreen()" with the proper type]
expected: FAIL
[HTMLMarqueeElement interface: existence and properties of interface object]
expected: FAIL