[Pkg-javascript-commits] [pdf.js] 57/72: Disable PresentationMode for certain problematic configurations

David Prévot taffit at moszumanska.debian.org
Wed Mar 18 20:16:00 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 65a5543efe054ba7d1295eacd663cbb711c13b18
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Wed Dec 3 15:38:25 2014 +0100

    Disable PresentationMode for certain problematic configurations
    
    Instead of trying to hack around various browser defects, let's just disable PresentationMode in the affected browsers. This patch:
    
    - Disables PresentationMode in IE11+ when the viewer is embedded; fixes 4711.
---
 src/display/api.js   | 10 +++++++++-
 web/compatibility.js | 10 ++++++++++
 web/viewer.js        |  3 +++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/display/api.js b/src/display/api.js
index 3d20dd8..3bb9a0c 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -44,7 +44,7 @@ PDFJS.cMapUrl = (PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl);
  */
 PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
 
-/*
+/**
  * By default fonts are converted to OpenType fonts and loaded via font face
  * rules. If disabled, the font will be rendered using a built in font renderer
  * that constructs the glyphs with primitive path commands.
@@ -135,6 +135,14 @@ PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ?
                       true : PDFJS.disableWebGL);
 
 /**
+ * Disables fullscreen support, and by extension Presentation Mode,
+ * in browsers which support the fullscreen API.
+ * @var {boolean}
+ */
+PDFJS.disableFullscreen = (PDFJS.disableFullscreen === undefined ?
+                           false : PDFJS.disableFullscreen);
+
+/**
  * Enables CSS only zooming.
  * @var {boolean}
  */
diff --git a/web/compatibility.js b/web/compatibility.js
index 424d5af..00429dd 100644
--- a/web/compatibility.js
+++ b/web/compatibility.js
@@ -562,3 +562,13 @@ if (typeof PDFJS === 'undefined') {
     PDFJS.maxCanvasPixels = 5242880;
   }
 })();
+
+// Disable fullscreen support for certain problematic configurations.
+// Support: IE11+ (when embedded).
+(function checkFullscreenSupport() {
+  var isEmbeddedIE = (navigator.userAgent.indexOf('Trident') >= 0 &&
+                      window.parent !== window);
+  if (isEmbeddedIE) {
+    PDFJS.disableFullscreen = true;
+  }
+})();
diff --git a/web/viewer.js b/web/viewer.js
index afca600..2071773 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -322,6 +322,9 @@ var PDFViewerApplication = {
         document.msFullscreenEnabled === false) {
       support = false;
     }
+    if (support && PDFJS.disableFullscreen === true) {
+      support = false;
+    }
 
     return PDFJS.shadow(this, 'supportsFullscreen', support);
   },

-- 
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