Bug 574443 - Commands and drag & drop stop working when bookmarks menu button moves across toolbars. r=dietrich

This commit is contained in:
Marco Bonardo 2010-06-24 16:47:10 -07:00
parent b4381ad302
commit 1540340d04

View file

@ -1062,7 +1062,7 @@ var PlacesStarButton = {
}; };
// This object handles the initlization and uninitlization of the bookmarks // This object handles the initialization and uninitialization of the bookmarks
// toolbar. updateState is called when the browser window is opened and // toolbar. updateState is called when the browser window is opened and
// after closing the toolbar customization dialog. // after closing the toolbar customization dialog.
let PlacesToolbarHelper = { let PlacesToolbarHelper = {
@ -1163,17 +1163,31 @@ let BookmarksMenuButton = {
let bookmarksToolbarItem = this.bookmarksToolbarItem; let bookmarksToolbarItem = this.bookmarksToolbarItem;
if (isElementVisible(bookmarksToolbarItem)) { if (isElementVisible(bookmarksToolbarItem)) {
bookmarksToolbarItem.appendChild(this.button); if (this.button.parentNode != bookmarksToolbarItem) {
this.resetView();
bookmarksToolbarItem.appendChild(this.button);
}
this.button.classList.add("bookmark-item"); this.button.classList.add("bookmark-item");
this.button.classList.remove("toolbarbutton-1"); this.button.classList.remove("toolbarbutton-1");
} }
else { else {
this.navbarButtonContainer.appendChild(this.button); if (this.button.parentNode != this.navbarButtonContainer) {
this.resetView();
this.navbarButtonContainer.appendChild(this.button);
}
this.button.classList.remove("bookmark-item"); this.button.classList.remove("bookmark-item");
this.button.classList.add("toolbarbutton-1"); this.button.classList.add("toolbarbutton-1");
} }
}, },
resetView: function BMB_resetView() {
// When an element with a placesView attached is removed and re-inserted,
// XBL reapplies the binding causing any kind of issues and possible leaks,
// so kill current view and let popupshowing generate a new one.
if (this.button._placesView)
this.button._placesView.uninit();
},
customizeStart: function BMB_customizeStart() { customizeStart: function BMB_customizeStart() {
var bmToolbarItem = this.bookmarksToolbarItem; var bmToolbarItem = this.bookmarksToolbarItem;
if (this.button.parentNode == bmToolbarItem) if (this.button.parentNode == bmToolbarItem)
@ -1181,6 +1195,7 @@ let BookmarksMenuButton = {
}, },
customizeDone: function BMB_customizeDone() { customizeDone: function BMB_customizeDone() {
this.resetView();
this.updatePosition(); this.updatePosition();
} }
}; };