--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -9,28 +9,17 @@
%treeDTD;
]>
<bindings id="treeBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
- <binding id="tree-base" extends="chrome://global/content/bindings/general.xml#basecontrol">
- <implementation>
- <method name="_isAccelPressed">
- <parameter name="aEvent"/>
- <body><![CDATA[
- return aEvent.getModifierState("Accel");
- ]]></body>
- </method>
- </implementation>
- </binding>
-
- <binding id="tree" extends="chrome://global/content/bindings/tree.xml#tree-base">
+ <binding id="tree" extends="chrome://global/content/bindings/general.xml#basecontrol">
<content hidevscroll="true" hidehscroll="true" clickthrough="never">
<children includes="treecols"/>
<xul:stack class="tree-stack" flex="1">
<xul:treerows class="tree-rows" flex="1" xbl:inherits="hidevscroll">
<children/>
</xul:treerows>
<xul:textbox anonid="input" class="tree-input" left="0" top="0" hidden="true"/>
</xul:stack>
@@ -411,29 +400,29 @@
<parameter name="event"/>
<body>
<![CDATA[
event.preventDefault();
if (this.view.rowCount == 0)
return;
- if (this._isAccelPressed(event) && this.view.selection.single) {
+ if (event.getModifierState("Accel") && this.view.selection.single) {
this.treeBoxObject.scrollByLines(offset);
return;
}
var c = this.currentIndex + offset;
if (offset > 0 ? c > edge : c < edge) {
if (this.view.selection.isSelected(edge) && this.view.selection.count <= 1)
return;
c = edge;
}
- if (!this._isAccelPressed(event))
+ if (!event.getModifierState("Accel"))
this.view.selection.timedSelect(c, this._selectDelay);
else // Ctrl+Up/Down moves the anchor without selecting
this.currentIndex = c;
this.treeBoxObject.ensureRowIsVisible(c);
]]>
</body>
</method>
@@ -464,17 +453,17 @@
if (c == edge) {
if (this.view.selection.isSelected(c))
return;
}
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, c + offset,
- this._isAccelPressed(event));
+ event.getModifierState("Accel"));
this.treeBoxObject.ensureRowIsVisible(c + offset);
]]>
</body>
</method>
<method name="_moveByPage">
<parameter name="offset"/>
@@ -482,17 +471,17 @@
<parameter name="event"/>
<body>
<![CDATA[
event.preventDefault();
if (this.view.rowCount == 0)
return;
- if (this.pageUpOrDownMovesSelection == this._isAccelPressed(event)) {
+ if (this.pageUpOrDownMovesSelection == event.getModifierState("Accel")) {
this.treeBoxObject.scrollByPages(offset);
return;
}
if (this.view.rowCount == 1 && !this.view.selection.isSelected(0)) {
this.view.selection.timedSelect(0, this._selectDelay);
return;
}
@@ -532,17 +521,17 @@
<body>
<![CDATA[
event.preventDefault();
if (this.view.rowCount == 0)
return;
if (this.view.rowCount == 1 && !this.view.selection.isSelected(0) &&
- !(this.pageUpOrDownMovesSelection == this._isAccelPressed(event))) {
+ !(this.pageUpOrDownMovesSelection == event.getModifierState("Accel"))) {
this.view.selection.timedSelect(0, this._selectDelay);
return;
}
if (this.view.selection.single)
return;
var c = this.currentIndex;
@@ -557,26 +546,26 @@
if (offset > 0) {
i += p - 1;
if (c >= i) {
i = c + p;
this.treeBoxObject.ensureRowIsVisible(i > edge ? edge : i);
}
// Extend the selection from the existing pivot, if any
- this.view.selection.rangedSelect(-1, i > edge ? edge : i, this._isAccelPressed(event));
+ this.view.selection.rangedSelect(-1, i > edge ? edge : i, event.getModifierState("Accel"));
} else {
if (c <= i) {
i = c <= p ? 0 : c - p;
this.treeBoxObject.ensureRowIsVisible(i);
}
// Extend the selection from the existing pivot, if any
- this.view.selection.rangedSelect(-1, i, this._isAccelPressed(event));
+ this.view.selection.rangedSelect(-1, i, event.getModifierState("Accel"));
}
]]>
</body>
</method>
<method name="_moveToEdge">
<parameter name="edge"/>
@@ -589,17 +578,17 @@
return;
if (this.view.selection.isSelected(edge) && this.view.selection.count == 1) {
this.currentIndex = edge;
return;
}
// Normal behaviour is to select the first/last row
- if (!this._isAccelPressed(event))
+ if (!event.getModifierState("Accel"))
this.view.selection.timedSelect(edge, this._selectDelay);
// In a multiselect tree Ctrl+Home/End moves the anchor
else if (!this.view.selection.single)
this.currentIndex = edge;
this.treeBoxObject.ensureRowIsVisible(edge);
]]>
@@ -622,17 +611,17 @@
}
if (this.view.selection.single ||
(this.view.selection.isSelected(edge)) && this.view.selection.isSelected(this.currentIndex))
return;
// Extend the selection from the existing pivot, if any.
// -1 doesn't work here, so using currentIndex instead
- this.view.selection.rangedSelect(this.currentIndex, edge, this._isAccelPressed(event));
+ this.view.selection.rangedSelect(this.currentIndex, edge, event.getModifierState("Accel"));
this.treeBoxObject.ensureRowIsVisible(edge);
]]>
</body>
</method>
<method name="_handleEnter">
<parameter name="event"/>
<body><![CDATA[
@@ -901,22 +890,22 @@
<handler event="keypress">
<![CDATA[
if (this._editingColumn)
return;
if (event.charCode == " ".charCodeAt(0)) {
var c = this.currentIndex;
if (!this.view.selection.isSelected(c) ||
- (!this.view.selection.single && this._isAccelPressed(event))) {
+ (!this.view.selection.single && event.getModifierState("Accel"))) {
this.view.selection.toggleSelect(c);
event.preventDefault();
}
} else if (!this.disableKeyNavigation && event.charCode > 0 &&
- !event.altKey && !this._isAccelPressed(event) &&
+ !event.altKey && !event.getModifierState("Accel") &&
!event.metaKey && !event.ctrlKey) {
var l = this._keyNavigate(event);
if (l >= 0) {
this.view.selection.timedSelect(l, this._selectDelay);
this.treeBoxObject.ensureRowIsVisible(l);
}
event.preventDefault();
}
@@ -939,17 +928,17 @@
Array.forEach(this.getElementsByTagName("splitter"), function(splitter) {
if (!splitter.hasAttribute("resizeafter"))
splitter.setAttribute("resizeafter", "farthest");
});
]]></constructor>
</implementation>
</binding>
- <binding id="treerows" extends="chrome://global/content/bindings/tree.xml#tree-base">
+ <binding id="treerows" extends="chrome://global/content/bindings/general.xml#basecontrol">
<content>
<xul:hbox flex="1" class="tree-bodybox">
<children/>
</xul:hbox>
<xul:scrollbar height="0" minwidth="0" minheight="0" orient="vertical" xbl:inherits="collapsed=hidevscroll" style="position:relative; z-index:2147483647;"
oncontextmenu="event.stopPropagation(); event.preventDefault();"
onclick="event.stopPropagation(); event.preventDefault();"
ondblclick="event.stopPropagation();"
@@ -978,17 +967,17 @@
else if (event.detail == 0)
tree.removeAttribute("hidevscroll");
event.stopPropagation();
]]>
</handler>
</handlers>
</binding>
- <binding id="treebody" extends="chrome://global/content/bindings/tree.xml#tree-base">
+ <binding id="treebody" extends="chrome://global/content/bindings/general.xml#basecontrol">
<implementation>
<constructor>
if ("_ensureColumnOrder" in this.parentNode)
this.parentNode._ensureColumnOrder();
</constructor>
<field name="_lastSelectedRow">
-1
@@ -996,17 +985,17 @@
</implementation>
<handlers>
<!-- If there is no modifier key, we select on mousedown, not
click, so that drags work correctly. -->
<handler event="mousedown" clickcount="1">
<![CDATA[
if (this.parentNode.disabled)
return;
- if (((!this._isAccelPressed(event) ||
+ if (((!event.getModifierState("Accel") ||
!this.parentNode.pageUpOrDownMovesSelection) &&
!event.shiftKey && !event.metaKey) ||
this.parentNode.view.selection.single) {
var b = this.parentNode.treeBoxObject;
var cell = b.getCellAt(event.clientX, event.clientY);
var view = this.parentNode.view;
// save off the last selected row
@@ -1066,17 +1055,17 @@
view.selection.select(parentIndex);
}
}
this.parentNode.changeOpenState(cell.row);
return;
}
if (!view.selection.single) {
- var augment = this._isAccelPressed(event);
+ var augment = event.getModifierState("Accel");
if (event.shiftKey) {
view.selection.rangedSelect(-1, cell.row, augment);
b.ensureRowIsVisible(cell.row);
return;
}
if (augment) {
view.selection.toggleSelect(cell.row);
b.ensureRowIsVisible(cell.row);
@@ -1130,17 +1119,17 @@
this.parentNode.changeOpenState(row);
]]>
</handler>
</handlers>
</binding>
<binding id="treecol-base"
- extends="chrome://global/content/bindings/tree.xml#tree-base">
+ extends="chrome://global/content/bindings/general.xml#basecontrol">
<implementation>
<constructor>
this.parentNode.parentNode._columnsDirty = true;
</constructor>
<property name="ordinal">
<getter><![CDATA[
var val = this.getAttribute("ordinal");
@@ -1348,17 +1337,17 @@
<binding id="treecol-image" extends="chrome://global/content/bindings/tree.xml#treecol-base">
<content>
<xul:image class="treecol-icon" xbl:inherits="src"/>
</content>
</binding>
<binding id="columnpicker" display="xul:button"
- extends="chrome://global/content/bindings/tree.xml#tree-base">
+ extends="chrome://global/content/bindings/general.xml#basecontrol">
<content>
<xul:image class="tree-columnpicker-icon"/>
<xul:menupopup anonid="popup">
<xul:menuseparator anonid="menuseparator"/>
<xul:menuitem anonid="menuitem" label="&restoreColumnOrder.label;"/>
</xul:menupopup>
</content>