[Pkg-javascript-commits] [pdf.js] 27/115: Ensure that the `hidden` attribute is always removed from the canvas when rendering is complete (issue 6661)

David Prévot taffit at moszumanska.debian.org
Wed Dec 16 20:03:11 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit f341d81ae843633c23710c28878bf1c830259eab
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Thu Nov 19 12:31:49 2015 +0100

    Ensure that the `hidden` attribute is always removed from the canvas when rendering is complete (issue 6661)
    
    Fixes 6661.
---
 web/pdf_page_view.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js
index 561ac81..52b3f59 100644
--- a/web/pdf_page_view.js
+++ b/web/pdf_page_view.js
@@ -308,7 +308,11 @@ var PDFPageView = (function PDFPageViewClosure() {
 
       var canvas = document.createElement('canvas');
       canvas.id = 'page' + this.id;
+      // Keep the canvas hidden until the first draw callback, or until drawing
+      // is complete when `!this.renderingQueue`, to prevent black flickering.
       canvas.setAttribute('hidden', 'hidden');
+      var isCanvasHidden = true;
+
       canvasWrapper.appendChild(canvas);
       if (this.annotationLayer && this.annotationLayer.div) {
         // annotationLayer needs to stay on top
@@ -316,7 +320,6 @@ var PDFPageView = (function PDFPageViewClosure() {
       } else {
         div.appendChild(canvasWrapper);
       }
-      var isCanvasHidden = true;
       this.canvas = canvas;
 
 //#if MOZCENTRAL || FIREFOX || GENERIC
@@ -401,6 +404,11 @@ var PDFPageView = (function PDFPageViewClosure() {
 
         self.renderingState = RenderingStates.FINISHED;
 
+        if (isCanvasHidden) {
+          self.canvas.removeAttribute('hidden');
+          isCanvasHidden = false;
+        }
+
         if (self.loadingIconDiv) {
           div.removeChild(self.loadingIconDiv);
           delete self.loadingIconDiv;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list