Bug 1110260 - Update pdf.js to version 1.0.978. r=bdahl

This commit is contained in:
Ryan VanderMeulen 2014-12-15 18:41:28 -05:00
parent d02a071da5
commit 70a6cbc9a1
8 changed files with 193 additions and 136 deletions

View File

@ -1,4 +1,4 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.0.937
Current extension version is: 1.0.978

View File

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.0.937';
PDFJS.build = '308646d';
PDFJS.version = '1.0.978';
PDFJS.build = '20bf84a';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -547,10 +547,10 @@ var Util = PDFJS.Util = (function UtilClosure() {
// makeCssRgb() can be called thousands of times. Using |rgbBuf| avoids
// creating many intermediate strings.
Util.makeCssRgb = function Util_makeCssRgb(rgb) {
rgbBuf[1] = rgb[0];
rgbBuf[3] = rgb[1];
rgbBuf[5] = rgb[2];
Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
rgbBuf[1] = r;
rgbBuf[3] = g;
rgbBuf[5] = b;
return rgbBuf.join('');
};
@ -3412,9 +3412,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
function composeSMaskLuminosity(maskData, layerData) {
var length = maskData.length;
for (var i = 3; i < length; i += 4) {
var y = ((maskData[i - 3] * 77) + // * 0.3 / 255 * 0x10000
(maskData[i - 2] * 152) + // * 0.59 ....
(maskData[i - 1] * 28)) | 0; // * 0.11 ....
var y = (maskData[i - 3] * 77) + // * 0.3 / 255 * 0x10000
(maskData[i - 2] * 152) + // * 0.59 ....
(maskData[i - 1] * 28); // * 0.11 ....
layerData[i] = (layerData[i] * y) >> 16;
}
}
@ -3434,7 +3434,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
}
// processing image in chunks to save memory
var PIXELS_TO_PROCESS = 65536;
var PIXELS_TO_PROCESS = 1048576;
var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));
for (var row = 0; row < height; row += chunkSize) {
var chunkHeight = Math.min(chunkSize, height - row);
@ -4326,12 +4326,12 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.current.fillColor = this.getColorN_Pattern(arguments);
},
setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) {
var color = Util.makeCssRgb(arguments);
var color = Util.makeCssRgb(r, g, b);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) {
var color = Util.makeCssRgb(arguments);
var color = Util.makeCssRgb(r, g, b);
this.ctx.fillStyle = color;
this.current.fillColor = color;
},
@ -4955,7 +4955,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
}
var currentGL, currentCanvas;
function generageGL() {
function generateGL() {
if (currentGL) {
return;
}
@ -5013,7 +5013,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
function initSmaskGL() {
var canvas, gl;
generageGL();
generateGL();
canvas = currentCanvas;
currentCanvas = null;
gl = currentGL;
@ -5145,7 +5145,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
function initFiguresGL() {
var canvas, gl;
generageGL();
generateGL();
canvas = currentCanvas;
currentCanvas = null;
gl = currentGL;
@ -5313,7 +5313,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
}
var enabled = false;
try {
generageGL();
generateGL();
enabled = !!currentGL;
} catch (e) { }
return shadow(this, 'isEnabled', enabled);
@ -5706,7 +5706,7 @@ var TilingPattern = (function TilingPatternClosure() {
context.strokeStyle = ctx.strokeStyle;
break;
case PaintType.UNCOLORED:
var cssColor = Util.makeCssRgb(color);
var cssColor = Util.makeCssRgb(color[0], color[1], color[2]);
context.fillStyle = cssColor;
context.strokeStyle = cssColor;
break;
@ -5868,11 +5868,9 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {
container.style.backgroundColor = item.color;
var color = item.color;
var rgb = [];
for (var i = 0; i < 3; ++i) {
rgb[i] = Math.round(color[i] * 255);
}
item.colorCssRgb = Util.makeCssRgb(rgb);
item.colorCssRgb = Util.makeCssRgb(Math.round(color[0] * 255),
Math.round(color[1] * 255),
Math.round(color[2] * 255));
var highlight = document.createElement('div');
highlight.className = 'annotationHighlight';
@ -5942,13 +5940,15 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {
var i, ii;
if (item.hasBgColor) {
var color = item.color;
var rgb = [];
for (i = 0; i < 3; ++i) {
// Enlighten the color (70%)
var c = Math.round(color[i] * 255);
rgb[i] = Math.round((255 - c) * 0.7) + c;
}
content.style.backgroundColor = Util.makeCssRgb(rgb);
// Enlighten the color (70%)
var BACKGROUND_ENLIGHT = 0.7;
var r = BACKGROUND_ENLIGHT * (1.0 - color[0]) + color[0];
var g = BACKGROUND_ENLIGHT * (1.0 - color[1]) + color[1];
var b = BACKGROUND_ENLIGHT * (1.0 - color[2]) + color[2];
content.style.backgroundColor = Util.makeCssRgb((r * 255) | 0,
(g * 255) | 0,
(b * 255) | 0);
}
var title = document.createElement('h1');

View File

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.0.937';
PDFJS.build = '308646d';
PDFJS.version = '1.0.978';
PDFJS.build = '20bf84a';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -547,10 +547,10 @@ var Util = PDFJS.Util = (function UtilClosure() {
// makeCssRgb() can be called thousands of times. Using |rgbBuf| avoids
// creating many intermediate strings.
Util.makeCssRgb = function Util_makeCssRgb(rgb) {
rgbBuf[1] = rgb[0];
rgbBuf[3] = rgb[1];
rgbBuf[5] = rgb[2];
Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
rgbBuf[1] = r;
rgbBuf[3] = g;
rgbBuf[5] = b;
return rgbBuf.join('');
};
@ -5243,7 +5243,7 @@ var PDFFunction = (function PDFFunctionClosure() {
var cachedValue = cache[key];
if (cachedValue !== undefined) {
cachedValue.set(dest, destOffset);
dest.set(cachedValue, destOffset);
return;
}
@ -5267,7 +5267,7 @@ var PDFFunction = (function PDFFunctionClosure() {
cache_available--;
cache[key] = output;
}
output.set(dest, destOffset);
dest.set(output, destOffset);
};
}
};
@ -9222,19 +9222,27 @@ var Pattern = (function PatternClosure() {
var dict = isStream(shading) ? shading.dict : shading;
var type = dict.get('ShadingType');
switch (type) {
case PatternType.AXIAL:
case PatternType.RADIAL:
// Both radial and axial shadings are handled by RadialAxial shading.
return new Shadings.RadialAxial(dict, matrix, xref, res);
case PatternType.FREE_FORM_MESH:
case PatternType.LATTICE_FORM_MESH:
case PatternType.COONS_PATCH_MESH:
case PatternType.TENSOR_PATCH_MESH:
return new Shadings.Mesh(shading, matrix, xref, res);
default:
UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern);
return new Shadings.Dummy();
try {
switch (type) {
case PatternType.AXIAL:
case PatternType.RADIAL:
// Both radial and axial shadings are handled by RadialAxial shading.
return new Shadings.RadialAxial(dict, matrix, xref, res);
case PatternType.FREE_FORM_MESH:
case PatternType.LATTICE_FORM_MESH:
case PatternType.COONS_PATCH_MESH:
case PatternType.TENSOR_PATCH_MESH:
return new Shadings.Mesh(shading, matrix, xref, res);
default:
throw new Error('Unknown PatternType: ' + type);
}
} catch (ex) {
if (ex instanceof MissingDataException) {
throw ex;
}
UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern);
warn(ex);
return new Shadings.Dummy();
}
};
return Pattern;
@ -9319,14 +9327,14 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
ratio[0] = i;
fn(ratio, 0, color, 0);
rgbColor = cs.getRgb(color, 0);
var cssColor = Util.makeCssRgb(rgbColor);
var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
colorStops.push([(i - t0) / diff, cssColor]);
}
var background = 'transparent';
if (dict.has('Background')) {
rgbColor = cs.getRgb(dict.get('Background'), 0);
background = Util.makeCssRgb(rgbColor);
background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
}
if (!extendStart) {
@ -10194,7 +10202,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var imgData = imageObj.createImageData(/* forceRGBA = */ false);
self.handler.send('obj', [objId, self.pageIndex, 'Image', imgData],
[imgData.data.buffer]);
}).then(null, function (reason) {
}).then(undefined, function (reason) {
warn('Unable to decode image: ' + reason);
self.handler.send('obj', [objId, self.pageIndex, 'Image', null]);
});
@ -33651,9 +33659,8 @@ var JpegImage = (function jpegImage() {
function decodeHuffman(tree) {
var node = tree;
var bit;
while ((bit = readBit()) !== null) {
node = node[bit];
while (true) {
node = node[readBit()];
if (typeof node === 'number') {
return node;
}
@ -33661,17 +33668,12 @@ var JpegImage = (function jpegImage() {
throw 'invalid huffman sequence';
}
}
return null;
}
function receive(length) {
var n = 0;
while (length > 0) {
var bit = readBit();
if (bit === null) {
return;
}
n = (n << 1) | bit;
n = (n << 1) | readBit();
length--;
}
return n;
@ -34030,7 +34032,7 @@ var JpegImage = (function jpegImage() {
// stage 3
// Shift v0 by 128.5 << 5 here, so we don't need to shift p0...p7 when
// converting to UInt8 range later.
// converting to UInt8 range later.
v0 = ((v0 + v1 + 1) >> 1) + 4112;
v1 = v0 - v1;
t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12;
@ -34387,8 +34389,7 @@ var JpegImage = (function jpegImage() {
}
}
// decodeTransform will contains pairs of multiplier (-256..256) and
// additive
// decodeTransform contains pairs of multiplier (-256..256) and additive
var transform = this.decodeTransform;
if (transform) {
for (i = 0; i < dataLength;) {
@ -34425,7 +34426,7 @@ var JpegImage = (function jpegImage() {
},
_convertYcckToRgb: function convertYcckToRgb(data) {
var Y, Cb, Cr, k, CbCb, CbCr, CbY, Cbk, CrCr, Crk, CrY, YY, Yk, kk;
var Y, Cb, Cr, k;
var offset = 0;
for (var i = 0, length = data.length; i < length; i += 4) {
Y = data[i];
@ -34433,43 +34434,35 @@ var JpegImage = (function jpegImage() {
Cr = data[i + 2];
k = data[i + 3];
CbCb = Cb * Cb;
CbCr = Cb * Cr;
CbY = Cb * Y;
Cbk = Cb * k;
CrCr = Cr * Cr;
Crk = Cr * k;
CrY = Cr * Y;
YY = Y * Y;
Yk = Y * k;
kk = k * k;
var r = - 122.67195406894 -
6.60635669420364e-5 * CbCb + 0.000437130475926232 * CbCr -
5.4080610064599e-5* CbY + 0.00048449797120281* Cbk -
0.154362151871126 * Cb - 0.000957964378445773 * CrCr +
0.000817076911346625 * CrY - 0.00477271405408747 * Crk +
1.53380253221734 * Cr + 0.000961250184130688 * YY -
0.00266257332283933 * Yk + 0.48357088451265 * Y -
0.000336197177618394 * kk + 0.484791561490776 * k;
var r = -122.67195406894 +
Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr -
5.4080610064599e-5 * Y + 0.00048449797120281 * k -
0.154362151871126) +
Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y -
0.00477271405408747 * k + 1.53380253221734) +
Y * (0.000961250184130688 * Y - 0.00266257332283933 * k +
0.48357088451265) +
k * (-0.000336197177618394 * k + 0.484791561490776);
var g = 107.268039397724 +
2.19927104525741e-5 * CbCb - 0.000640992018297945 * CbCr +
0.000659397001245577* CbY + 0.000426105652938837* Cbk -
0.176491792462875 * Cb - 0.000778269941513683 * CrCr +
0.00130872261408275 * CrY + 0.000770482631801132 * Crk -
0.151051492775562 * Cr + 0.00126935368114843 * YY -
0.00265090189010898 * Yk + 0.25802910206845 * Y -
0.000318913117588328 * kk - 0.213742400323665 * k;
Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr +
0.000659397001245577 * Y + 0.000426105652938837 * k -
0.176491792462875) +
Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y +
0.000770482631801132 * k - 0.151051492775562) +
Y * (0.00126935368114843 * Y - 0.00265090189010898 * k +
0.25802910206845) +
k * (-0.000318913117588328 * k - 0.213742400323665);
var b = - 20.810012546947 -
0.000570115196973677 * CbCb - 2.63409051004589e-5 * CbCr +
0.0020741088115012* CbY - 0.00288260236853442* Cbk +
0.814272968359295 * Cb - 1.53496057440975e-5 * CrCr -
0.000132689043961446 * CrY + 0.000560833691242812 * Crk -
0.195152027534049 * Cr + 0.00174418132927582 * YY -
0.00255243321439347 * Yk + 0.116935020465145 * Y -
0.000343531996510555 * kk + 0.24165260232407 * k;
var b = -20.810012546947 +
Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr +
0.0020741088115012 * Y - 0.00288260236853442 * k +
0.814272968359295) +
Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y +
0.000560833691242812 * k - 0.195152027534049) +
Y * (0.00174418132927582 * Y - 0.00255243321439347 * k +
0.116935020465145) +
k * (-0.000343531996510555 * k + 0.24165260232407);
data[offset++] = clamp0to255(r);
data[offset++] = clamp0to255(g);
@ -35027,6 +35020,23 @@ var JpxImage = (function JpxImageClosure() {
// Section B.6 Division resolution to precincts
var precinctWidth = 1 << dimensions.PPx;
var precinctHeight = 1 << dimensions.PPy;
// Jasper introduces codeblock groups for mapping each subband codeblocks
// to precincts. Precinct partition divides a resolution according to width
// and height parameters. The subband that belongs to the resolution level
// has a different size than the level, unless it is the zero resolution.
// From Jasper documentation: jpeg2000.pdf, section K: Tier-2 coding:
// The precinct partitioning for a particular subband is derived from a
// partitioning of its parent LL band (i.e., the LL band at the next higher
// resolution level)... The LL band associated with each resolution level is
// divided into precincts... Each of the resulting precinct regions is then
// mapped into its child subbands (if any) at the next lower resolution
// level. This is accomplished by using the coordinate transformation
// (u, v) = (ceil(x/2), ceil(y/2)) where (x, y) and (u, v) are the
// coordinates of a point in the LL band and child subband, respectively.
var isZeroRes = resolution.resLevel === 0;
var precinctWidthInSubband = 1 << (dimensions.PPx + (isZeroRes ? 0 : -1));
var precinctHeightInSubband = 1 << (dimensions.PPy + (isZeroRes ? 0 : -1));
var numprecinctswide = (resolution.trx1 > resolution.trx0 ?
Math.ceil(resolution.trx1 / precinctWidth) -
Math.floor(resolution.trx0 / precinctWidth) : 0);
@ -35034,18 +35044,15 @@ var JpxImage = (function JpxImageClosure() {
Math.ceil(resolution.try1 / precinctHeight) -
Math.floor(resolution.try0 / precinctHeight) : 0);
var numprecincts = numprecinctswide * numprecinctshigh;
var precinctXOffset = Math.floor(resolution.trx0 / precinctWidth) *
precinctWidth;
var precinctYOffset = Math.floor(resolution.try0 / precinctHeight) *
precinctHeight;
resolution.precinctParameters = {
precinctXOffset: precinctXOffset,
precinctYOffset: precinctYOffset,
precinctWidth: precinctWidth,
precinctHeight: precinctHeight,
numprecinctswide: numprecinctswide,
numprecinctshigh: numprecinctshigh,
numprecincts: numprecincts
numprecincts: numprecincts,
precinctWidthInSubband: precinctWidthInSubband,
precinctHeightInSubband: precinctHeightInSubband
};
}
function buildCodeblocks(context, subband, dimensions) {
@ -35072,18 +35079,21 @@ var JpxImage = (function JpxImageClosure() {
tbx1: codeblockWidth * (i + 1),
tby1: codeblockHeight * (j + 1)
};
// calculate precinct number
var pi = Math.floor((codeblock.tbx0 -
precinctParameters.precinctXOffset) /
precinctParameters.precinctWidth);
var pj = Math.floor((codeblock.tby0 -
precinctParameters.precinctYOffset) /
precinctParameters.precinctHeight);
precinctNumber = pj + pi * precinctParameters.numprecinctswide;
codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
// Calculate precinct number for this codeblock, codeblock position
// should be relative to its subband, use actual dimension and position
// See comment about codeblock group width and height
var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) /
precinctParameters.precinctWidthInSubband);
var pj = Math.floor((codeblock.tby0_ - subband.tby0) /
precinctParameters.precinctHeightInSubband);
precinctNumber = pi + (pj * precinctParameters.numprecinctswide);
codeblock.precinctNumber = precinctNumber;
codeblock.subbandType = subband.type;
codeblock.Lblock = 3;
@ -35248,6 +35258,7 @@ var JpxImage = (function JpxImageClosure() {
resolution.try0 = Math.ceil(component.tcy0 / scale);
resolution.trx1 = Math.ceil(component.tcx1 / scale);
resolution.try1 = Math.ceil(component.tcy1 / scale);
resolution.resLevel = r;
buildPrecincts(context, resolution, blocksDimensions);
resolutions.push(resolution);

View File

@ -110,7 +110,10 @@ var NetworkManager = (function NetworkManagerClosure() {
}
if (args.onProgressiveData) {
xhr.responseType = 'moz-chunked-arraybuffer';
// Some legacy browsers might throw an exception.
try {
xhr.responseType = 'moz-chunked-arraybuffer';
} catch(e) {}
if (xhr.responseType === 'moz-chunked-arraybuffer') {
pendingRequest.onProgressiveData = args.onProgressiveData;
pendingRequest.mozChunked = true;

View File

@ -188,6 +188,7 @@ select {
height: 100%;
overflow: hidden;
cursor: none;
-moz-user-select: none;
}
#viewerContainer:fullscreen {
@ -198,6 +199,7 @@ select {
height: 100%;
overflow: hidden;
cursor: none;
-moz-user-select: none;
}
:-moz-full-screen a:not(.internalLink) {
@ -549,8 +551,8 @@ html[dir='ltr'] .doorHangerRight:before {
color: #A6B7D0;
}
.notFound {
background-color: rgb(255, 137, 153);
#findInput.notFound {
background-color: rgb(255, 102, 102);
}
html[dir='ltr'] #toolbarViewerLeft {

View File

@ -41,8 +41,8 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</head>
<body tabindex="1">
<div id="outerContainer" class="loadingInProgress">
<body tabindex="1" class="loadingInProgress">
<div id="outerContainer">
<div id="sidebarContainer">
<div id="toolbarSidebar">
@ -211,14 +211,14 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<option id="pageFitOption" title="" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option>
<option id="pageWidthOption" title="" value="page-width" data-l10n-id="page_scale_width">Full Width</option>
<option id="customScaleOption" title="" value="custom"></option>
<option title="" value="0.5">50%</option>
<option title="" value="0.75">75%</option>
<option title="" value="1">100%</option>
<option title="" value="1.25">125%</option>
<option title="" value="1.5">150%</option>
<option title="" value="2">200%</option>
<option title="" value="3">300%</option>
<option title="" value="4">400%</option>
<option title="" value="0.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 50 }'>50%</option>
<option title="" value="0.75" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 75 }'>75%</option>
<option title="" value="1" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 100 }'>100%</option>
<option title="" value="1.25" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 125 }'>125%</option>
<option title="" value="1.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 150 }'>150%</option>
<option title="" value="2" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 200 }'>200%</option>
<option title="" value="3" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 300 }'>300%</option>
<option title="" value="4" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 400 }'>400%</option>
</select>
</span>
</div>

View File

@ -35,6 +35,7 @@ var VIEW_HISTORY_MEMORY = 20;
var SCALE_SELECT_CONTAINER_PADDING = 8;
var SCALE_SELECT_PADDING = 22;
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
PDFJS.imageResourcesPath = './images/';
PDFJS.workerSrc = '../build/pdf.worker.js';
@ -303,6 +304,7 @@ var ProgressBar = (function ProgressBarClosure() {
}
function ProgressBar(id, opts) {
this.visible = true;
// Fetch the sub-elements for later.
this.div = document.querySelector(id + ' .progress');
@ -356,8 +358,21 @@ var ProgressBar = (function ProgressBarClosure() {
},
hide: function ProgressBar_hide() {
if (!this.visible) {
return;
}
this.visible = false;
this.bar.classList.add('hidden');
this.bar.removeAttribute('style');
document.body.classList.remove('loadingInProgress');
},
show: function ProgressBar_show() {
if (this.visible) {
return;
}
this.visible = true;
document.body.classList.add('loadingInProgress');
this.bar.classList.remove('hidden');
}
};
@ -1893,6 +1908,11 @@ var PresentationMode = {
HandTool.enterPresentationMode();
this.contextMenuOpen = false;
this.container.setAttribute('contextmenu', 'viewerContextMenu');
// Text selection is disabled in Presentation Mode, thus it's not possible
// for the user to deselect text that is selected (e.g. with "Select all")
// when entering Presentation Mode, hence we remove any active selection.
window.getSelection().removeAllRanges();
},
exit: function presentationModeExit() {
@ -5177,6 +5197,24 @@ var PDFViewerApplication = {
// increases.
if (percent > this.loadingBar.percent || isNaN(percent)) {
this.loadingBar.percent = percent;
// When disableAutoFetch is enabled, it's not uncommon for the entire file
// to never be fetched (depends on e.g. the file structure). In this case
// the loading bar will not be completely filled, nor will it be hidden.
// To prevent displaying a partially filled loading bar permanently, we
// hide it when no data has been loaded during a certain amount of time.
if (PDFJS.disableAutoFetch && percent) {
if (this.disableAutoFetchLoadingBarTimeout) {
clearTimeout(this.disableAutoFetchLoadingBarTimeout);
this.disableAutoFetchLoadingBarTimeout = null;
}
this.loadingBar.show();
this.disableAutoFetchLoadingBarTimeout = setTimeout(function () {
this.loadingBar.hide();
this.disableAutoFetchLoadingBarTimeout = null;
}.bind(this), DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);
}
}
},
@ -5195,8 +5233,6 @@ var PDFViewerApplication = {
var downloadedPromise = pdfDocument.getDownloadInfo().then(function() {
self.downloadComplete = true;
self.loadingBar.hide();
var outerContainer = document.getElementById('outerContainer');
outerContainer.classList.remove('loadingInProgress');
});
var pagesCount = pdfDocument.numPages;
@ -6550,7 +6586,9 @@ window.addEventListener('scalechange', function scalechange(evt) {
var predefinedValueFound = selectScaleOption('' + evt.scale);
if (!predefinedValueFound) {
customScaleOption.textContent = Math.round(evt.scale * 10000) / 100 + '%';
var customScale = Math.round(evt.scale * 10000) / 100;
customScaleOption.textContent =
mozL10n.get('page_scale_percent', { scale: customScale }, '{{scale}}%');
customScaleOption.selected = true;
}
updateViewarea();
@ -6628,9 +6666,9 @@ window.addEventListener('keydown', function keydown(evt) {
if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
// either CTRL or META key with optional SHIFT.
var pdfViewer = PDFViewerApplication.pdfViewer;
var inPresentationMode =
pdfViewer.presentationModeState === PresentationModeState.CHANGING ||
pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN;
var inPresentationMode = pdfViewer &&
(pdfViewer.presentationModeState === PresentationModeState.CHANGING ||
pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN);
switch (evt.keyCode) {
case 70: // f

View File

@ -140,6 +140,9 @@ page_scale_width=Page Width
page_scale_fit=Page Fit
page_scale_auto=Automatic Zoom
page_scale_actual=Actual Size
# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a
# numerical scale value.
page_scale_percent={{scale}}%
# Loading indicator messages
loading_error_indicator=Error