Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Unified Diff: ui/file_manager/gallery/js/gallery_item.js

Issue 2629133002: Avoid UI unresponsiveness when switching between large images. (Closed)
Patch Set: Remove @private from the constant to be consistent with others. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/file_manager/gallery/js/image_editor/image_view.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/gallery_item.js
diff --git a/ui/file_manager/gallery/js/gallery_item.js b/ui/file_manager/gallery/js/gallery_item.js
index 53c12eb474c56363269ab51e0ff33d58bf7abd98..6829538be0e8009c4123980adfbb03864b35cb0b 100644
--- a/ui/file_manager/gallery/js/gallery_item.js
+++ b/ui/file_manager/gallery/js/gallery_item.js
@@ -440,3 +440,27 @@ GalleryItem.prototype.rename = function(displayName) {
this.entry_ = entry;
}.bind(this));
};
+
+/**
+ * The threshold size of an image in pixels, which we always use thumbnail
+ * image for slide-in animation above this. This is a hack to avoid an UI
+ * unresponsiveness when switching between images.
+ * @type {number}
+ * @const
+ */
+GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS = 4000 * 3000;
+
+/**
+ * Whether the image requires long rendering time.
+ *
+ * @return {boolean}
+ */
+GalleryItem.prototype.requireLongRenderingTime = function() {
+ // Check for undefined values.
+ if (!this.metadataItem_ ||
+ !this.metadataItem_.imageHeight || !this.metadataItem_.imageWidth)
+ return false;
+ var numPixels = this.metadataItem_.imageHeight *
+ this.metadataItem_.imageWidth;
+ return numPixels > GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS;
+};
« no previous file with comments | « no previous file | ui/file_manager/gallery/js/image_editor/image_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698