Browse Source

Removes rest of 'no-else-return' comments.

Yury Delendik 8 years ago
parent
commit
77b7b84d1e
  1. 30
      src/display/font_loader.js
  2. 66
      web/pdf_page_view.js

30
src/display/font_loader.js

@ -360,25 +360,25 @@ var FontFaceObject = (function FontFaceObjectClosure() {
} }
FontFaceObject.prototype = { FontFaceObject.prototype = {
createNativeFontFace: function FontFaceObject_createNativeFontFace() { createNativeFontFace: function FontFaceObject_createNativeFontFace() {
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) { if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('MOZCENTRAL')) {
if (!this.data) { throw new Error('Not implemented: createNativeFontFace');
return null; }
}
if (this.options.disableFontFace) { if (!this.data) {
this.disableFontFace = true; return null;
return null; }
}
var nativeFontFace = new FontFace(this.loadedName, this.data, {}); if (this.options.disableFontFace) {
this.disableFontFace = true;
return null;
}
if (this.options.fontRegistry) { var nativeFontFace = new FontFace(this.loadedName, this.data, {});
this.options.fontRegistry.registerFont(this);
} if (this.options.fontRegistry) {
return nativeFontFace; this.options.fontRegistry.registerFont(this);
} else { // eslint-disable-line no-else-return
throw new Error('Not implemented: createNativeFontFace');
} }
return nativeFontFace;
}, },
createFontFaceRule: function FontFaceObject_createFontFaceRule() { createFontFaceRule: function FontFaceObject_createFontFaceRule() {

66
web/pdf_page_view.js

@ -624,43 +624,43 @@ var PDFPageView = (function PDFPageViewClosure() {
onRenderContinue: function (cont) { }, onRenderContinue: function (cont) { },
cancel: function () { }, cancel: function () { },
}; };
} else { // eslint-disable-line no-else-return }
var cancelled = false;
var ensureNotCancelled = function () { var cancelled = false;
if (cancelled) { var ensureNotCancelled = function () {
throw 'cancelled'; if (cancelled) {
} throw 'cancelled';
}; }
};
var self = this; var self = this;
var pdfPage = this.pdfPage; var pdfPage = this.pdfPage;
var SVGGraphics = pdfjsLib.SVGGraphics; var SVGGraphics = pdfjsLib.SVGGraphics;
var actualSizeViewport = this.viewport.clone({scale: CSS_UNITS}); var actualSizeViewport = this.viewport.clone({scale: CSS_UNITS});
var promise = pdfPage.getOperatorList().then(function (opList) { var promise = pdfPage.getOperatorList().then(function (opList) {
ensureNotCancelled();
var svgGfx = new SVGGraphics(pdfPage.commonObjs, pdfPage.objs);
return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) {
ensureNotCancelled(); ensureNotCancelled();
var svgGfx = new SVGGraphics(pdfPage.commonObjs, pdfPage.objs); self.svg = svg;
return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) { self.paintedViewport = actualSizeViewport;
ensureNotCancelled();
self.svg = svg; svg.style.width = wrapper.style.width;
self.paintedViewport = actualSizeViewport; svg.style.height = wrapper.style.height;
self.renderingState = RenderingStates.FINISHED;
svg.style.width = wrapper.style.width; wrapper.appendChild(svg);
svg.style.height = wrapper.style.height;
self.renderingState = RenderingStates.FINISHED;
wrapper.appendChild(svg);
});
}); });
});
return { return {
promise: promise, promise: promise,
onRenderContinue: function (cont) { onRenderContinue: function (cont) {
cont(); cont();
}, },
cancel: function () { cancel: function () {
cancelled = true; cancelled = true;
} }
}; };
}
}, },
/** /**

Loading…
Cancel
Save