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

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/file_table.js

Issue 2172173002: Avoid generating negative width of columns when the view is too small. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test for testSetWidthAndkeepTotal. Created 4 years, 5 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/file_manager/foreground/js/ui/file_table_unittest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/ui/file_table.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_table.js b/ui/file_manager/file_manager/foreground/js/ui/file_table.js
index 3ed3a3fac911da998065540b5a06a086af7f3c3d..e5ef7831f4ab15f28d35085d8f6bee2c5e819445 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/file_table.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/file_table.js
@@ -57,7 +57,14 @@ FileTableColumnModel.prototype.applyColumnPositions_ = function(newPos) {
}
// Set the new width of columns
for (var i = 0; i < this.columns_.length; i++) {
- this.columns_[i].width = newPos[i + 1] - newPos[i];
+ if (!this.columns_[i].visible) {
+ this.columns_[i].width = 0;
+ } else {
+ // Make sure each cell has the minumum width. This is necessary when the
+ // window size is too small to contain all the columns.
+ this.columns_[i].width = Math.max(FileTableColumnModel.MIN_WIDTH_,
+ newPos[i + 1] - newPos[i]);
+ }
}
};
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/ui/file_table_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698