Bug 421315 - Just re-use autocomplete richlistitems instead of re-adjusting for no purpose. r=gavin, a1.9=mconnor

This commit is contained in:
edward.lee@engineering.uiuc.edu 2008-03-12 22:31:14 -07:00
Родитель c40712b247
Коммит 538c4d46de
1 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -938,7 +938,7 @@
var width = rect.right - rect.left;
this.setAttribute("width", width > 100 ? width : 100);
// invalidate() depends on the width attribute
this.invalidate();
this._invalidate();
this.openPopup(aElement, "after_start", 0, 0, false, false);
this.popupBoxObject.setConsumeRollupEvent(this.mInput.consumeRollupEvent);
@ -948,6 +948,18 @@
</method>
<method name="invalidate">
<body>
<![CDATA[
// Don't bother doing work if we're not even showing
if (!this.mPopupOpen)
return;
this._invalidate();
]]>
</body>
</method>
<method name="_invalidate">
<body>
<![CDATA[
// collapsed if no matches
@ -1021,6 +1033,14 @@
if (this._currentIndex < existingItemsCount) {
// re-use the existing item
item = this.richlistbox.childNodes[this._currentIndex];
// Completely re-use the existing richlistitem if it's the same
if (item.getAttribute("text") == trimmedSearchString &&
item.getAttribute("url") == url) {
item.collapsed = false;
this._currentIndex++;
continue;
}
}
else {
// need to create a new item