From a6aaac5c41da1d7a0dae4885a5b3b75beaca0609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Tue, 14 Apr 2009 08:37:26 +0200 Subject: [PATCH] Bug 487946 - scrollwheel scrolling in bookmarks menu slowed down. r=enn --- toolkit/content/widgets/scrollbox.xml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/toolkit/content/widgets/scrollbox.xml b/toolkit/content/widgets/scrollbox.xml index 8d0a5d44064..a1d9eeab35e 100644 --- a/toolkit/content/widgets/scrollbox.xml +++ b/toolkit/content/widgets/scrollbox.xml @@ -168,6 +168,8 @@ document.defaultView.getComputedStyle(this._scrollbox, "").direction == "rtl"; ]]> + null + @@ -200,10 +202,12 @@ this._stopSmoothScroll(); - if (aSmoothScroll != false && this.smoothScroll) + if (aSmoothScroll != false && this.smoothScroll) { + this._scrollTarget = element; this._smoothScrollByPixels(amountToScroll); - else + } else { this.scrollByPixels(amountToScroll); + } ]]> @@ -303,7 +307,7 @@ @@ -426,6 +431,16 @@ // because many users have a vertical scroll wheel but no // horizontal support. + // Each mouse scroll is expected to scroll event.detail items. If a + // previous scroll is still in progress because of smooth scrolling, + // we need to complete it before starting a new one. + if (this._scrollTarget) { + let elements = this._getScrollableElements(); + if (this._scrollTarget != elements[0] && + this._scrollTarget != elements[elements.length - 1]) + this.ensureElementIsVisible(this._scrollTarget, false); + } + this.scrollByIndex(event.detail); event.stopPropagation(); ]]>