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

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

Issue 2629133002: Avoid UI unresponsiveness when switching between large images. (Closed)
Patch Set: 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..685da4fa414323709b41bc3e08ec8960050ff70a 100644
--- a/ui/file_manager/gallery/js/gallery_item.js
+++ b/ui/file_manager/gallery/js/gallery_item.js
@@ -440,3 +440,23 @@ 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}
+ */
+GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS = 4e3 * 3e3;
fukino 2017/01/13 02:50:33 nit: prefer 4000 * 3000 for easier read.
yamaguchi 2017/01/13 12:25:39 Done.
+
+/**
+ * Whether the image requires long rendering time.
+ *
+ * @return {boolean}
+ */
+GalleryItem.prototype.requireLongRenderingTime = function() {
+ var numPixels = this.metadataItem_.imageHeight *
oka 2017/01/13 04:23:19 I think imageHeight can be undefined. Maybe it's b
yamaguchi 2017/01/13 12:25:39 Done.
+ 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