diff options
author | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 07:08:51 +0000 |
---|---|---|
committer | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 07:08:51 +0000 |
commit | d8bd7dde5c4a70ca251816a294545de7be9f9881 (patch) | |
tree | 7621859c48a6b1062b236335c742108f43f38cbf /chrome | |
parent | dbacd88f808821cb2481dd5f770ad13a96c86e4e (diff) | |
download | chromium_src-d8bd7dde5c4a70ca251816a294545de7be9f9881.zip chromium_src-d8bd7dde5c4a70ca251816a294545de7be9f9881.tar.gz chromium_src-d8bd7dde5c4a70ca251816a294545de7be9f9881.tar.bz2 |
cr/ui/list.js: Set true to List.fixedHeight by default.
r113775 "cr/ui/list.js: Support rows with variable heights.
" added the property List.fixedHeight, but its default value have not been set explicitly. This CL set the default value as false, to behave list.js (and grid.js, which inherits list.js) as same way as before r113775 by default. It will fix the scrolling problem on FileManager Thumbnail view.
And this CL also includes a fast path in case of fixedHeight=true on cr.ui.List.getItemHeightByIndex_();
BUG=chromium-os:24384
TEST=manual testing on chromeos-chrome on Linux.
Review URL: http://codereview.chromium.org/8953020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/resources/shared/js/cr/ui/list.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/browser/resources/shared/js/cr/ui/list.js b/chrome/browser/resources/shared/js/cr/ui/list.js index 5aba5ac..daa745e 100644 --- a/chrome/browser/resources/shared/js/cr/ui/list.js +++ b/chrome/browser/resources/shared/js/cr/ui/list.js @@ -127,6 +127,15 @@ cr.define('cr.ui', function() { autoExpands_: false, /** + * Whether or not the rows on list have various heights. If true, all the + * rows have the same fixed height. Otherwise, each row resizes its height + * to accommodate all contents. + * @type {boolean} + * @private + */ + fixedHeight_: true, + + /** * Whether or not the list view has a blank space below the last row. * @type {boolean} * @private @@ -386,6 +395,10 @@ cr.define('cr.ui', function() { * @return {number} The height of the item. */ getItemHeightByIndex_: function(index) { + // If |this.fixedHeight_| is true, all the rows have same default height. + if (this.fixedHeight_) + return this.getDefaultItemHeight_(); + if (this.cachedItemSizes_[index]) return this.cachedItemSizes_[index].height; |