From 426e26c63baf614056ee1b978e51fd9cfdd095a1 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 22 Jun 2017 09:53:03 +0200 Subject: [PATCH] Don't use a hidden canvas when constructing the `zoomLayer` in `PDFPageView.update` *This is an existing issue that I noticed while testing PR 8552.* When zooming or rotation occurs, we'll try to use the current canvas as a (CSS transformed) preview until the page has been completely re-drawn. If you manage to change the scale (or rotation) *very* quickly, it's possible that `PDFPageView.update` can be called *before* a previous `render` operation has progressed far enough to remove the `hidden` property from the canvas. The result is thus that a page may be *entirely* black during zooming or rotation, which doesn't look very good. This effect can be a bit difficult to spot, but it does manifest even in the default viewer. --- web/pdf_page_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index 39b61f016a774..f61a4f192db11 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -230,7 +230,7 @@ class PDFPageView { }); return; } - if (!this.zoomLayer) { + if (!this.zoomLayer && !this.canvas.hasAttribute('hidden')) { this.zoomLayer = this.canvas.parentNode; this.zoomLayer.style.position = 'absolute'; }