From be7ca6d5cead19e207c4d88cc14a23a0304fca8a Mon Sep 17 00:00:00 2001 From: "sspitzer@mozilla.org" Date: Fri, 7 Dec 2007 09:50:45 -0800 Subject: [PATCH] fix for bug #406259: update 5 richlistitems at a time to improve url bar rich result utocomplete performance. r=gavin a=blocking-firefox-3+ p1/m10 --- toolkit/content/widgets/autocomplete.xml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/toolkit/content/widgets/autocomplete.xml b/toolkit/content/widgets/autocomplete.xml index ec3906829f24..ac9c36fc993c 100644 --- a/toolkit/content/widgets/autocomplete.xml +++ b/toolkit/content/widgets/autocomplete.xml @@ -847,6 +847,7 @@ 0 0 + 5 @@ -964,7 +965,11 @@ if (this._rowHeight && this.richlistbox.height != height) this.richlistbox.height = height; - if (this._currentIndex < this._matchCount) { + // process _chunkSize results at a time to increase performance + for (var i = 0; i < this._chunkSize; i++) { + if (this._currentIndex >= this._matchCount) + return; + var existingItemsCount = this.richlistbox.childNodes.length; var item; @@ -1014,14 +1019,10 @@ } this._currentIndex++; - - // yield after creating each item so that the UI is responsive - // note, when browser.urlbar.maxRichResults is small, this setTimeout() - // is not needed, and we could call this._appendCurrentResult() directly. - // but the bigger browser.urlbar.maxRichResults gets, this is necessary - // so that typing the url bar is responsive - setTimeout(function (self) { self._appendCurrentResult(); }, 0, this); } + + // yield after each batch of items so that typing the url bar is responsive + setTimeout(function (self) { self._appendCurrentResult(); }, 0, this); ]]>