Backed out changeset 716fc2e4f7d3 (bug 486821) on suspicion of causing intermittent leak orange.

This commit is contained in:
Boris Zbarsky 2009-04-09 12:02:55 -04:00
parent 423e6207f9
commit 89f22bb63c
2 changed files with 17 additions and 26 deletions

View File

@ -1038,11 +1038,11 @@
// Default the height to 0 if we have no rows to show
let height = 0;
if (numRows) {
let firstRowRect = rows[0].getBoundingClientRect();
let lastRowRect = rows[numRows - 1].getBoundingClientRect();
let lastRowShown = rows[numRows - 1];
// Calculate the height to have the first row to last row shown
height = lastRowRect.bottom - firstRowRect.top;
height = lastRowShown.boxObject.y + lastRowShown.boxObject.height -
rows[0].boxObject.y;
}
// Only update the height if we have a non-zero height and if it

View File

@ -58,14 +58,12 @@
</content>
<implementation>
<field name="_scrollbox">
document.getAnonymousElementByAttribute(this, "anonid", "main-box");
</field>
<field name="scrollBoxObject">
this._scrollbox.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
</field>
<field name="scrollBoxObject">null</field>
<constructor>
<![CDATA[
var x = document.getAnonymousElementByAttribute(this, "anonid", "main-box");
this.scrollBoxObject = x.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
// add a template build listener
if (this.builder)
this.builder.addListener(this._builderListener);
@ -189,19 +187,8 @@
<parameter name="aElement"/>
<body>
<![CDATA[
if (!aElement)
return;
var targetRect = aElement.getBoundingClientRect();
var scrollRect = this._scrollbox.getBoundingClientRect();
var offset = targetRect.top - scrollRect.top;
if (offset >= 0) {
// scrollRect.bottom wouldn't take a horizontal scroll bar into account
let scrollRectBottom = scrollRect.top + this._scrollbox.clientHeight;
offset = targetRect.bottom - scrollRectBottom;
if (offset <= 0)
return;
}
this._scrollbox.scrollTop += offset;
if (aElement)
this.scrollBoxObject.ensureElementIsVisible(aElement);
]]>
</body>
</method>
@ -474,7 +461,7 @@
<handler event="click">
<![CDATA[
// clicking into nothing should unselect
if (event.originalTarget == this._scrollbox) {
if (event.originalTarget.getAttribute("anonid") == "main-box") {
this.clearSelection();
this.currentItem = null;
}
@ -483,13 +470,17 @@
<handler event="MozSwipeGesture">
<![CDATA[
// Figure out where to scroll to
let targetHeight = 0;
let scrollBox = document.getAnonymousElementByAttribute(this, "anonid", "main-box");
// Only handle swipe gestures up and down
switch (event.direction) {
case event.DIRECTION_DOWN:
this._scrollbox.scrollTop = this._scrollbox.scrollHeight;
break;
targetHeight = scrollBox.scrollHeight;
// Fall through for actual action
case event.DIRECTION_UP:
this._scrollbox.scrollTop = 0;
scrollBox.scrollTop = targetHeight;
break;
}
]]>