Skip to content

Commit

Permalink
Bug 1860278 [wpt PR 42662] - Throw an exception in putImageData if ca…
Browse files Browse the repository at this point in the history
…nvas layers are opened, a=testonly

Automatic update from web-platform-tests
Throw an exception in putImageData if canvas layers are opened

This API is incompatible with how the 2D canvas is rasterized when
it contains unclosed layers. Because layers can have filters that get
applied on their final content, they can't be presented until they are
closed. Instead, we normally keep the layer content alive after a
flush, so that it can be presented in a later frame when the layer is
finally closed.

putImageData however is supposed to write to the canvas bitmap
wholesale, bypassing all render states. This means that we can't write
to the layer's content because the written pixels would then get
filtered when the layer is closed. We can't write to the main canvas
either because these pixels would later be overwritten by the layer's
result with draw calls that potentially happened before (e.g. in the
sequence `beginLayer(); fillRect(); putImageData(); endLayer();`,
`fillRect()` would write over `putImageData()`.

This behavior is part of the current 2D Canvas Layer spec draft:
Explainer: https://github.com/fserb/canvas2D/blob/master/spec/layers.md
Spec draft: whatwg/html#9537

Change-Id: I266a3155c32919a68dbbb093e4aff9b1dd13a3b5
Bug: 1484741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4943172
Reviewed-by: Fernando Serboncini <fserbchromium.org>
Commit-Queue: Jean-Philippe Gravel <jpgravelchromium.org>
Cr-Commit-Position: refs/heads/main{#1212741}

--

wpt-commits: 6e6f9fbb0746983001d7fe80ab717567c2f73bfc
wpt-pr: 42662

UltraBlame original commit: 685e2ff9c9f305fea2dfd442a95067594d05a6d1
  • Loading branch information
marco-c committed Nov 8, 2023
1 parent d347e45 commit 861e0d5
Show file tree
Hide file tree
Showing 7 changed files with 832 additions and 1,624 deletions.
Loading

0 comments on commit 861e0d5

Please sign in to comment.