Enable the object-shorthand ESLint rule in src/display

Please see http://eslint.org/docs/rules/object-shorthand.

For the most part, these changes are of the search-and-replace kind, and the previously enabled `no-undef` rule should complement the tests in helping ensure that no stupid errors crept into to the patch.
This commit is contained in:
Jonas Jenwald 2017-04-25 16:17:18 +02:00
parent 7bee0c2aa3
commit 07b5574006
9 changed files with 69 additions and 66 deletions

View file

@ -182,7 +182,7 @@ var CachedCanvases = (function CachedCanvasesClosure() {
}
return canvasEntry;
},
clear: function () {
clear() {
for (var id in this.cache) {
var canvasEntry = this.cache[id];
this.canvasFactory.destroy(canvasEntry);
@ -688,7 +688,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var backdrop = smask.backdrop || null;
if (!smask.transferMap && WebGLUtils.isEnabled) {
var composed = WebGLUtils.composeSMask(layerCtx.canvas, mask,
{subtype: smask.subtype, backdrop: backdrop});
{ subtype: smask.subtype, backdrop, });
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.drawImage(composed, smask.offsetX, smask.offsetY);
return;
@ -1376,10 +1376,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var paths = this.pendingTextPaths || (this.pendingTextPaths = []);
paths.push({
transform: ctx.mozCurrentTransform,
x: x,
y: y,
fontSize: fontSize,
addToPath: addToPath
x,
y,
fontSize,
addToPath,
});
}
},
@ -1630,11 +1630,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var color = IR[1];
var baseTransform = this.baseTransform ||
this.ctx.mozCurrentTransform.slice();
var self = this;
var canvasGraphicsFactory = {
createCanvasGraphics: function (ctx) {
return new CanvasGraphics(ctx, self.commonObjs, self.objs,
self.canvasFactory);
createCanvasGraphics: (ctx) => {
return new CanvasGraphics(ctx, this.commonObjs, this.objs,
this.canvasFactory);
}
};
pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory,
@ -1812,10 +1811,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.smaskStack.push({
canvas: scratchCanvas.canvas,
context: groupCtx,
offsetX: offsetX,
offsetY: offsetY,
scaleX: scaleX,
scaleY: scaleY,
offsetX,
offsetY,
scaleX,
scaleY,
subtype: group.smask.subtype,
backdrop: group.smask.backdrop,
transferMap: group.smask.transferMap || null,
@ -1915,7 +1914,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var currentTransform = ctx.mozCurrentTransformInverse;
var position = this.getCanvasPosition(0, 0);
this.imageLayer.appendImage({
objId: objId,
objId,
left: position[0],
top: position[1],
width: w / currentTransform[0],
@ -1936,7 +1935,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) {
if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) {
glyph.compiled =
compileType3Glyph({data: img.data, width: width, height: height});
compileType3Glyph({ data: img.data, width, height, });
} else {
glyph.compiled = null;
}
@ -2123,7 +2122,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
if (this.imageLayer) {
var position = this.getCanvasPosition(0, -height);
this.imageLayer.appendImage({
imgData: imgData,
imgData,
left: position[0],
top: position[1],
width: width / currentTransform[0],
@ -2153,7 +2152,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
if (this.imageLayer) {
var position = this.getCanvasPosition(entry.x, entry.y);
this.imageLayer.appendImage({
imgData: imgData,
imgData,
left: position[0],
top: position[1],
width: w,