diff --git a/browser/extensions/pdfjs/README.mozilla b/browser/extensions/pdfjs/README.mozilla index 7c9f1991507c..713c02ac0a42 100644 --- a/browser/extensions/pdfjs/README.mozilla +++ b/browser/extensions/pdfjs/README.mozilla @@ -1,4 +1,4 @@ This is the pdf.js project output, https://github.com/mozilla/pdf.js -Current extension version is: 0.7.210 +Current extension version is: 0.7.236 diff --git a/browser/extensions/pdfjs/content/build/pdf.js b/browser/extensions/pdfjs/content/build/pdf.js index cf7edd6873cd..953b1ad014dd 100644 --- a/browser/extensions/pdfjs/content/build/pdf.js +++ b/browser/extensions/pdfjs/content/build/pdf.js @@ -16,8 +16,8 @@ */ var PDFJS = {}; -PDFJS.version = '0.7.210'; -PDFJS.build = '7f6456d'; +PDFJS.version = '0.7.236'; +PDFJS.build = 'f8e70dc'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -1547,6 +1547,8 @@ var PDFPageProxy = (function PDFPageProxyClosure() { * canvasContext(required): A 2D context of a DOM Canvas object., * textLayer(optional): An object that has beginLayout, endLayout, and * appendText functions., + * imageLayer(optional): An object that has beginLayout, endLayout and + * appendImage functions., * continueCallback(optional): A function that will be called each time * the rendering is paused. To continue * rendering call the function that is the @@ -1598,7 +1600,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() { } var gfx = new CanvasGraphics(params.canvasContext, this.commonObjs, - this.objs, params.textLayer); + this.objs, params.textLayer, params.imageLayer); try { this.display(gfx, params.viewport, complete, continueCallback); } catch (e) { @@ -2213,7 +2215,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { // before it stops and shedules a continue of execution. var EXECUTION_TIME = 15; - function CanvasGraphics(canvasCtx, commonObjs, objs, textLayer) { + function CanvasGraphics(canvasCtx, commonObjs, objs, textLayer, imageLayer) { this.ctx = canvasCtx; this.current = new CanvasExtraState(); this.stateStack = []; @@ -2223,6 +2225,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { this.commonObjs = commonObjs; this.objs = objs; this.textLayer = textLayer; + this.imageLayer = imageLayer; if (canvasCtx) { addContextCurrentTransform(canvasCtx); } @@ -2398,8 +2401,12 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { this.ctx.save(); this.ctx.transform.apply(this.ctx, transform); - if (this.textLayer) + if (this.textLayer) { this.textLayer.beginLayout(); + } + if (this.imageLayer) { + this.imageLayer.beginLayout(); + } }, executeOperatorList: function CanvasGraphics_executeOperatorList( @@ -2476,8 +2483,12 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { endDrawing: function CanvasGraphics_endDrawing() { this.ctx.restore(); - if (this.textLayer) + if (this.textLayer) { this.textLayer.endLayout(); + } + if (this.imageLayer) { + this.imageLayer.endLayout(); + } }, // Graphics state @@ -3274,7 +3285,17 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { ctx.drawImage(domImage, 0, 0, domImage.width, domImage.height, 0, -h, w, h); - + if (this.imageLayer) { + var currentTransform = ctx.mozCurrentTransformInverse; + var position = this.getCanvasPosition(0, 0); + this.imageLayer.appendImage({ + objId: objId, + left: position[0], + top: position[1], + width: w / currentTransform[0], + height: h / currentTransform[3] + }); + } this.restore(); }, @@ -3373,6 +3394,17 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { } ctx.drawImage(tmpCanvas, 0, -height); } + + if (this.imageLayer) { + var position = this.getCanvasPosition(0, -height); + this.imageLayer.appendImage({ + imgData: imgData, + left: position[0], + top: position[1], + width: width / currentTransform[0], + height: height / currentTransform[3] + }); + } this.restore(); }, @@ -3393,6 +3425,16 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { ctx.scale(1, -1); ctx.drawImage(tmpCanvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1); + if (this.imageLayer) { + var position = this.getCanvasPosition(entry.x, entry.y); + this.imageLayer.appendImage({ + imgData: imgData, + left: position[0], + top: position[1], + width: w, + height: h + }); + } ctx.restore(); } }, @@ -3458,6 +3500,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { return Math.sqrt(Math.max( (inverse[0] * inverse[0] + inverse[1] * inverse[1]), (inverse[2] * inverse[2] + inverse[3] * inverse[3]))); + }, + getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { + var transform = this.ctx.mozCurrentTransform; + return [ + transform[0] * x + transform[2] * y + transform[4], + transform[1] * x + transform[3] * y + transform[5] + ]; } }; diff --git a/browser/extensions/pdfjs/content/web/viewer.css b/browser/extensions/pdfjs/content/web/viewer.css index 0a034e2a7f65..d0483a57a6b4 100644 --- a/browser/extensions/pdfjs/content/web/viewer.css +++ b/browser/extensions/pdfjs/content/web/viewer.css @@ -1165,6 +1165,7 @@ canvas { bottom: 0; color: #000; font-family: sans-serif; + overflow: hidden; } .textLayer > div { diff --git a/browser/extensions/pdfjs/content/web/viewer.html b/browser/extensions/pdfjs/content/web/viewer.html index ab5dfbb40b3b..d527d5f14844 100644 --- a/browser/extensions/pdfjs/content/web/viewer.html +++ b/browser/extensions/pdfjs/content/web/viewer.html @@ -127,11 +127,11 @@ limitations under the License.
-
-
diff --git a/browser/extensions/pdfjs/content/web/viewer.js b/browser/extensions/pdfjs/content/web/viewer.js index 7c9fccefaf37..52d9d91b34bb 100644 --- a/browser/extensions/pdfjs/content/web/viewer.js +++ b/browser/extensions/pdfjs/content/web/viewer.js @@ -220,17 +220,6 @@ var FirefoxCom = (function FirefoxComClosure() { // If not, we use FUEL in FF // Use asyncStorage for B2G var Settings = (function SettingsClosure() { - var isLocalStorageEnabled = (function localStorageEnabledTest() { - // Feature test as per http://diveintohtml5.info/storage.html - // The additional localStorage call is to get around a FF quirk, see - // bug #495747 in bugzilla - try { - return 'localStorage' in window && window['localStorage'] !== null && - localStorage; - } catch (e) { - return false; - } - })(); function Settings(fingerprint) { this.fingerprint = fingerprint; @@ -274,7 +263,10 @@ var Settings = (function SettingsClosure() { var file = this.file; file[name] = val; var database = JSON.stringify(this.database); + + FirefoxCom.requestSync('setDatabase', database); + }, get: function settingsGet(name, defaultValue) { @@ -3107,6 +3099,9 @@ window.addEventListener('scalechange', function scalechange(evt) { customScaleOption.textContent = Math.round(evt.scale * 10000) / 100 + '%'; customScaleOption.selected = true; } + + document.getElementById('zoom_out').disabled = (evt.scale === MIN_SCALE); + document.getElementById('zoom_in').disabled = (evt.scale === MAX_SCALE); updateViewarea(); }, true); @@ -3257,6 +3252,12 @@ window.addEventListener('keydown', function keydown(evt) { PDFView.page--; handled = true; break; + case 27: // esc key + if (!PDFView.supportsIntegratedFind && PDFFindBar.opened) { + PDFFindBar.close(); + handled = true; + } + break; case 40: // down arrow case 34: // pg down case 32: // spacebar