Skip to content

Commit

Permalink
Bug 1664565 - Immediately enter rendering state when requesting an up…
Browse files Browse the repository at this point in the history
…dated preview r=emalysz

This avoids the sheet count being shown incorrectly when the destination
changes between PDF and non-PDF printers.

Differential Revision: https://phabricator.services.mozilla.com/D89971
  • Loading branch information
mstriemer committed Sep 15, 2020
1 parent 8514fcf commit 7249c61
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions toolkit/components/printing/content/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ var PrintEventHandler = {
* the in progress update completes.
*/
async updatePrintPreview() {
// Make sure the rendering state is set so we don't visibly update the
// sheet count with incomplete data.
this._showRenderingIndicator();
this._updatePrintPreviewTask.arm();
},

Expand All @@ -516,9 +519,7 @@ var PrintEventHandler = {
// We never want the progress dialog to show
settings.showPrintProgress = false;

let stack = previewBrowser.parentElement;
stack.setAttribute("rendering", true);
document.body.setAttribute("rendering", true);
this._showRenderingIndicator();

let sourceWinId;
if (sourceBrowsingContext) {
Expand Down Expand Up @@ -548,6 +549,17 @@ var PrintEventHandler = {
})
);

this._hideRenderingIndicator();
},

_showRenderingIndicator() {
let stack = this.previewBrowser.parentElement;
stack.setAttribute("rendering", true);
document.body.setAttribute("rendering", true);
},

_hideRenderingIndicator() {
let stack = this.previewBrowser.parentElement;
stack.removeAttribute("rendering");
document.body.removeAttribute("rendering");
},
Expand Down

0 comments on commit 7249c61

Please sign in to comment.