B2G/gecko/browser/components/thumbnails/PageThumbs.jsm
/**
   * Determines the crop size for a given content window.
   * @param aWindow The content window.
   * @param aCanvas The target canvas.
   * @return An array containing width, height and scale.
   */
Determines the crop size for a given content window.
@param aWindow The content window.
@param aCanvas The target canvas.
@return An array containing width, height and scale.
Determines the crop size for a given content window . @param aWindow The content window . @param aCanvas The target canvas . @return An array containing width height and scale .
function PageThumbs_determineCropSize(aWindow, aCanvas) {
    let sw = aWindow.innerWidth;
    let sh = aWindow.innerHeight;
    let {width: thumbnailWidth, height: thumbnailHeight} = aCanvas;
    let scale = Math.min(Math.max(thumbnailWidth / sw, thumbnailHeight / sh), 1);
    let scaledWidth = sw * scale;
    let scaledHeight = sh * scale;
    if (scaledHeight > thumbnailHeight)
      sh -= Math.floor(Math.abs(scaledHeight - thumbnailHeight) * scale);
    if (scaledWidth > thumbnailWidth)
      sw -= Math.floor(Math.abs(scaledWidth - thumbnailWidth) * scale);
    return [sw, sh, scale];
  }
function PageThumbs_determineCropSize ( aWindow , aCanvas ) { let sw = aWindow . innerWidth ; let sh = aWindow . innerHeight ; let { width : thumbnailWidth , height : thumbnailHeight } = aCanvas ; let scale = Math . min ( Math . max ( thumbnailWidth / sw , thumbnailHeight / sh ) , 1 ) ; let scaledWidth = sw * scale ; let scaledHeight = sh * scale ; if ( scaledHeight > thumbnailHeight ) sh -= Math . floor ( Math . abs ( scaledHeight - thumbnailHeight ) * scale ) ; if ( scaledWidth > thumbnailWidth ) sw -= Math . floor ( Math . abs ( scaledWidth - thumbnailWidth ) * scale ) ; return [ sw , sh , scale ] ; }
Determines the crop size for a given content window.
Determines the crop size for a given content window .