Bug 393006: Use a constant tab scrolling speed when holding down the scroll arrows. p=Michael Ventnor <ventnor.bugzilla@yahoo.com.au> r=enndeakin

This commit is contained in:
dtownsend@oxymoronical.com 2007-08-26 00:53:42 -07:00
parent 53c2650e67
commit 403ec0dd3b

View File

@ -120,7 +120,6 @@
document.defaultView.getComputedStyle(this._scrollbox, "").direction == "ltr";
</field>
<field name="_autorepeatSmoothScroll">false</field>
<method name="ensureElementIsVisible">
<parameter name="element"/>
<body><![CDATA[
@ -166,14 +165,8 @@
function processFrame(self) {
self.scrollBoxObject.scrollBy(scrollAmounts.shift(), 0);
if (!scrollAmounts.length) {
if (self._autorepeatSmoothScroll) {
var direction = self._isLTRScrollbox ? self._isScrolling : -self._isScrolling;
if (!scrollAmounts.length)
self._stopSmoothScroll();
self.scrollByIndex(direction);
} else
self._stopSmoothScroll();
}
}
// amountToScroll: total distance to scroll
@ -458,7 +451,10 @@
if (!document)
aTimer.cancel();
this.scrollByIndex(this._scrollIndex);
if (this.smoothScroll)
this.scrollByPixels(25 * this._scrollIndex);
else
this.scrollBoxObject.scrollByIndex(this._scrollIndex);
]]>
</body>
</method>
@ -466,10 +462,8 @@
<method name="_startScroll">
<parameter name="index"/>
<body><![CDATA[
if (this.smoothScroll)
this._autorepeatSmoothScroll = true;
else {
this._scrollIndex = index;
var scrollDelay = this.smoothScroll ? 60 : this._scrollDelay;
if (!this._scrollTimer)
this._scrollTimer =
Components.classes["@mozilla.org/timer;1"]
@ -478,10 +472,9 @@
this._scrollTimer.cancel();
this._scrollTimer.initWithCallback(this,
this._scrollDelay,
scrollDelay,
Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
}
this.scrollByIndex(index);
this.notify(this._scrollTimer);
this._mousedown = true;
]]>
</body>
@ -491,8 +484,12 @@
<body><![CDATA[
if (this._scrollTimer)
this._scrollTimer.cancel();
this._autorepeatSmoothScroll = false;
this._mousedown = false;
if (!this._scrollIndex || !this.smoothScroll)
return;
this.scrollByIndex(this._scrollIndex);
this._scrollIndex = 0;
]]></body>
</method>