Commit 3845217f authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

ui/list.js: prevent from position calculation with wrong position.

cr.ui.List.ensureAllItemSizesInCache() has manipulate elements and it has sometimes changed the scroll position and/or the client height unexceptionally.

To prevent it, this CL moves reading of the positions before ensureAllItemSizesInCache().

BUG=110140
TEST=manual on taskmanager.

Review URL: http://codereview.chromium.org/9318012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120032 0039d316-1c4b-4281-b951-d872f2087c98
parent f43970ab
...@@ -1048,6 +1048,10 @@ cr.define('cr.ui', function() { ...@@ -1048,6 +1048,10 @@ cr.define('cr.ui', function() {
return; return;
} }
// Save the previous positions before any manipulation of elements.
var scrollTop = this.scrollTop;
var clientHeight = this.clientHeight;
// Store all the item sizes into the cache in advance, to prevent // Store all the item sizes into the cache in advance, to prevent
// interleave measuring with mutating dom. // interleave measuring with mutating dom.
if (!this.fixedHeight_) if (!this.fixedHeight_)
...@@ -1059,8 +1063,6 @@ cr.define('cr.ui', function() { ...@@ -1059,8 +1063,6 @@ cr.define('cr.ui', function() {
var newCachedItems = {}; var newCachedItems = {};
var autoExpands = this.autoExpands_; var autoExpands = this.autoExpands_;
var scrollTop = this.scrollTop;
var clientHeight = this.clientHeight;
var itemsInViewPort = this.getItemsInViewPort(scrollTop, clientHeight); var itemsInViewPort = this.getItemsInViewPort(scrollTop, clientHeight);
// Draws the hidden rows just above/below the viewport to prevent // Draws the hidden rows just above/below the viewport to prevent
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment