зеркало из https://github.com/mozilla/gecko-dev.git
Bug 301435. Focus breaks when item removed from download manager. Patch by Doron Rosenberg. r+a=mconnor
This commit is contained in:
Родитель
e87f2bb708
Коммит
efb0f5b86e
|
@ -319,6 +319,17 @@
|
|||
listBox.goDown(); // Ensure viable initial focus position
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<deconstructor>
|
||||
<![CDATA[
|
||||
// when we are destructed and we are selected, unselect ourselves so
|
||||
// that richlistbox's selection doesn't point to something not in the DOM.
|
||||
if (this.selected) {
|
||||
this.control.clearSelection();
|
||||
}
|
||||
]]>
|
||||
</deconstructor>
|
||||
|
||||
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
|
|
|
@ -220,6 +220,11 @@ var gDownloadObserver = {
|
|||
// Add this download to the percentage average tally
|
||||
var dl = aSubject.QueryInterface(Components.interfaces.nsIDownload);
|
||||
gActiveDownloads.push(dl);
|
||||
|
||||
// now reset the richlistbox since the template was rebuilt
|
||||
gDownloadsView.clearSelection();
|
||||
gDownloadsView.focus();
|
||||
|
||||
break;
|
||||
case "xpinstall-download-started":
|
||||
var windowArgs = aSubject.QueryInterface(Components.interfaces.nsISupportsArray);
|
||||
|
@ -279,8 +284,18 @@ function onDownloadResume(aEvent)
|
|||
function onDownloadRemove(aEvent)
|
||||
{
|
||||
if (aEvent.target.removable) {
|
||||
var selectedIndex = gDownloadsView.selectedIndex;
|
||||
gDownloadManager.removeDownload(aEvent.target.id);
|
||||
|
||||
// now reset the richlistbox since the template was rebuilt
|
||||
gDownloadsView.clearSelection();
|
||||
if (selectedIndex >= gDownloadsView.getRowCount())
|
||||
gDownloadsView.selectedIndex = selectedIndex - 1;
|
||||
else
|
||||
gDownloadsView.selectedIndex = selectedIndex;
|
||||
|
||||
gDownloadsView.focus();
|
||||
|
||||
gDownloadViewController.onCommandUpdate();
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче