Issue #2008 - Fix lint errors for src/util.js

This commit is contained in:
Jon Buckley 2013-01-31 18:33:38 -05:00
parent 4a292a310f
commit 3b3922764e

View File

@ -1,5 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals Cmd, DeviceCmykCS, Dict, globalScope, INFOS, MozBlobBuilder, Name, PDFJS, Ref, WARNINGS, verbosity */
/* Copyright 2012 Mozilla Foundation /* Copyright 2012 Mozilla Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -253,7 +254,7 @@ var Util = PDFJS.Util = (function UtilClosure() {
m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
m[6] * v[0] + m[7] * v[1] + m[8] * v[2] m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
]; ];
} };
// Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2) // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)
// For coordinate systems whose origin lies in the bottom-left, this // For coordinate systems whose origin lies in the bottom-left, this
@ -270,7 +271,7 @@ var Util = PDFJS.Util = (function UtilClosure() {
r[3] = rect[1]; r[3] = rect[1];
} }
return r; return r;
} };
// Returns a rectangle [x1, y1, x2, y2] corresponding to the // Returns a rectangle [x1, y1, x2, y2] corresponding to the
// intersection of rect1 and rect2. If no intersection, returns 'false' // intersection of rect1 and rect2. If no intersection, returns 'false'
@ -278,7 +279,7 @@ var Util = PDFJS.Util = (function UtilClosure() {
Util.intersect = function Util_intersect(rect1, rect2) { Util.intersect = function Util_intersect(rect1, rect2) {
function compare(a, b) { function compare(a, b) {
return a - b; return a - b;
}; }
// Order points along the axes // Order points along the axes
var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare), var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
@ -338,15 +339,15 @@ var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() {
case 270: case 270:
rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0;
break; break;
case 360: //case 360:
case 0: //case 0:
default: default:
rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1;
break; break;
} }
var offsetCanvasX, offsetCanvasY; var offsetCanvasX, offsetCanvasY;
var width, height; var width, height;
if (rotateA == 0) { if (rotateA === 0) {
offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
width = Math.abs(viewBox[3] - viewBox[1]) * scale; width = Math.abs(viewBox[3] - viewBox[1]) * scale;
@ -468,11 +469,11 @@ function isArray(v) {
} }
function isStream(v) { function isStream(v) {
return typeof v == 'object' && v != null && ('getChar' in v); return typeof v == 'object' && v !== null && v !== undefined && ('getChar' in v);
} }
function isArrayBuffer(v) { function isArrayBuffer(v) {
return typeof v == 'object' && v != null && ('byteLength' in v); return typeof v == 'object' && v !== null && v !== undefined && ('byteLength' in v);
} }
function isRef(v) { function isRef(v) {
@ -517,7 +518,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
this.error = null; this.error = null;
this.exception = null; this.exception = null;
// If you build a promise and pass in some data it's already resolved. // If you build a promise and pass in some data it's already resolved.
if (data != null) { if (data !== null && data !== undefined) {
this.isResolved = true; this.isResolved = true;
this._data = data; this._data = data;
this.hasData = true; this.hasData = true;
@ -528,7 +529,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
this.callbacks = []; this.callbacks = [];
this.errbacks = []; this.errbacks = [];
this.progressbacks = []; this.progressbacks = [];
}; }
/** /**
* Builds a promise that is resolved when all the passed in promises are * Builds a promise that is resolved when all the passed in promises are
* resolved. * resolved.