Bug 323818: land previously reviewed (bug 305730, r=mconnor/doron) richlistbox changes that were only checked in on the branch, patch by Simon B�nzli <zeniko@gmail.com>

This commit is contained in:
gavin%gavinsharp.com 2006-03-14 13:53:36 +00:00
parent 90f8e80156
commit 68ce4617cc

View File

@ -312,7 +312,7 @@
y.value += this.scrollBoxObject.y;
// Partially visible items are also considered visible
return (aItem.boxObject.y + aItem.boxObject.height >= y.value) &&
return (aItem.boxObject.y + aItem.boxObject.height > y.value) &&
(aItem.boxObject.y < y.value + this.scrollBoxObject.height);
]]>
</body>
@ -345,12 +345,18 @@
this.scrollBoxObject.scrollBy(0, this.scrollBoxObject.height * aDirection);
// Figure out, how many items fully fit into the view port
// (measuring from the top of the currently selected one), and
// determine the index of the first one lying (partially) outside
// (including the currently selected one), and determine
// the index of the first one lying (partially) outside
var height = this.scrollBoxObject.height;
while (height >= 0 && index >= 0 && index < children.length) {
var actualIndex = (index > 0 && aDirection == -1) ? index - 1 : index;
height -= children[actualIndex].boxObject.height;
var border = currentItem.boxObject.y;
if (aDirection == -1)
border += currentItem.boxObject.height;
while (index >= 0 && index < children.length) {
var border2 = children[index].boxObject.y;
if (aDirection == -1)
border2 += children[index].boxObject.height;
if ((border2 - border) * aDirection > height)
break;
index += aDirection;
}
index -= aDirection;