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

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

Issue 470983002: Gallery: Load gallery items by chunk on startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 4 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/gallery.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/mosaic_mode.js
diff --git a/ui/file_manager/gallery/js/mosaic_mode.js b/ui/file_manager/gallery/js/mosaic_mode.js
index eddee671b881702ec03d3a673a7cc80a4ba8281a..78af4d850dcf862ddb093100c611830646413fc1 100644
--- a/ui/file_manager/gallery/js/mosaic_mode.js
+++ b/ui/file_manager/gallery/js/mosaic_mode.js
@@ -437,6 +437,7 @@ Mosaic.prototype.onSplice_ = function(event) {
this.tiles_.splice.apply(this.tiles_, [index, 0].concat(newTiles));
this.initTiles_(newTiles);
+ this.scheduleLayout(Mosaic.LAYOUT_DELAY);
}
if (this.tiles_.length !== this.dataModel_.length)
@@ -776,7 +777,7 @@ Mosaic.Layout.prototype.getHeight = function() {
*/
Mosaic.Layout.prototype.getTiles = function() {
return Array.prototype.concat.apply([],
- this.columns_.map(function(c) { return c.getTiles() }));
+ this.columns_.map(function(c) { return c.getTiles(); }));
};
/**
@@ -852,8 +853,8 @@ Mosaic.Layout.prototype.add = function(tile, isLast) {
this.columns_.push(this.newColumn_);
this.newColumn_ = null;
- if (this.mode_ === Mosaic.Layout.MODE_FINAL) {
- this.getLastColumn_().layout();
+ if (this.mode_ === Mosaic.Layout.MODE_FINAL && isFinalColumn) {
+ this.commit_();
continue;
}
@@ -893,8 +894,6 @@ Mosaic.Layout.prototype.add = function(tile, isLast) {
* @private
*/
Mosaic.Layout.prototype.commit_ = function(opt_offsetX, opt_offsetY) {
- console.assert(this.mode_ !== Mosaic.Layout.MODE_FINAL,
- 'Did not expect final layout');
for (var i = 0; i !== this.columns_.length; i++) {
this.columns_[i].layout(opt_offsetX, opt_offsetY);
}
@@ -925,7 +924,7 @@ Mosaic.Layout.prototype.findHorizontalLayout_ = function() {
if (tiles.length === 1)
return null; // Single tile layout is always the same.
- var tileHeights = tiles.map(function(t) { return t.getMaxContentHeight() });
+ var tileHeights = tiles.map(function(t) { return t.getMaxContentHeight(); });
var minTileHeight = Math.min.apply(null, tileHeights);
for (var h = minTileHeight; h < this.viewportHeight_; h += minTileHeight) {
« no previous file with comments | « ui/file_manager/gallery/js/gallery.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698