diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 5b7622b51d78..841268a177d3 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2016,13 +2016,17 @@ var personalToolbarDNDObserver = { if (navigator.platform != "Win32" && target.localName != "toolbarbutton") return; + // bail if dragging from the empty area of the bookmarks toolbar + if (target.localName == "hbox") + return + // a drag start is fired when leaving an open toolbarbutton(type=menu) // (see bug 143031) if (this.isContainer(target) && target.getAttribute("group") != "true") { if (this.isPlatformNotSupported) return; - if (!aEvent.shiftKey && !aEvent.altKey) + if (!aEvent.shiftKey && !aEvent.altKey && !aEvent.ctrlKey) return; // menus open on mouse down target.firstChild.hidePopup(); @@ -2091,7 +2095,7 @@ var personalToolbarDNDObserver = { //target = { parent: "NC:PersonalToolbarFolder", index: 1 }; } else { var orientation = bt.getBTOrientation(aEvent); - var selTarget = bt.getBTTarget(aEvent.originalTarget, orientation); + var selTarget = bt.getBTTarget(target, orientation); } const kDSIID = Components.interfaces.nsIDragService; @@ -2100,8 +2104,8 @@ var personalToolbarDNDObserver = { // hide the 'open in tab' menuseparator because bookmarks // can be inserted after it if they are dropped after the last bookmark // a more comprehensive fix would be in the menupopup template builder - var menuTarget = target.localName == "toolbarbutton" || - target.localName == "menu" && + var menuTarget = (target.localName == "toolbarbutton" || + target.localName == "menu") && orientation == BookmarksUtils.DROP_ON? target.lastChild:target.parentNode; if (menuTarget.hasChildNodes() && diff --git a/browser/components/bookmarks/content/bookmarks.js b/browser/components/bookmarks/content/bookmarks.js index 0b7d74a17f0b..63f73c1c4c91 100644 --- a/browser/components/bookmarks/content/bookmarks.js +++ b/browser/components/bookmarks/content/bookmarks.js @@ -1206,7 +1206,8 @@ var BookmarksUtils = { if (!aSelection.isValid[i]) continue; if (!BookmarksUtils.isChildOfContainer(aSelection.item[i], aTarget.parent) || - aAction == "move" && aSelection.parent[i] == aTarget.parent) + aAction == "move" && aSelection.parent[i] == aTarget.parent || + aSelection.isContainer[i]) isValid[i] = true; } return isValid; @@ -1243,7 +1244,7 @@ var BookmarksUtils = { }, ///////////////////////////////////////////////////////////////////////////// - // Returns true is the selection can be insert in aFolderURI + // Returns true if aSelection can be inserted in aFolder isValidTargetContainer: function (aFolder, aSelection) {