transferToimageBitmap should not reset the context
Categories
(Core :: Graphics: Canvas2D, defect, P1)
Tracking
()
People
(Reporter: tristan.fraipont, Assigned: jgilbert)
References
(Blocks 1 open bug)
Details
(Keywords: correctness, reproducible)
Attachments
(4 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0
Steps to reproduce:
https://jsfiddle.net/am16Lhk4/
- Set some properties to an OffscreenCanvas's 2D context, like
fillStyle, or changing its CTM. - Call the OffscreenCanvas's
transferToImageBitmap()method. - Perform new drawings without resetting the properties set at step 1.
Actual results:
All the properties set at step 1 where reset to their default.
Expected results:
Per specs only the bitmap buffer is supposed to get cleared by this operation, the context's properties are supposed to be preserved.
Comment 1•3 years ago
|
||
Triage - assigning S2 initially. I will see if mozregression reveals a working version.
Comment 2•3 years ago
|
||
Comment 3•3 years ago
|
||
To see if this is a regression I did mozregression using the provided test page, this feature used to be broken in a worse way as far back as FF95 (the actual result boxes are blank). As of FF104 it looks like the result in comment #2, which is broken in the way described in comment #1.
NeedInfo - Any additional info we will need to be able to address this bug?
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 4•3 years ago
|
||
We guessed wrong here, and we should not be resetting here:
https://searchfox.org/mozilla-central/rev/76ccfc801e6b736c844cde3fddeab7a748fc8515/dom/canvas/OffscreenCanvas.cpp#267-271
// FIXME(aosmond): The spec is unclear about the state of the canvas after
// clearing. Does it expect to preserve the WebGL state, other than the
// buffer state? Once we have clarity, we should ensure we clear the WebGL
// canvas as desired.
mCurrentContext->Reset();
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 5•3 years ago
|
||
s/Reset/ResetBitmap/ and implement for WebGL and WebGPU.
| Assignee | ||
Comment 6•3 years ago
|
||
That fixes the testcase behavior.
We need (more? fixed?) tests for this though, so let me add those here.
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 7•3 years ago
|
||
| Assignee | ||
Updated•3 years ago
|
Comment 9•3 years ago
|
||
Backed out for causing wpt failures on offscreencanvas.transfer.to.imagebitmap.html.
This fails on multiple platforms.
Push where the failures appeared
Push with failures
[task 2022-10-15T15:38:15.430Z] 15:38:15 INFO - TEST-START | /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html
[task 2022-10-15T15:38:15.434Z] 15:38:15 INFO - Closing window a451e800-7db1-451d-869b-2997a2056bd1
[task 2022-10-15T15:38:15.509Z] 15:38:15 INFO -
[task 2022-10-15T15:38:15.509Z] 15:38:15 INFO - TEST-PASS | /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html | Test that transferToImageBitmap returns an ImageBitmap with correct width and height
[task 2022-10-15T15:38:15.510Z] 15:38:15 INFO - TEST-PASS | /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html | Test that transferToImageBitmap returns an ImageBitmap with correct color
[task 2022-10-15T15:38:15.510Z] 15:38:15 INFO - TEST-UNEXPECTED-PASS | /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html | Test that transferToImageBitmap won't change context's property - expected FAIL
[task 2022-10-15T15:38:15.510Z] 15:38:15 INFO - TEST-INFO | expected FAIL
[task 2022-10-15T15:38:15.511Z] 15:38:15 INFO -
[task 2022-10-15T15:38:15.511Z] 15:38:15 INFO - TEST-UNEXPECTED-PASS | /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html | Test that transferToImageBitmap preserves transform - expected FAIL
[task 2022-10-15T15:38:15.511Z] 15:38:15 INFO - TEST-INFO | expected FAIL
[task 2022-10-15T15:38:15.512Z] 15:38:15 INFO - ..
[task 2022-10-15T15:38:15.512Z] 15:38:15 INFO - TEST-OK | /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html | took 80ms
[task 2022-10-15T15:38:15.514Z] 15:38:15 INFO - PID 2188 | 1665848295510 Marionette INFO Stopped listening on port 59578
[task 2022-10-15T15:38:15.811Z] 15:38:15 INFO - PID 2188 | [2022-10-15T15:38:15Z ERROR xulstore::persist] removeDocument error: unavailable
[task 2022-10-15T15:38:15.841Z] 15:38:15 INFO - Browser exited with return code 0
[task 2022-10-15T15:38:15.844Z] 15:38:15 INFO - Closing logging queue
[task 2022-10-15T15:38:15.844Z] 15:38:15 INFO - queue closed
[task 2022-10-15T15:38:16.014Z] 15:38:16 INFO - Application command: /opt/worker/tasks/task_166584702349171/build/application/Firefox Nightly.app/Contents/MacOS/firefox --marionette about:blank -foreground -profile /var/folders/s_/lbx5y22n31l0w_7s1y123mzw000014/T/tmp21rji15v
[task 2022-10-15T15:38:16.023Z] 15:38:16 INFO - PID 2246 | 1665848202123 Marionette INFO Marionette enabled
[task 2022-10-15T15:38:16.023Z] 15:38:16 INFO - PID 2246 | 1665848202148 Marionette INFO Listening on port 59820
[task 2022-10-15T15:38:16.024Z] 15:38:16 INFO - PID 2246 | console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /var/folders/s_/lbx5y22n31l0w_7s1y123mzw000014/T/tmpb5qrv6yh/search.json.mozlz4", (void 0)))
[task 2022-10-15T15:38:16.025Z] 15:38:16 INFO - PID 2246 | 2022-10-15 15:37:12.090 firefox[2246:55147] Persistent UI failed to open file file:///Users/cltbld/Library/Saved%20Application%20State/org.mozilla.nightly.savedState/window_1.data: No such file or directory (2)
[task 2022-10-15T15:38:16.025Z] 15:38:16 INFO - Starting runner
[task 2022-10-15T15:38:16.628Z] 15:38:16 INFO - TEST-START | /html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.nocrash.html
[task 2022-10-15T15:38:16.720Z] 15:38:16 INFO - .
Comment 10•3 years ago
|
||
Comment 11•3 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/78a3979d12d7
https://hg.mozilla.org/mozilla-central/rev/1324acbcc0e2
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
I managed to reproduce this issue on a 2022-10-12 Nightly build on macOS 12 using the testcase attached in Comment 0. Verified as fixed on Firefox 107.0b4(build ID: 20221023190001), Nightly 108.0a1(build ID: 20221023100414) on macOS 12, Windows 10, Ubuntu 22.
Description
•