mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 886030 - Add events to toolbar change to help customizableui deal with appearing/disappearing toolbars, r=mconley
This commit is contained in:
parent
a4ee03cec4
commit
5d30f31f83
@ -4302,6 +4302,14 @@ function setToolbarVisibility(toolbar, isVisible) {
|
||||
|
||||
toolbar.setAttribute(hidingAttribute, !isVisible);
|
||||
document.persist(toolbar.id, hidingAttribute);
|
||||
let eventParams = {
|
||||
detail: {
|
||||
visible: isVisible
|
||||
},
|
||||
bubbles: true
|
||||
};
|
||||
let event = new CustomEvent("toolbarvisibilitychange", eventParams);
|
||||
toolbar.dispatchEvent(event);
|
||||
|
||||
PlacesToolbarHelper.init();
|
||||
BookmarkingUI.onToolbarVisibilityChange();
|
||||
|
@ -134,6 +134,8 @@ CustomizeMode.prototype = {
|
||||
this.visiblePalette.addEventListener("drop", this, true);
|
||||
this.visiblePalette.addEventListener("dragend", this, true);
|
||||
|
||||
window.gNavToolbox.addEventListener("toolbarvisibilitychange", this);
|
||||
|
||||
// Same goes for the menu button - if we're customizing, a click to the
|
||||
// menu button means a quick exit from customization mode.
|
||||
window.PanelUI.menuButton.addEventListener("click", this, false);
|
||||
@ -185,6 +187,8 @@ CustomizeMode.prototype = {
|
||||
|
||||
yield this.depopulatePalette();
|
||||
|
||||
window.gNavToolbox.removeEventListener("toolbarvisibilitychange", this);
|
||||
|
||||
window.PanelUI.mainView.removeEventListener("contextmenu", this, true);
|
||||
this.visiblePalette.removeEventListener("dragstart", this, true);
|
||||
this.visiblePalette.removeEventListener("dragover", this, true);
|
||||
@ -570,6 +574,15 @@ CustomizeMode.prototype = {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
_onToolbarVisibilityChange: function(aEvent) {
|
||||
let toolbar = aEvent.target;
|
||||
if (aEvent.detail.visible) {
|
||||
toolbar.setAttribute("customizing", "true");
|
||||
} else {
|
||||
toolbar.removeAttribute("customizing");
|
||||
}
|
||||
},
|
||||
|
||||
onWidgetMoved: function(aWidgetId, aArea, aOldPosition, aNewPosition) {
|
||||
this._onUIChange();
|
||||
},
|
||||
@ -601,6 +614,9 @@ CustomizeMode.prototype = {
|
||||
|
||||
handleEvent: function(aEvent) {
|
||||
switch(aEvent.type) {
|
||||
case "toolbarvisibilitychange":
|
||||
this._onToolbarVisibilityChange(aEvent);
|
||||
break;
|
||||
case "contextmenu":
|
||||
aEvent.preventDefault();
|
||||
aEvent.stopPropagation();
|
||||
|
Loading…
Reference in New Issue
Block a user