Merge pull request #11723 from Snuffleupagus/no-shadow-src-display
Remove variable shadowing from the JavaScript files in the `src/display/` folder
This commit is contained in:
		
						commit
						c551c332ec
					
				@ -2343,7 +2343,7 @@ class WorkerTransport {
 | 
			
		||||
      this._onUnsupportedFeature.bind(this)
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    messageHandler.on("JpegDecode", data => {
 | 
			
		||||
    messageHandler.on("JpegDecode", ([imageUrl, components]) => {
 | 
			
		||||
      if (this.destroyed) {
 | 
			
		||||
        return Promise.reject(new Error("Worker was destroyed"));
 | 
			
		||||
      }
 | 
			
		||||
@ -2354,7 +2354,6 @@ class WorkerTransport {
 | 
			
		||||
        return Promise.reject(new Error('"document" is not defined.'));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const [imageUrl, components] = data;
 | 
			
		||||
      if (components !== 3 && components !== 1) {
 | 
			
		||||
        return Promise.reject(
 | 
			
		||||
          new Error("Only 3 components or 1 component can be returned")
 | 
			
		||||
 | 
			
		||||
@ -367,11 +367,11 @@ function compileType3Glyph(imgData) {
 | 
			
		||||
    c.scale(1 / width, -1 / height);
 | 
			
		||||
    c.translate(0, -height);
 | 
			
		||||
    c.beginPath();
 | 
			
		||||
    for (var i = 0, ii = outlines.length; i < ii; i++) {
 | 
			
		||||
      var o = outlines[i];
 | 
			
		||||
    for (let k = 0, kk = outlines.length; k < kk; k++) {
 | 
			
		||||
      var o = outlines[k];
 | 
			
		||||
      c.moveTo(o[0], o[1]);
 | 
			
		||||
      for (var j = 2, jj = o.length; j < jj; j += 2) {
 | 
			
		||||
        c.lineTo(o[j], o[j + 1]);
 | 
			
		||||
      for (let l = 2, ll = o.length; l < ll; l += 2) {
 | 
			
		||||
        c.lineTo(o[l], o[l + 1]);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    c.fill();
 | 
			
		||||
 | 
			
		||||
@ -115,13 +115,13 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
 | 
			
		||||
    }
 | 
			
		||||
    return value;
 | 
			
		||||
  }
 | 
			
		||||
  function rfc2231getparam(contentDisposition) {
 | 
			
		||||
  function rfc2231getparam(contentDispositionStr) {
 | 
			
		||||
    const matches = [];
 | 
			
		||||
    let match;
 | 
			
		||||
    // Iterate over all filename*n= and filename*n*= with n being an integer
 | 
			
		||||
    // of at least zero. Any non-zero number must not start with '0'.
 | 
			
		||||
    const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
 | 
			
		||||
    while ((match = iter.exec(contentDisposition)) !== null) {
 | 
			
		||||
    while ((match = iter.exec(contentDispositionStr)) !== null) {
 | 
			
		||||
      let [, n, quot, part] = match; // eslint-disable-line prefer-const
 | 
			
		||||
      n = parseInt(n, 10);
 | 
			
		||||
      if (n in matches) {
 | 
			
		||||
@ -205,11 +205,11 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
 | 
			
		||||
    //        ... but Firefox permits ? and space.
 | 
			
		||||
    return value.replace(
 | 
			
		||||
      /=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,
 | 
			
		||||
      function(_, charset, encoding, text) {
 | 
			
		||||
      function(matches, charset, encoding, text) {
 | 
			
		||||
        if (encoding === "q" || encoding === "Q") {
 | 
			
		||||
          // RFC 2047 section 4.2.
 | 
			
		||||
          text = text.replace(/_/g, " ");
 | 
			
		||||
          text = text.replace(/=([0-9a-fA-F]{2})/g, function(_, hex) {
 | 
			
		||||
          text = text.replace(/=([0-9a-fA-F]{2})/g, function(match, hex) {
 | 
			
		||||
            return String.fromCharCode(parseInt(hex, 16));
 | 
			
		||||
          });
 | 
			
		||||
          return textdecode(charset, text);
 | 
			
		||||
 | 
			
		||||
@ -292,13 +292,13 @@ class BaseRangeReader {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function createRequestOptions(url, headers) {
 | 
			
		||||
function createRequestOptions(parsedUrl, headers) {
 | 
			
		||||
  return {
 | 
			
		||||
    protocol: url.protocol,
 | 
			
		||||
    auth: url.auth,
 | 
			
		||||
    host: url.hostname,
 | 
			
		||||
    port: url.port,
 | 
			
		||||
    path: url.path,
 | 
			
		||||
    protocol: parsedUrl.protocol,
 | 
			
		||||
    auth: parsedUrl.auth,
 | 
			
		||||
    host: parsedUrl.hostname,
 | 
			
		||||
    port: parsedUrl.port,
 | 
			
		||||
    path: parsedUrl.path,
 | 
			
		||||
    method: "GET",
 | 
			
		||||
    headers,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@ -158,7 +158,7 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
 | 
			
		||||
      var x2_ = Math.round(Math.max(xa, xb));
 | 
			
		||||
      var j = rowSize * y + x1_ * 4;
 | 
			
		||||
      for (var x = x1_; x <= x2_; x++) {
 | 
			
		||||
        let k = (xa - x) / (xa - xb);
 | 
			
		||||
        k = (xa - x) / (xa - xb);
 | 
			
		||||
        if (k < 0) {
 | 
			
		||||
          k = 0;
 | 
			
		||||
        } else if (k > 1) {
 | 
			
		||||
 | 
			
		||||
@ -182,6 +182,17 @@ var renderTextLayer = (function renderTextLayerClosure() {
 | 
			
		||||
    capability.resolve();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function findPositiveMin(ts, offset, count) {
 | 
			
		||||
    let result = 0;
 | 
			
		||||
    for (let i = 0; i < count; i++) {
 | 
			
		||||
      const t = ts[offset++];
 | 
			
		||||
      if (t > 0) {
 | 
			
		||||
        result = result ? Math.min(t, result) : t;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return result;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function expand(task) {
 | 
			
		||||
    var bounds = task._bounds;
 | 
			
		||||
    var viewport = task._viewport;
 | 
			
		||||
@ -208,38 +219,28 @@ var renderTextLayer = (function renderTextLayerClosure() {
 | 
			
		||||
      // Finding intersections with expanded box.
 | 
			
		||||
      var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];
 | 
			
		||||
      var ts = new Float64Array(64);
 | 
			
		||||
      points.forEach(function(p, i) {
 | 
			
		||||
      points.forEach(function(p, j) {
 | 
			
		||||
        var t = Util.applyTransform(p, m);
 | 
			
		||||
        ts[i + 0] = c && (e.left - t[0]) / c;
 | 
			
		||||
        ts[i + 4] = s && (e.top - t[1]) / s;
 | 
			
		||||
        ts[i + 8] = c && (e.right - t[0]) / c;
 | 
			
		||||
        ts[i + 12] = s && (e.bottom - t[1]) / s;
 | 
			
		||||
        ts[j + 0] = c && (e.left - t[0]) / c;
 | 
			
		||||
        ts[j + 4] = s && (e.top - t[1]) / s;
 | 
			
		||||
        ts[j + 8] = c && (e.right - t[0]) / c;
 | 
			
		||||
        ts[j + 12] = s && (e.bottom - t[1]) / s;
 | 
			
		||||
 | 
			
		||||
        ts[i + 16] = s && (e.left - t[0]) / -s;
 | 
			
		||||
        ts[i + 20] = c && (e.top - t[1]) / c;
 | 
			
		||||
        ts[i + 24] = s && (e.right - t[0]) / -s;
 | 
			
		||||
        ts[i + 28] = c && (e.bottom - t[1]) / c;
 | 
			
		||||
        ts[j + 16] = s && (e.left - t[0]) / -s;
 | 
			
		||||
        ts[j + 20] = c && (e.top - t[1]) / c;
 | 
			
		||||
        ts[j + 24] = s && (e.right - t[0]) / -s;
 | 
			
		||||
        ts[j + 28] = c && (e.bottom - t[1]) / c;
 | 
			
		||||
 | 
			
		||||
        ts[i + 32] = c && (e.left - t[0]) / -c;
 | 
			
		||||
        ts[i + 36] = s && (e.top - t[1]) / -s;
 | 
			
		||||
        ts[i + 40] = c && (e.right - t[0]) / -c;
 | 
			
		||||
        ts[i + 44] = s && (e.bottom - t[1]) / -s;
 | 
			
		||||
        ts[j + 32] = c && (e.left - t[0]) / -c;
 | 
			
		||||
        ts[j + 36] = s && (e.top - t[1]) / -s;
 | 
			
		||||
        ts[j + 40] = c && (e.right - t[0]) / -c;
 | 
			
		||||
        ts[j + 44] = s && (e.bottom - t[1]) / -s;
 | 
			
		||||
 | 
			
		||||
        ts[i + 48] = s && (e.left - t[0]) / s;
 | 
			
		||||
        ts[i + 52] = c && (e.top - t[1]) / -c;
 | 
			
		||||
        ts[i + 56] = s && (e.right - t[0]) / s;
 | 
			
		||||
        ts[i + 60] = c && (e.bottom - t[1]) / -c;
 | 
			
		||||
        ts[j + 48] = s && (e.left - t[0]) / s;
 | 
			
		||||
        ts[j + 52] = c && (e.top - t[1]) / -c;
 | 
			
		||||
        ts[j + 56] = s && (e.right - t[0]) / s;
 | 
			
		||||
        ts[j + 60] = c && (e.bottom - t[1]) / -c;
 | 
			
		||||
      });
 | 
			
		||||
      var findPositiveMin = function(ts, offset, count) {
 | 
			
		||||
        var result = 0;
 | 
			
		||||
        for (var i = 0; i < count; i++) {
 | 
			
		||||
          var t = ts[offset++];
 | 
			
		||||
          if (t > 0) {
 | 
			
		||||
            result = result ? Math.min(t, result) : t;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
      };
 | 
			
		||||
      // Not based on math, but to simplify calculations, using cos and sin
 | 
			
		||||
      // absolute values to not exceed the box (it can but insignificantly).
 | 
			
		||||
      var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user