From 43a3e74e0cb975dd629df2a14a21c393fd6ade65 Mon Sep 17 00:00:00 2001 From: "arv@chromium.org" Date: Thu, 6 Jan 2011 00:31:26 +0000 Subject: DOMUI: Fix issue with the calculation of the index of a list item. This fixes issues where list items cannot be selected when zoomed out a bit. BUG=68670 TEST=Zoom out and select bookmarks Review URL: http://codereview.chromium.org/5978008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70566 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/resources/shared/js/cr/ui/list.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'chrome/browser/resources/shared') diff --git a/chrome/browser/resources/shared/js/cr/ui/list.js b/chrome/browser/resources/shared/js/cr/ui/list.js index 9a579d8..6fbe1cc 100644 --- a/chrome/browser/resources/shared/js/cr/ui/list.js +++ b/chrome/browser/resources/shared/js/cr/ui/list.js @@ -482,8 +482,9 @@ cr.define('cr.ui', function() { * @return {number} The index of the list item, or -1 if not found. */ getIndexOfListItem: function(item) { + var paddingTop = parseFloat(getComputedStyle(this).paddingTop); var cs = getComputedStyle(item); - var top = item.offsetTop - parseFloat(cs.marginTop); + var top = item.offsetTop - parseFloat(cs.marginTop) - paddingTop; var index = Math.floor(top / this.getItemHeight_()); var childIndex = index - this.firstIndex_ + 1; if (childIndex >= 0 && childIndex < this.children.length && -- cgit v1.1