Bug 1454360 - Don't use the scrollByIndex method in the "popup-scrollbars" binding. r=Gijs
This changes the amount of scrolling done when dragging the pointer vertically outside of the area of <select> elements and XUL <menulist> elements, keeping it close to the current value based on the height of the contained elements.
MozReview-Commit-ID: 8r0KMFutOFS
--- a/toolkit/content/widgets/popup.xml
+++ b/toolkit/content/widgets/popup.xml
@@ -638,16 +638,17 @@
<binding id="popup-scrollbars" extends="chrome://global/content/bindings/popup.xml#popup">
<content>
<xul:scrollbox class="popup-internal-box" flex="1" orient="vertical" style="overflow: auto;">
<children/>
</xul:scrollbox>
</content>
<implementation>
+ <field name="AUTOSCROLL_DISTANCE">16</field>
<field name="AUTOSCROLL_INTERVAL">25</field>
<field name="NOT_DRAGGING">0</field>
<field name="DRAG_OVER_BUTTON">-1</field>
<field name="DRAG_OVER_POPUP">1</field>
<field name="_draggingState">this.NOT_DRAGGING</field>
<field name="_scrollTimer">0</field>
@@ -736,21 +737,21 @@
if (event.screenY > popupRect.top && event.screenY < popupRect.bottom) {
this._draggingState = this.DRAG_OVER_POPUP;
}
}
if (this._draggingState == this.DRAG_OVER_POPUP &&
(event.screenY <= popupRect.top || event.screenY >= popupRect.bottom)) {
let scrollAmount = event.screenY <= popupRect.top ? -1 : 1;
- this.scrollBox.scrollByIndex(scrollAmount);
+ this.scrollBox.scrollTop += this.AUTOSCROLL_DISTANCE * scrollAmount;
let win = this.ownerGlobal;
this._scrollTimer = win.setInterval(() => {
- this.scrollBox.scrollByIndex(scrollAmount);
+ this.scrollBox.scrollTop += this.AUTOSCROLL_DISTANCE * scrollAmount;
}, this.AUTOSCROLL_INTERVAL);
}
}
]]>
</handler>
</handlers>
</binding>
--- a/toolkit/content/widgets/scrollbox.xml
+++ b/toolkit/content/widgets/scrollbox.xml
@@ -16,25 +16,16 @@
</binding>
<binding id="scrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
<content>
<xul:box class="box-inherit scrollbox-innerbox" xbl:inherits="orient,align,pack,dir" flex="1">
<children/>
</xul:box>
</content>
-
- <implementation>
- <method name="scrollByIndex">
- <parameter name="index"/>
- <body>
- this.boxObject.scrollByIndex(index);
- </body>
- </method>
- </implementation>
</binding>
<binding id="arrowscrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
<content>
<xul:autorepeatbutton class="autorepeatbutton-up"
anonid="scrollbutton-up"
xbl:inherits="orient,collapsed=notoverflowing,disabled=scrolledtostart"
oncommand="_autorepeatbuttonScroll(event);"/>