summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-29 22:34:03 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-29 22:34:03 +0000
commit963c15aa255a5e512aec7a434ee14a4f5be83d52 (patch)
treee876d4be4d29bee4c69e8486cbb9ba27816dfd0a /chrome/browser/resources
parent14bb2446f055b82b066918bf0c955a296696af0b (diff)
downloadchromium_src-963c15aa255a5e512aec7a434ee14a4f5be83d52.zip
chromium_src-963c15aa255a5e512aec7a434ee14a4f5be83d52.tar.gz
chromium_src-963c15aa255a5e512aec7a434ee14a4f5be83d52.tar.bz2
WebUI: adjust list redrawing to account for resizing lead items without scroll events.
BUG=76562 TEST=see bug; should not get empty space after certain interactions in cookie list Review URL: http://codereview.chromium.org/6731063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/shared/js/cr/ui/list.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/resources/shared/js/cr/ui/list.js b/chrome/browser/resources/shared/js/cr/ui/list.js
index 0f725fd..466c2bc 100644
--- a/chrome/browser/resources/shared/js/cr/ui/list.js
+++ b/chrome/browser/resources/shared/js/cr/ui/list.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -717,9 +717,17 @@ cr.define('cr.ui', function() {
var autoExpands = this.autoExpands_;
var firstIndex = autoExpands ? 0 : this.getIndexForListOffset_(scrollTop);
+ // This is a bit tricky. We take the minimum of the available items to
+ // show and the number we want to show, so as not to go off the end of the
+ // list. For the number we want to show, we take the maximum of the number
+ // that would fit without a differently-sized lead item, and with one. We
+ // do this so that if the size of the lead item changes without a scroll
+ // event to trigger redrawing the list, we won't end up with empty space.
var itemsInViewPort = autoExpands ? dataModel.length : Math.min(
dataModel.length - firstIndex,
- this.countItemsInRange_(firstIndex, scrollTop + clientHeight));
+ Math.max(
+ Math.ceil(clientHeight / itemHeight) + 1,
+ this.countItemsInRange_(firstIndex, scrollTop + clientHeight)));
var lastIndex = firstIndex + itemsInViewPort;
this.textContent = '';