Closed Bug 1959815 Opened 6 months ago Closed 6 months ago

Last clearRect region is used when setting width and height

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 139
defect

Tracking

()

RESOLVED FIXED
139 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox137 --- wontfix
firefox138 --- fixed
firefox139 --- fixed

People

(Reporter: caleb, Assigned: lsalzman)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3.1 Safari/605.1.15

Steps to reproduce:

https://jsfiddle.net/w5e89aLm/

Steps:

  1. canvas.width = canvas.width; canvas.height = canvas.height;
  2. Translate to some negative offset in both x and y
  3. ctx.clearRect(0, 0, canvas.width, canvas.height)
  4. Draw something into the main canvas area that negates the offset.
  5. Repeat several (3?) times, moving the thing being drawn in the negative directions so you can see if anything is leftover on the right (meaning it used the clearRect region from 2).

I couldn't reduce it any further. It seems this specific sequence has to happen a few times before it kicks in.

This used to work. I know for a fact Firefox 130 passes the test.

Actual results:

I should never see artifacts from the last paint after I set canvas.width and canvas.height. Safari and Chrome pass the test.

Expected results:

Saw pixels leftover from the last paint.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: Canvas2D
Product: Firefox → Core

If it used to work would you mind using https://mozilla.github.io/mozregression/ to get a regression range?

Flags: needinfo?(caleb)
Flags: needinfo?(caleb)

:lsalzman, since you are the author of the regressor, bug 1950596, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(lsalzman)
Flags: needinfo?(lsalzman)

CurrentState().transform is only reliably set for save/restore ops, so isn't save to
check for evaluating coverage in EnsureTarget. This change uses GetCurrentTransform
instead which will always give the correct, most up-to-date transform to use.

Assignee: nobody → lsalzman
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
See Also: → 1958234

Set release status flags based on info from the regressing bug 1950596

Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2822da183fd0 Use most up-to-date transform for evaluating target coverage. r=aosmond
See Also: → 1959171
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch

Comment on attachment 9478486 [details]
Bug 1959815 - Use most up-to-date transform for evaluating target coverage. r?aosmond

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Incorrect Canvas2D drawing.
  • Is this code covered by automated tests?: Unknown
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky):
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9478486 - Flags: approval-mozilla-beta?

Comment on attachment 9478486 [details]
Bug 1959815 - Use most up-to-date transform for evaluating target coverage. r?aosmond

Approved for 138.0b7

Attachment #9478486 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: