Merge pull request #21277 from calixteman/issue21276

Clear the full SMask scratch canvas in compose()
This commit is contained in:
Tim van der Meij 2026-05-15 20:04:11 +02:00 committed by GitHub
commit 26474b09cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1850,17 +1850,13 @@ class CanvasGraphics {
return;
}
// Whatever was drawn has been moved to the suspended canvas, now clear it
// out of the current canvas. Only the dirty box region needs clearing;
// everything outside it is already transparent.
// Clear the full scratch canvas, not just the dirty box. Pixels left
// outside dirtyBox can leak into a later compose() whose destination-in
// pass doesn't overwrite them, producing stale output -- this is what
// breaks `firefox-issue17779-partial` (issue #21276).
this.ctx.save();
this.ctx.setTransform(1, 0, 0, 1, 0, 0);
this.ctx.clearRect(
dirtyBox[0],
dirtyBox[1],
dirtyBox[2] - dirtyBox[0],
dirtyBox[3] - dirtyBox[1]
);
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
this.ctx.restore();
}