Merge pull request #19204 from calixteman/set_canvas_as_first_child
Make sure the canvas is always the first child of its wrapper
This commit is contained in:
commit
f9ae9b06e8
@ -975,6 +975,10 @@ class PDFPageView {
|
|||||||
|
|
||||||
const hasHCM = !!(pageColors?.background && pageColors?.foreground);
|
const hasHCM = !!(pageColors?.background && pageColors?.foreground);
|
||||||
const prevCanvas = this.canvas;
|
const prevCanvas = this.canvas;
|
||||||
|
|
||||||
|
// In HCM, a final filter is applied on the canvas which means that
|
||||||
|
// before it's applied we've normal colors. Consequently, to avoid to
|
||||||
|
// have a final flash we just display it once all the drawing is done.
|
||||||
const updateOnFirstShow = !prevCanvas && !hasHCM;
|
const updateOnFirstShow = !prevCanvas && !hasHCM;
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
this.#originalViewport = viewport;
|
this.#originalViewport = viewport;
|
||||||
@ -984,7 +988,13 @@ class PDFPageView {
|
|||||||
// Don't add the canvas until the first draw callback, or until
|
// Don't add the canvas until the first draw callback, or until
|
||||||
// drawing is complete when `!this.renderingQueue`, to prevent black
|
// drawing is complete when `!this.renderingQueue`, to prevent black
|
||||||
// flickering.
|
// flickering.
|
||||||
canvasWrapper.append(canvas);
|
// In whatever case, the canvas must be the first child.
|
||||||
|
const { firstChild } = canvasWrapper;
|
||||||
|
if (firstChild) {
|
||||||
|
firstChild.before(canvas);
|
||||||
|
} else {
|
||||||
|
canvasWrapper.append(canvas);
|
||||||
|
}
|
||||||
showCanvas = null;
|
showCanvas = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -996,10 +1006,12 @@ class PDFPageView {
|
|||||||
prevCanvas.replaceWith(canvas);
|
prevCanvas.replaceWith(canvas);
|
||||||
prevCanvas.width = prevCanvas.height = 0;
|
prevCanvas.width = prevCanvas.height = 0;
|
||||||
} else {
|
} else {
|
||||||
// In HCM, a final filter is applied on the canvas which means that
|
const { firstChild } = canvasWrapper;
|
||||||
// before it's applied we've normal colors. Consequently, to avoid to
|
if (firstChild) {
|
||||||
// have a final flash we just display it once all the drawing is done.
|
firstChild.before(canvas);
|
||||||
canvasWrapper.append(canvas);
|
} else {
|
||||||
|
canvasWrapper.append(canvas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showCanvas = null;
|
showCanvas = null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user