зеркало из https://github.com/mozilla/gecko-dev.git
Bug 839627 - Update pdf.js to version 0.7.210. r=yury
This commit is contained in:
Родитель
10d62ecadf
Коммит
b1bbe62715
|
@ -1,4 +1,4 @@
|
|||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 0.7.180
|
||||
Current extension version is: 0.7.210
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* jshint esnext:true */
|
||||
/* globals Components, Services, XPCOMUtils, NetUtil, PrivateBrowsingUtils,
|
||||
dump */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -24,7 +27,7 @@ const Ci = Components.interfaces;
|
|||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
// True only if this is the version of pdf.js that is included with firefox.
|
||||
const MOZ_CENTRAL = true;
|
||||
const MOZ_CENTRAL = JSON.parse('true');
|
||||
const PDFJS_EVENT_ID = 'pdf.js.message';
|
||||
const PDF_CONTENT_TYPE = 'application/pdf';
|
||||
const PREF_PREFIX = 'pdfjs';
|
||||
|
@ -38,7 +41,7 @@ Cu.import('resource://gre/modules/NetUtil.jsm');
|
|||
XPCOMUtils.defineLazyModuleGetter(this, 'PrivateBrowsingUtils',
|
||||
'resource://gre/modules/PrivateBrowsingUtils.jsm');
|
||||
|
||||
let Svc = {};
|
||||
var Svc = {};
|
||||
XPCOMUtils.defineLazyServiceGetter(Svc, 'mime',
|
||||
'@mozilla.org/mime;1',
|
||||
'nsIMIMEService');
|
||||
|
@ -68,7 +71,7 @@ function getIntPref(pref, def) {
|
|||
}
|
||||
|
||||
function setStringPref(pref, value) {
|
||||
let str = Cc['@mozilla.org/supports-string;1']
|
||||
var str = Cc['@mozilla.org/supports-string;1']
|
||||
.createInstance(Ci.nsISupportsString);
|
||||
str.data = value;
|
||||
Services.prefs.setComplexValue(pref, Ci.nsISupportsString, str);
|
||||
|
@ -85,7 +88,7 @@ function getStringPref(pref, def) {
|
|||
function log(aMsg) {
|
||||
if (!getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false))
|
||||
return;
|
||||
let msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
||||
var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
||||
Services.console.logStringMessage(msg);
|
||||
dump(msg + '\n');
|
||||
}
|
||||
|
@ -107,7 +110,7 @@ function isEnabled() {
|
|||
// selected in the Application preferences.
|
||||
var handlerInfo = Svc.mime
|
||||
.getFromTypeAndExtension('application/pdf', 'pdf');
|
||||
return handlerInfo.alwaysAskBeforeHandling == false &&
|
||||
return !handlerInfo.alwaysAskBeforeHandling &&
|
||||
handlerInfo.preferredAction == Ci.nsIHandlerInfo.handleInternally;
|
||||
}
|
||||
// Always returns true for the extension since enabling/disabling is handled
|
||||
|
@ -189,6 +192,9 @@ PdfDataListener.prototype = {
|
|||
}
|
||||
},
|
||||
onprogress: function() {},
|
||||
get oncomplete() {
|
||||
return this.oncompleteCallback;
|
||||
},
|
||||
set oncomplete(value) {
|
||||
this.oncompleteCallback = value;
|
||||
if (this.isDataReady) {
|
||||
|
@ -209,7 +215,7 @@ function ChromeActions(domWindow, dataListener, contentDispositionFilename) {
|
|||
|
||||
ChromeActions.prototype = {
|
||||
isInPrivateBrowsing: function() {
|
||||
let docIsPrivate;
|
||||
var docIsPrivate, privateBrowsing;
|
||||
try {
|
||||
docIsPrivate = PrivateBrowsingUtils.isWindowPrivate(this.domWindow);
|
||||
} catch (x) {
|
||||
|
@ -218,8 +224,8 @@ ChromeActions.prototype = {
|
|||
if (typeof docIsPrivate === 'undefined') {
|
||||
// per-window Private Browsing is not supported, trying global service
|
||||
try {
|
||||
let privateBrowsing = Cc['@mozilla.org/privatebrowsing;1']
|
||||
.getService(Ci.nsIPrivateBrowsingService);
|
||||
privateBrowsing = Cc['@mozilla.org/privatebrowsing;1']
|
||||
.getService(Ci.nsIPrivateBrowsingService);
|
||||
docIsPrivate = privateBrowsing.privateBrowsingEnabled;
|
||||
} catch (x) {
|
||||
// unable to get nsIPrivateBrowsingService (e.g. not Firefox)
|
||||
|
@ -245,8 +251,8 @@ ChromeActions.prototype = {
|
|||
var frontWindow = Cc['@mozilla.org/embedcomp/window-watcher;1'].
|
||||
getService(Ci.nsIWindowWatcher).activeWindow;
|
||||
|
||||
let docIsPrivate = this.isInPrivateBrowsing();
|
||||
let netChannel = NetUtil.newChannel(blobUri);
|
||||
var docIsPrivate = this.isInPrivateBrowsing();
|
||||
var netChannel = NetUtil.newChannel(blobUri);
|
||||
if ('nsIPrivateBrowsingChannel' in Ci &&
|
||||
netChannel instanceof Ci.nsIPrivateBrowsingChannel) {
|
||||
netChannel.setPrivate(docIsPrivate);
|
||||
|
@ -259,7 +265,7 @@ ChromeActions.prototype = {
|
|||
}
|
||||
// Create a nsIInputStreamChannel so we can set the url on the channel
|
||||
// so the filename will be correct.
|
||||
let channel = Cc['@mozilla.org/network/input-stream-channel;1'].
|
||||
var channel = Cc['@mozilla.org/network/input-stream-channel;1'].
|
||||
createInstance(Ci.nsIInputStreamChannel);
|
||||
channel.QueryInterface(Ci.nsIChannel);
|
||||
channel.contentDisposition = Ci.nsIChannel.DISPOSITION_ATTACHMENT;
|
||||
|
@ -449,9 +455,9 @@ function RequestListener(actions) {
|
|||
RequestListener.prototype.receive = function(event) {
|
||||
var message = event.target;
|
||||
var doc = message.ownerDocument;
|
||||
var action = message.getUserData('action');
|
||||
var data = message.getUserData('data');
|
||||
var sync = message.getUserData('sync');
|
||||
var action = event.detail.action;
|
||||
var data = event.detail.data;
|
||||
var sync = event.detail.sync;
|
||||
var actions = this.actions;
|
||||
if (!(action in actions)) {
|
||||
log('Unknown action: ' + action);
|
||||
|
@ -459,20 +465,28 @@ RequestListener.prototype.receive = function(event) {
|
|||
}
|
||||
if (sync) {
|
||||
var response = actions[action].call(this.actions, data);
|
||||
message.setUserData('response', response, null);
|
||||
var detail = event.detail;
|
||||
detail.__exposedProps__ = {response: 'r'};
|
||||
detail.response = response;
|
||||
} else {
|
||||
var response;
|
||||
if (!message.getUserData('callback')) {
|
||||
if (!event.detail.callback) {
|
||||
doc.documentElement.removeChild(message);
|
||||
response = null;
|
||||
} else {
|
||||
response = function sendResponse(response) {
|
||||
message.setUserData('response', response, null);
|
||||
|
||||
var listener = doc.createEvent('HTMLEvents');
|
||||
listener.initEvent('pdf.js.response', true, false);
|
||||
return message.dispatchEvent(listener);
|
||||
}
|
||||
try {
|
||||
var listener = doc.createEvent('CustomEvent');
|
||||
listener.initCustomEvent('pdf.js.response', true, false,
|
||||
{response: response,
|
||||
__exposedProps__: {response: 'r'}});
|
||||
return message.dispatchEvent(listener);
|
||||
} catch (e) {
|
||||
// doc is no longer accessible because the requestor is already
|
||||
// gone. unloaded content cannot receive the response anyway.
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
actions[action].call(this.actions, data, response);
|
||||
}
|
||||
|
@ -623,9 +637,9 @@ PdfStreamConverter.prototype = {
|
|||
var domWindow = getDOMWindow(channel);
|
||||
// Double check the url is still the correct one.
|
||||
if (domWindow.document.documentURIObject.equals(aRequest.URI)) {
|
||||
let actions = new ChromeActions(domWindow, dataListener,
|
||||
var actions = new ChromeActions(domWindow, dataListener,
|
||||
contentDispositionFilename);
|
||||
let requestListener = new RequestListener(actions);
|
||||
var requestListener = new RequestListener(actions);
|
||||
domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
|
||||
requestListener.receive(event);
|
||||
}, false, true);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
|
||||
var PDFJS = {};
|
||||
PDFJS.version = '0.7.180';
|
||||
PDFJS.build = '3699c31';
|
||||
PDFJS.version = '0.7.210';
|
||||
PDFJS.build = '7f6456d';
|
||||
|
||||
(function pdfjsWrapper() {
|
||||
// Use strict in our context only - users might not want it
|
||||
|
@ -1598,7 +1598,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
|||
}
|
||||
|
||||
var gfx = new CanvasGraphics(params.canvasContext, this.commonObjs,
|
||||
this.objs, !this.pageInfo.disableTextLayer && params.textLayer);
|
||||
this.objs, params.textLayer);
|
||||
try {
|
||||
this.display(gfx, params.viewport, complete, continueCallback);
|
||||
} catch (e) {
|
||||
|
@ -3419,10 +3419,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
// Compatibility
|
||||
|
||||
beginCompat: function CanvasGraphics_beginCompat() {
|
||||
TODO('ignore undefined operators (should we do that anyway?)');
|
||||
// TODO ignore undefined operators (should we do that anyway?)
|
||||
},
|
||||
endCompat: function CanvasGraphics_endCompat() {
|
||||
TODO('stop ignoring undefined operators');
|
||||
// TODO stop ignoring undefined operators
|
||||
},
|
||||
|
||||
// Helper functions
|
||||
|
@ -14117,7 +14117,6 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
|
|||
var ownerPassword = stringToBytes(dict.get('O'));
|
||||
var userPassword = stringToBytes(dict.get('U'));
|
||||
var flags = dict.get('P');
|
||||
this.disableTextLayer = !(flags & 16);
|
||||
var revision = dict.get('R');
|
||||
var encryptMetadata = algorithm == 4 && // meaningful when V is 4
|
||||
dict.get('EncryptMetadata') !== false; // makes true as default value
|
||||
|
@ -15405,7 +15404,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
var lastChar = dict.get('LastChar') || maxCharIndex;
|
||||
|
||||
var fontName = descriptor.get('FontName');
|
||||
var baseFont = baseDict.get('BaseFont');
|
||||
var baseFont = dict.get('BaseFont');
|
||||
// Some bad pdf's have a string as the font name.
|
||||
if (isString(fontName)) {
|
||||
fontName = new Name(fontName);
|
||||
|
@ -15415,13 +15414,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
}
|
||||
|
||||
var fontNameStr = fontName && fontName.name;
|
||||
// 9.7.6.1
|
||||
if (type.name == 'CIDFontType0') {
|
||||
var cidEncoding = baseDict.get('Encoding');
|
||||
if (isName(cidEncoding)) {
|
||||
fontNameStr = fontNameStr + '-' + cidEncoding.name;
|
||||
}
|
||||
}
|
||||
var baseFontStr = baseFont && baseFont.name;
|
||||
if (fontNameStr !== baseFontStr) {
|
||||
warn('The FontDescriptor\'s FontName is "' + fontNameStr +
|
||||
|
@ -17867,6 +17859,7 @@ var Font = (function FontClosure() {
|
|||
codeIndices.push(codes[n].code);
|
||||
++end;
|
||||
++n;
|
||||
if (end === 0x10000) { break; }
|
||||
}
|
||||
ranges.push([start, end, codeIndices]);
|
||||
}
|
||||
|
@ -17877,15 +17870,20 @@ var Font = (function FontClosure() {
|
|||
function createCmapTable(glyphs, deltas) {
|
||||
var ranges = getRanges(glyphs);
|
||||
|
||||
var numTables = 1;
|
||||
var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
|
||||
var cmap = '\x00\x00' + // version
|
||||
string16(numTables) + // numTables
|
||||
'\x00\x03' + // platformID
|
||||
'\x00\x01' + // encodingID
|
||||
string32(4 + numTables * 8); // start of the table record
|
||||
|
||||
var trailingRangesCount = ranges[ranges.length - 1][1] < 0xFFFF ? 1 : 0;
|
||||
var segCount = ranges.length + trailingRangesCount;
|
||||
for (var i = ranges.length - 1; i >= 0; --i) {
|
||||
if (ranges[i][0] <= 0xFFFF) { break; }
|
||||
}
|
||||
var bmpLength = i + 1;
|
||||
|
||||
var trailingRangesCount = ranges[bmpLength - 1][1] < 0xFFFF ? 1 : 0;
|
||||
var segCount = bmpLength + trailingRangesCount;
|
||||
var segCount2 = segCount * 2;
|
||||
var searchRange = getMaxPower2(segCount) * 2;
|
||||
var searchEntry = Math.log(segCount) / Math.log(2);
|
||||
|
@ -17900,7 +17898,7 @@ var Font = (function FontClosure() {
|
|||
var bias = 0;
|
||||
|
||||
if (deltas) {
|
||||
for (var i = 0, ii = ranges.length; i < ii; i++) {
|
||||
for (var i = 0, ii = bmpLength; i < ii; i++) {
|
||||
var range = ranges[i];
|
||||
var start = range[0];
|
||||
var end = range[1];
|
||||
|
@ -17917,7 +17915,7 @@ var Font = (function FontClosure() {
|
|||
glyphsIds += string16(deltas[codes[j]]);
|
||||
}
|
||||
} else {
|
||||
for (var i = 0, ii = ranges.length; i < ii; i++) {
|
||||
for (var i = 0, ii = bmpLength; i < ii; i++) {
|
||||
var range = ranges[i];
|
||||
var start = range[0];
|
||||
var end = range[1];
|
||||
|
@ -17945,10 +17943,66 @@ var Font = (function FontClosure() {
|
|||
endCount + '\x00\x00' + startCount +
|
||||
idDeltas + idRangeOffsets + glyphsIds;
|
||||
|
||||
var format31012 = '';
|
||||
var header31012 = '';
|
||||
if (numTables > 1) {
|
||||
cmap += '\x00\x03' + // platformID
|
||||
'\x00\x0A' + // encodingID
|
||||
string32(4 + numTables * 8 +
|
||||
4 + format314.length); // start of the table record
|
||||
format31012 = '';
|
||||
if (deltas) {
|
||||
for (var i = 0, ii = ranges.length; i < ii; i++) {
|
||||
var range = ranges[i];
|
||||
var start = range[0];
|
||||
var codes = range[2];
|
||||
var code = deltas[codes[0]];
|
||||
for (var j = 1, jj = codes.length; j < jj; ++j) {
|
||||
if (deltas[codes[j]] !== deltas[codes[j - 1]] + 1) {
|
||||
var end = range[0] + j - 1;
|
||||
format31012 += string32(start) + // startCharCode
|
||||
string32(end) + // endCharCode
|
||||
string32(code); // startGlyphID
|
||||
start = end + 1;
|
||||
code = deltas[codes[j]];
|
||||
}
|
||||
}
|
||||
format31012 += string32(start) + // startCharCode
|
||||
string32(range[1]) + // endCharCode
|
||||
string32(code); // startGlyphID
|
||||
}
|
||||
} else {
|
||||
for (var i = 0, ii = ranges.length; i < ii; i++) {
|
||||
var range = ranges[i];
|
||||
var start = range[0];
|
||||
var codes = range[2];
|
||||
var code = codes[0];
|
||||
for (var j = 1, jj = codes.length; j < jj; ++j) {
|
||||
if (codes[j] !== codes[j - 1] + 1) {
|
||||
var end = range[0] + j - 1;
|
||||
format31012 += string32(start) + // startCharCode
|
||||
string32(end) + // endCharCode
|
||||
string32(code); // startGlyphID
|
||||
start = end + 1;
|
||||
code = codes[j];
|
||||
}
|
||||
}
|
||||
format31012 += string32(start) + // startCharCode
|
||||
string32(range[1]) + // endCharCode
|
||||
string32(code); // startGlyphID
|
||||
}
|
||||
}
|
||||
header31012 = '\x00\x0C' + // format
|
||||
'\x00\x00' + // reserved
|
||||
string32(format31012.length + 16) + // length
|
||||
'\x00\x00\x00\x00' + // language
|
||||
string32(format31012.length / 12); // nGroups
|
||||
}
|
||||
|
||||
return stringToArray(cmap +
|
||||
'\x00\x04' + // format
|
||||
string16(format314.length + 4) + // length
|
||||
format314);
|
||||
format314 + header31012 + format31012);
|
||||
}
|
||||
|
||||
function validateOS2Table(os2) {
|
||||
|
@ -33233,13 +33287,11 @@ var WorkerMessageHandler = {
|
|||
handler.on('GetPageRequest', function wphSetupGetPage(data) {
|
||||
var pageNumber = data.pageIndex + 1;
|
||||
var pdfPage = pdfModel.getPage(pageNumber);
|
||||
var encrypt = pdfModel.xref.encrypt;
|
||||
var page = {
|
||||
pageIndex: data.pageIndex,
|
||||
rotate: pdfPage.rotate,
|
||||
ref: pdfPage.ref,
|
||||
view: pdfPage.view,
|
||||
disableTextLayer: encrypt ? encrypt.disableTextLayer : false
|
||||
view: pdfPage.view
|
||||
};
|
||||
handler.send('GetPage', {pageInfo: page});
|
||||
});
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -271,7 +272,7 @@ var Stepper = (function StepperClosure() {
|
|||
else
|
||||
self.breakPoints.splice(self.breakPoints.indexOf(x), 1);
|
||||
StepperManager.saveBreakPoints(self.pageIndex, self.breakPoints);
|
||||
}
|
||||
};
|
||||
})(i);
|
||||
|
||||
breakCell.appendChild(cbox);
|
||||
|
@ -376,7 +377,7 @@ var Stats = (function Stats() {
|
|||
wrapper.appendChild(title);
|
||||
wrapper.appendChild(statsDiv);
|
||||
stats.push({ pageNumber: pageNumber, div: wrapper });
|
||||
stats.sort(function(a, b) { return a.pageNumber - b.pageNumber});
|
||||
stats.sort(function(a, b) { return a.pageNumber - b.pageNumber; });
|
||||
clear(this.panel);
|
||||
for (var i = 0, ii = stats.length; i < ii; ++i)
|
||||
this.panel.appendChild(stats[i].div);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* globals FirefoxCom */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -42,7 +43,8 @@
|
|||
return;
|
||||
|
||||
// get the related l10n object
|
||||
var data = getL10nData(element.dataset.l10nId);
|
||||
var key = element.dataset.l10nId;
|
||||
var data = getL10nData(key);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals PDFJS, PDFBug, FirefoxCom, Stats */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -62,7 +63,8 @@ function scrollIntoView(element, spot) {
|
|||
// producing the error. See also animationStartedClosure.
|
||||
var parent = element.offsetParent, offsetY = element.offsetTop;
|
||||
if (!parent) {
|
||||
error('offsetParent is not set -- cannot scroll');
|
||||
console.error('offsetParent is not set -- cannot scroll');
|
||||
return;
|
||||
}
|
||||
while (parent.clientHeight == parent.scrollHeight) {
|
||||
offsetY += parent.offsetTop;
|
||||
|
@ -156,6 +158,8 @@ var ProgressBar = (function ProgressBarClosure() {
|
|||
*/
|
||||
|
||||
var FirefoxCom = (function FirefoxComClosure() {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
/**
|
||||
* Creates an event that the extension is listening for and will
|
||||
|
@ -168,15 +172,13 @@ var FirefoxCom = (function FirefoxComClosure() {
|
|||
*/
|
||||
requestSync: function(action, data) {
|
||||
var request = document.createTextNode('');
|
||||
request.setUserData('action', action, null);
|
||||
request.setUserData('data', data, null);
|
||||
request.setUserData('sync', true, null);
|
||||
document.documentElement.appendChild(request);
|
||||
|
||||
var sender = document.createEvent('Events');
|
||||
sender.initEvent('pdf.js.message', true, false);
|
||||
var sender = document.createEvent('CustomEvent');
|
||||
sender.initCustomEvent('pdf.js.message', true, false,
|
||||
{action: action, data: data, sync: true});
|
||||
request.dispatchEvent(sender);
|
||||
var response = request.getUserData('response');
|
||||
var response = sender.detail.response;
|
||||
document.documentElement.removeChild(request);
|
||||
return response;
|
||||
},
|
||||
|
@ -190,16 +192,10 @@ var FirefoxCom = (function FirefoxComClosure() {
|
|||
*/
|
||||
request: function(action, data, callback) {
|
||||
var request = document.createTextNode('');
|
||||
request.setUserData('action', action, null);
|
||||
request.setUserData('data', data, null);
|
||||
request.setUserData('sync', false, null);
|
||||
if (callback) {
|
||||
request.setUserData('callback', callback, null);
|
||||
|
||||
document.addEventListener('pdf.js.response', function listener(event) {
|
||||
var node = event.target,
|
||||
callback = node.getUserData('callback'),
|
||||
response = node.getUserData('response');
|
||||
response = event.detail.response;
|
||||
|
||||
document.documentElement.removeChild(node);
|
||||
|
||||
|
@ -209,8 +205,10 @@ var FirefoxCom = (function FirefoxComClosure() {
|
|||
}
|
||||
document.documentElement.appendChild(request);
|
||||
|
||||
var sender = document.createEvent('HTMLEvents');
|
||||
sender.initEvent('pdf.js.message', true, false);
|
||||
var sender = document.createEvent('CustomEvent');
|
||||
sender.initCustomEvent('pdf.js.message', true, false,
|
||||
{action: action, data: data, sync: false,
|
||||
callback: callback});
|
||||
return request.dispatchEvent(sender);
|
||||
}
|
||||
};
|
||||
|
@ -2037,8 +2035,9 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||
};
|
||||
|
||||
this.draw = function pageviewDraw(callback) {
|
||||
if (this.renderingState !== RenderingStates.INITIAL)
|
||||
error('Must be in new state before drawing');
|
||||
if (this.renderingState !== RenderingStates.INITIAL) {
|
||||
console.error('Must be in new state before drawing');
|
||||
}
|
||||
|
||||
this.renderingState = RenderingStates.RUNNING;
|
||||
|
||||
|
@ -2208,7 +2207,7 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||
console.error(error);
|
||||
// Tell the printEngine that rendering this canvas/page has failed.
|
||||
// This will make the print proces stop.
|
||||
if ('abort' in object)
|
||||
if ('abort' in obj)
|
||||
obj.abort();
|
||||
else
|
||||
obj.done();
|
||||
|
@ -2290,7 +2289,7 @@ var ThumbnailView = function thumbnailView(container, pdfPage, id) {
|
|||
this.hasImage = false;
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
this.resume = null;
|
||||
}
|
||||
};
|
||||
|
||||
function getPageDrawContext() {
|
||||
var canvas = document.createElement('canvas');
|
||||
|
@ -2320,8 +2319,9 @@ var ThumbnailView = function thumbnailView(container, pdfPage, id) {
|
|||
};
|
||||
|
||||
this.draw = function thumbnailViewDraw(callback) {
|
||||
if (this.renderingState !== RenderingStates.INITIAL)
|
||||
error('Must be in new state before drawing');
|
||||
if (this.renderingState !== RenderingStates.INITIAL) {
|
||||
console.error('Must be in new state before drawing');
|
||||
}
|
||||
|
||||
this.renderingState = RenderingStates.RUNNING;
|
||||
if (this.hasImage) {
|
||||
|
@ -3041,7 +3041,7 @@ window.addEventListener('hashchange', function webViewerHashchange(evt) {
|
|||
|
||||
window.addEventListener('change', function webViewerChange(evt) {
|
||||
var files = evt.target.files;
|
||||
if (!files || files.length == 0)
|
||||
if (!files || files.length === 0)
|
||||
return;
|
||||
|
||||
// Read the local file into a Uint8Array.
|
||||
|
@ -3236,7 +3236,7 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
curElement = curElement.parentNode;
|
||||
}
|
||||
|
||||
if (cmd == 0) { // no control key pressed at all.
|
||||
if (cmd === 0) { // no control key pressed at all.
|
||||
switch (evt.keyCode) {
|
||||
case 38: // up arrow
|
||||
case 33: // pg up
|
||||
|
@ -3244,12 +3244,14 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
if (!PDFView.isFullscreen && PDFView.currentScaleValue !== 'page-fit') {
|
||||
break;
|
||||
}
|
||||
// in fullscreen mode falls throw here
|
||||
/* in fullscreen mode */
|
||||
/* falls through */
|
||||
case 37: // left arrow
|
||||
// horizontal scrolling using arrow keys
|
||||
if (PDFView.isHorizontalScrollbarEnabled) {
|
||||
break;
|
||||
}
|
||||
/* falls through */
|
||||
case 75: // 'k'
|
||||
case 80: // 'p'
|
||||
PDFView.page--;
|
||||
|
@ -3261,12 +3263,13 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
if (!PDFView.isFullscreen && PDFView.currentScaleValue !== 'page-fit') {
|
||||
break;
|
||||
}
|
||||
// in fullscreen mode falls throw here
|
||||
/* falls through */
|
||||
case 39: // right arrow
|
||||
// horizontal scrolling using arrow keys
|
||||
if (PDFView.isHorizontalScrollbarEnabled) {
|
||||
break;
|
||||
}
|
||||
/* falls through */
|
||||
case 74: // 'j'
|
||||
case 78: // 'n'
|
||||
PDFView.page++;
|
||||
|
|
Загрузка…
Ссылка в новой задаче