diff options
author | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-19 14:36:50 +0000 |
---|---|---|
committer | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-19 14:36:50 +0000 |
commit | f97900b99b7097cdd2dec6c023691cdf139c73ff (patch) | |
tree | 26d87d6eaa47500320d842d2130953696a93cd4d /chrome | |
parent | 7f913ce323009e5e02dfb19e31c7ce31a464dbc7 (diff) | |
download | chromium_src-f97900b99b7097cdd2dec6c023691cdf139c73ff.zip chromium_src-f97900b99b7097cdd2dec6c023691cdf139c73ff.tar.gz chromium_src-f97900b99b7097cdd2dec6c023691cdf139c73ff.tar.bz2 |
[File Manager] Never overscale thumbnails.
BUG=131156
TEST=
Review URL: https://chromiumcodereview.appspot.com/10576012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/resources/file_manager/js/media/media_util.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/chrome/browser/resources/file_manager/js/media/media_util.js b/chrome/browser/resources/file_manager/js/media/media_util.js index 61c2a65..f0f6825 100644 --- a/chrome/browser/resources/file_manager/js/media/media_util.js +++ b/chrome/browser/resources/file_manager/js/media/media_util.js @@ -16,7 +16,6 @@ function ThumbnailLoader(imageUrl, opt_metadata) { this.thumbnailUrl_ = opt_metadata.thumbnail.url; this.fallbackUrl_ = genericIconUrl; this.transform_ = opt_metadata.thumbnail.transform; - this.fullImageWidth_ = opt_metadata.media && opt_metadata.media.width; } else if (FileType.isImage(imageUrl) && ThumbnailLoader.canUseImageUrl_(opt_metadata)) { this.thumbnailUrl_ = imageUrl; @@ -62,13 +61,13 @@ ThumbnailLoader.canUseImageUrl_ = function(metadata) { * accepts the image and the transform. * @param {function} opt_onError Error callback. */ -ThumbnailLoader.prototype.load = function(box, fill, opt_onSuccess, opt_onError) { +ThumbnailLoader.prototype.load = function( + box, fill, opt_onSuccess, opt_onError) { var img = box.ownerDocument.createElement('img'); img.onload = function() { util.applyTransform(box, this.transform_); ThumbnailLoader.centerImage_(box, img, fill, - this.transform_ && (this.transform_.rotate90 % 2 == 1), - this.fullImageWidth_); + this.transform_ && (this.transform_.rotate90 % 2 == 1)); if (opt_onSuccess) opt_onSuccess(img, this.transform_); box.textContent = ''; @@ -101,11 +100,9 @@ ThumbnailLoader.prototype.load = function(box, fill, opt_onSuccess, opt_onError) * @param {boolean} fill True: the image should fill the entire container, * false: the image should fully fit into the container. * @param {boolean} rotate True if the image should be rotated 90 degrees. - * @param {number} fullWidth The width of the full image. Might differ from - * img.width if img contains a thumbnail image. * @private */ -ThumbnailLoader.centerImage_ = function(box, img, fill, rotate, fullWidth) { +ThumbnailLoader.centerImage_ = function(box, img, fill, rotate) { var imageWidth = img.width; var imageHeight = img.height; @@ -125,9 +122,7 @@ ThumbnailLoader.centerImage_ = function(box, img, fill, rotate, fullWidth) { Math.max(fitScaleX, fitScaleY) : Math.min(fitScaleX, fitScaleY); - // If the full width is known make the image no wider than it. - var scaleLimit = fullWidth ? (fullWidth / imageWidth) : 1; - scale = Math.min(scale, scaleLimit); + scale = Math.min(scale, 1); // Never overscale. fractionX = imageWidth * scale / boxWidth; fractionY = imageHeight * scale / boxHeight; |