Bug 883390 - Part 1.6 - Use grid.xml to manage mouse/touch selection for urlbar.xml. r=sfoster

--HG--
extra : rebase_source : 887649e4ad410a003c3094f7887e579f4c24a5f4
This commit is contained in:
Jonathan Wilde 2013-07-15 11:42:02 -07:00
parent df0b69ad6d
commit 7cbe8ae476
2 changed files with 21 additions and 9 deletions

View File

@ -91,7 +91,14 @@
<![CDATA[
if(!this.isBound)
return;
if (this.controller)
if ("single" == this.getAttribute("seltype")) {
// we'll republish this as a selectionchange event on the grid
aEvent.stopPropagation();
this.selectItem(aItem);
}
if (this.controller && this.controller.handleItemClick)
this.controller.handleItemClick(aItem, aEvent);
]]>
</body>

View File

@ -737,9 +737,7 @@
if ((this._grid.isSelectionAtEnd && !aReverse) ||
(this._grid.isSelectionAtStart && aReverse)) {
let index = !aReverse ? 0 : this._otherGrid.itemCount - 1;
this._grid.clearSelection();
this._otherGrid.selectedIndex = index;
this._grid = this._otherGrid;
} else {
this._grid.offsetSelection(aReverse ? -1 : 1);
}
@ -787,12 +785,6 @@
<parameter name="aEvent"/>
<body>
<![CDATA[
// XXX this should probably be supported in grid.xml
// somehow via some single-selection option.
if (this._grid) this._grid.clearSelection();
this._grid = aItem.control;
this._grid.selectedIndex = this._grid.getIndexOfItem(aItem);
this.submitSelected();
]]>
</body>
@ -828,6 +820,19 @@
this.updateResults();
]]>
</handler>
<handler event="select">
<![CDATA[
let grid = event.originalTarget;
// If a selection was made on a different grid,
// remove selection from the current grid.
if (grid != this._grid) {
this._grid.clearSelection();
this._grid = this._otherGrid;
}
]]>
</handler>
</handlers>
</binding>
</bindings>