зеркало из https://github.com/mozilla/pjs.git
Bug 97787 Make scrolling menus (e.g. bookmarks) scroll using mousewheel r=jag sr=bryner a=sspitzer
This commit is contained in:
Родитель
33efefa39e
Коммит
bef0719a9b
|
@ -21,14 +21,32 @@
|
|||
|
||||
<binding id="arrowscrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
|
||||
<content>
|
||||
<xul:autorepeatbutton class="autorepeatbutton-up" scrolldir="up" collapsed="true"/>
|
||||
<xul:autorepeatbutton class="autorepeatbutton-up" collapsed="true"
|
||||
oncommand="this.parentNode.scrollByIndex(-1); event.preventBubble();"/>
|
||||
<xul:scrollbox xbl:inherits="orient,align,pack,dir" flex="1">
|
||||
<children/>
|
||||
</xul:scrollbox>
|
||||
<xul:autorepeatbutton class="autorepeatbutton-down" scrolldir="down" collapsed="true"/>
|
||||
<xul:autorepeatbutton class="autorepeatbutton-down" collapsed="true"
|
||||
oncommand="this.parentNode.scrollByIndex(1); event.preventBubble();"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="scrollByIndex">
|
||||
<parameter name="lines"/>
|
||||
<body><![CDATA[
|
||||
if (!("mScrollBoxObject" in this)) {
|
||||
var kids = document.getAnonymousNodes(this);
|
||||
this.mScrollBoxObject = kids[1].boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
}
|
||||
|
||||
this.mScrollBoxObject.scrollByIndex(lines);
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="DOMMouseScroll" action="this.scrollByIndex(event.detail); event.preventBubble();"/>
|
||||
|
||||
<handler event="underflow"><![CDATA[
|
||||
var kids = document.getAnonymousNodes(this);
|
||||
kids[0].collapsed = true;
|
||||
|
@ -49,19 +67,6 @@
|
|||
<content>
|
||||
<xul:image class="autorepeatbutton-icon"/>
|
||||
</content>
|
||||
|
||||
<handlers>
|
||||
<handler event="command"><![CDATA[
|
||||
if (!("mScrollBox" in this)) {
|
||||
var kids = document.getAnonymousNodes(parentNode);
|
||||
this.mScrollBox = kids[1];
|
||||
}
|
||||
|
||||
var dir = this.getAttribute("scrolldir");
|
||||
var bx = this.mScrollBox.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
bx.scrollByIndex(dir == "up" ? -1 : 1);
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
Загрузка…
Ссылка в новой задаче