-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Render high-res partial page views when falling back to CSS zo…
…om (bug 1492303) Clean up the PDFDetailView after cancellation synchronously. This ensures that, when rendering is cancelled, we always restore tracking the canvas that is still in the DOM (done in the `onCancel` callback of `_drawCanvas`) before calling `.remove()` on whatever the tracked canvas is. Given this algorithm that starts with a 1000% zoom already rendered, with a detail view canvas that we'll call #1: - zoom 0.3x (!needs detail view) - await 1 microtick (Promise.resolve()) - zoom 0.3x (!does not need detail view) Before this patch, the order of operations would be: - Create a new detail canvas #2 for the 300% zoom level - Change detailView.canvas from #1 to #2 - await 1 microtick (between the two zoom changes) - In .reset(), cancel the rendering - In .reset(), call detailView.canvas.remove() (removing #2, even if the one in the dom is actually still #1) - Set .detailView to `null`, because we don't need it anymore. - await, because the `onCancel` logic was run asyncronously - Change detailView.canvas from #2 to #1 After this patch, the order becomes: - Create a new detail canvas #2 for the 300% zoom level - Change detailView.canvas from #1 to #2 - await 1 microtick (between the two zoom changes) - In .reset(), cancel the rendering - It runs `onCancel`, changing detailView.canvas from #2 to #1 - In .reset(), call detailView.canvas.remove() (which now removes #1) - Set .detailView to `null`, because we don't need it anymore.
- Loading branch information
1 parent
17d0b11
commit bc7e568
Showing
3 changed files
with
102 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters