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

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

Issue 853653004: Gallery: Add items to GalleryDataModel before loading their metadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 years, 8 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 | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | ui/file_manager/gallery/js/slide_mode.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/ribbon.js
diff --git a/ui/file_manager/gallery/js/ribbon.js b/ui/file_manager/gallery/js/ribbon.js
index e84dc0de7e970ea1f8fbf84fab11db08d49d8eac..7b829eeff699d8ac00086ff1629078f98e383541 100644
--- a/ui/file_manager/gallery/js/ribbon.js
+++ b/ui/file_manager/gallery/js/ribbon.js
@@ -189,12 +189,14 @@ Ribbon.prototype.onSplice_ = function(event) {
firstNode.previousSibling.removeAttribute('vanishing');
} else {
// Push a new item at the left end.
- var newThumbnail = this.renderThumbnail_(this.firstVisibleIndex_);
- newThumbnail.style.marginLeft = -(this.clientHeight - 2) + 'px';
- this.insertBefore(newThumbnail, this.firstChild);
- setTimeout(function() {
- newThumbnail.style.marginLeft = '0';
- }, 0);
+ if (this.firstVisibleIndex_ < this.dataModel_.length) {
+ var newThumbnail = this.renderThumbnail_(this.firstVisibleIndex_);
+ newThumbnail.style.marginLeft = -(this.clientHeight - 2) + 'px';
+ this.insertBefore(newThumbnail, this.firstChild);
+ setTimeout(function() {
+ newThumbnail.style.marginLeft = '0';
+ }, 0);
+ }
}
}
}
@@ -396,6 +398,8 @@ Ribbon.prototype.renderThumbnail_ = function(index) {
* @private
*/
Ribbon.prototype.setThumbnailImage_ = function(thumbnail, item) {
+ if (!item.getThumbnailMetadataItem())
+ return;
this.thumbnailModel_.get([item.getEntry()]).then(function(metadataList) {
var loader = new ThumbnailLoader(
item.getEntry(),
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | ui/file_manager/gallery/js/slide_mode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698