Bug 343097 - Cleaner arrowscrollbox-clicktoscroll binding. r=sspitzer/mconnor.

This commit is contained in:
mozilla.mano%sent.com 2006-07-03 14:59:18 +00:00
Родитель 1e6f7fdd39
Коммит 4bf9a9e65b
5 изменённых файлов: 58 добавлений и 54 удалений

Просмотреть файл

@ -26,15 +26,13 @@
<binding id="arrowscrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
<content>
<xul:autorepeatbutton class="autorepeatbutton-up" collapsed="true" xbl:inherits="orient,clicktoscroll"
onclick="handleOnClick(event, -1);"
oncommand="handleOnCommand(event, -1);"/>
<xul:autorepeatbutton class="autorepeatbutton-up" collapsed="true" xbl:inherits="orient"
oncommand="scrollByPixels(this.scrollIncrement * -1)"/>
<xul:scrollbox xbl:inherits="orient,align,pack,dir" flex="1">
<children/>
</xul:scrollbox>
<xul:autorepeatbutton class="autorepeatbutton-down" collapsed="true" xbl:inherits="orient,clicktoscroll"
onclick="handleOnClick(event, 1);"
oncommand="handleOnCommand(event, 1);"/>
<xul:autorepeatbutton class="autorepeatbutton-down" collapsed="true" xbl:inherits="orient"
oncommand="scrollByPixels(this.scrollIncrement)"/>
</content>
<implementation>
@ -72,32 +70,7 @@
<body><![CDATA[
this.scrollBoxObject.ensureElementIsVisible(aElement);
]]></body>
</method>
<method name="handleOnCommand">
<parameter name="aEvent"/>
<parameter name="aMultiple"/>
<body><![CDATA[
// don't scroll on mouseover if clicktoscroll="true"
if (this.getAttribute("clicktoscroll") != "true") {
var px = this.scrollIncrement * aMultiple;
this.scrollByPixels(px);
aEvent.stopPropagation();
}
]]></body>
</method>
<method name="handleOnClick">
<parameter name="aEvent"/>
<parameter name="aMultiple"/>
<body><![CDATA[
// only scroll by index on click if clicktoscroll="true"
if (this.getAttribute("clicktoscroll") == "true") {
this.scrollByIndex(aMultiple);
aEvent.stopPropagation();
}
]]></body>
</method>
</method>
<method name="scrollByIndex">
<parameter name="lines"/>
@ -152,4 +125,21 @@
</content>
</binding>
<binding id="arrowscrollbox-clicktoscroll" extends="chrome://global/content/bindings/scrollbox.xml#arrowscrollbox">
<content>
<xul:toolbarbutton class="scrollbutton-up" collapsed="true"
xbl:inherits="orient"
oncommand="scrollByIndex(-1);"
anonid="scrollbutton-up"
chromedir="&locale.dir;"/>
<xul:scrollbox xbl:inherits="orient,align,pack,dir" flex="1">
<children/>
</xul:scrollbox>
<xul:toolbarbutton class="scrollbutton-down" collapsed="true"
xbl:inherits="orient"
anonid="scrollbutton-down"
oncommand="scrollByIndex(1);"
chromedir="&locale.dir;"/>
</content>
</binding>
</bindings>

Просмотреть файл

@ -1607,21 +1607,24 @@
<body>
<![CDATA[
if (aDragSession.canDrop && aDragSession.sourceNode) {
// autoscroll the tab strip if we drag over the autorepeat
var tabStrip = this.mTabContainer.mTabstrip;
// autoscroll the tab strip if we drag over the scroll
// buttons, even if we aren't dragging a tab, but then
// return to avoid drawing the drop indicator
var isTabDrag = (aDragSession.sourceNode.parentNode == this.mTabContainer);
var pixelsToScroll = 0;
var tabStrip = this.mTabContainer.mTabstrip;
if (aEvent.originalTarget.localName == "autorepeatbutton") {
if (aEvent.originalTarget.getAttribute("class") ==
"autorepeatbutton-up")
pixelsToScroll = tabStrip.scrollIncrement * -1;
else
pixelsToScroll = tabStrip.scrollIncrement;
var targetAnonid = aEvent.originalTarget.getAttribute("anonid");
if (targetAnonid == "scrollbutton-up") {
pixelsToScroll = tabStrip.scrollIncrement * -1;
tabStrip.scrollByPixels(pixelsToScroll);
}
else if (targetAnonid == "scrollbutton-down") {
pixelsToScroll = tabStrip.scrollIncrement;
tabStrip.scrollByPixels(pixelsToScroll);
}
var isTabDrag = (aDragSession.sourceNode.parentNode == this.mTabContainer);
if (!isTabDrag)
return;

Просмотреть файл

@ -933,6 +933,10 @@ arrowscrollbox {
-moz-binding: url("chrome://global/content/bindings/scrollbox.xml#arrowscrollbox");
}
arrowscrollbox[clicktoscroll="true"] {
-moz-binding: url("chrome://global/content/bindings/scrollbox.xml#arrowscrollbox-clicktoscroll");
}
autorepeatbutton {
-moz-binding: url("chrome://global/content/bindings/scrollbox.xml#autorepeatbutton");
}
@ -1103,4 +1107,3 @@ richlistbox {
richlistitem {
-moz-binding: url('chrome://global/content/bindings/richlistbox.xml#richlistitem');
}

Просмотреть файл

@ -1,24 +1,28 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/*
* Autorepeatbutton
* Scroll arrows
*/
.autorepeatbutton-up
.autorepeatbutton-up,
.scrollbutton-up
{
list-style-image : url("chrome://global/skin/arrow/arrow-lft-sharp.gif");
}
.autorepeatbutton-down
.autorepeatbutton-down,
.scrollbutton-down
{
list-style-image : url("chrome://global/skin/arrow/arrow-rit-sharp.gif");
}
.autorepeatbutton-up[orient="vertical"]
.autorepeatbutton-up[orient="vertical"],
.scrollbutton-up[orient="vertical"]
{
list-style-image : url("chrome://global/skin/arrow/arrow-up-sharp.gif");
}
.autorepeatbutton-down[orient="vertical"]
.autorepeatbutton-down[orient="vertical"],
.scrollbutton-down[orient="vertical"]
{
list-style-image : url("chrome://global/skin/arrow/arrow-dn-sharp.gif");
}
@ -30,4 +34,3 @@ autorepeatbutton
margin : 1px 2px 2px 1px;
padding : 4px;
}

Просмотреть файл

@ -1,34 +1,39 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/*
* Autorepeatbutton
* Scroll arrows
*/
.autorepeatbutton-up, .autorepeatbutton-down[chromedir="rtl"]
.autorepeatbutton-up, .autorepeatbutton-down[chromedir="rtl"],
.scrollbutton-up, .scrollbutton-down[chromedir="rtl"]
{
list-style-image : url("chrome://global/skin/arrow/arrow-lft.gif");
-moz-image-region : auto; /* cut off inheritance */
}
.autorepeatbutton-down, .autorepeatbutton-up[chromedir="rtl"]
.autorepeatbutton-down, .autorepeatbutton-up[chromedir="rtl"],
.scrollbutton-down, .scrollbutton-up[chromedir="rtl"]
{
list-style-image : url("chrome://global/skin/arrow/arrow-rit.gif");
-moz-image-region : auto; /* cut off inheritance */
}
.autorepeatbutton-up[orient="vertical"]
.autorepeatbutton-up[orient="vertical"],
.scrollbutton-up[orient="vertical"]
{
list-style-image : url("chrome://global/skin/arrow/arrow-up.gif");
-moz-image-region : auto; /* cut off inheritance */
}
.autorepeatbutton-down[orient="vertical"]
.autorepeatbutton-down[orient="vertical"],
.scrollbutton-down[orient="vertical"]
{
list-style-image : url("chrome://global/skin/arrow/arrow-dn.gif");
-moz-image-region : auto; /* cut off inheritance */
}
autorepeatbutton,
autorepeatbutton[clicktoscroll="true"]:hover
.scrollbutton-up,
.scrollbutton-down
{
-moz-box-align : center;
-moz-box-pack : center;