Bug 867163 - Clear context actions when dismissing the appbar [r=sfoster]

This commit is contained in:
Matt Brubeck 2013-05-07 11:38:08 -07:00
Родитель 95482a2311
Коммит 2a67130728
4 изменённых файлов: 20 добавлений и 10 удалений

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

@ -257,7 +257,6 @@ TopSitesView.prototype = {
case "MozAppbarDismissing":
// clean up when the context appbar is dismissed - we don't remember selections
this._lastSelectedSites = null;
this._set.clearSelection();
}
},

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

@ -1,3 +1,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var Appbar = {
get appbar() { return document.getElementById('appbar'); },
get consoleButton() { return document.getElementById('console-button'); },
@ -13,6 +18,7 @@ var Appbar = {
init: function Appbar_init() {
window.addEventListener('MozAppbarShowing', this, false);
window.addEventListener('MozAppbarDismissing', this, false);
window.addEventListener('MozPrecisePointer', this, false);
window.addEventListener('MozImprecisePointer', this, false);
window.addEventListener('MozContextActionsChange', this, false);
@ -40,6 +46,13 @@ var Appbar = {
this._updatePinButton();
this._updateStarButton();
break;
case 'MozAppbarDismissing':
if (this.activeTileset) {
this.activeTileset.clearSelection();
}
this.clearContextualActions();
this.activeTileset = null;
break;
case 'MozPrecisePointer':
case 'MozImprecisePointer':
this._updateZoomButtons();
@ -162,7 +175,8 @@ var Appbar = {
}
}
},
showContextualActions: function(aVerbs){
showContextualActions: function(aVerbs) {
let doc = document;
// button element id to action verb lookup
let buttonsMap = new Map();
@ -195,6 +209,11 @@ var Appbar = {
}
});
},
clearContextualActions: function() {
this.showContextualActions([]);
},
_onTileSelectionChanged: function _onTileSelectionChanged(aEvent){
let activeTileset = aEvent.target;

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

@ -354,14 +354,7 @@ BookmarksView.prototype = {
for (let bookmarkId of this._toRemove) {
this._bookmarkService.removeItem(bookmarkId);
}
this._toRemove = null;
this._set.clearSelection();
// Clear context app bar
let event = document.createEvent("Events");
event.initEvent("MozContextActionsChange", true, false);
this._set.dispatchEvent(event);
}
break;

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

@ -194,7 +194,6 @@ HistoryView.prototype = {
this._set.dispatchEvent(event);
this._toRemove = null;
this._set.clearSelection();
}
break;