Bug 842087 - Update pdf.js to version 0.7.236. r=yury

This commit is contained in:
Ryan VanderMeulen 2013-02-17 07:07:50 -05:00
parent 86594df5d1
commit f92af47439
5 changed files with 72 additions and 21 deletions

View File

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

View File

@ -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]
];
}
};

View File

@ -1165,6 +1165,7 @@ canvas {
bottom: 0;
color: #000;
font-family: sans-serif;
overflow: hidden;
}
.textLayer > div {

View File

@ -127,11 +127,11 @@ limitations under the License.
<div class="outerCenter">
<div class="innerCenter" id="toolbarViewerMiddle">
<div class="splitToolbarButton">
<button class="toolbarButton zoomOut" title="Zoom Out" tabindex="8" data-l10n-id="zoom_out">
<button class="toolbarButton zoomOut" id="zoom_out" title="Zoom Out" tabindex="8" data-l10n-id="zoom_out">
<span data-l10n-id="zoom_out_label">Zoom Out</span>
</button>
<div class="splitToolbarButtonSeparator"></div>
<button class="toolbarButton zoomIn" title="Zoom In" tabindex="9" data-l10n-id="zoom_in">
<button class="toolbarButton zoomIn" id="zoom_in" title="Zoom In" tabindex="9" data-l10n-id="zoom_in">
<span data-l10n-id="zoom_in_label">Zoom In</span>
</button>
</div>

View File

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