Bug 1354145 - Make customize mode deal with drops in the padding around the panel contents, r=mikedeboer

MozReview-Commit-ID: BCi7odA3sth
This commit is contained in:
Gijs Kruitbosch
2017-06-28 23:46:15 +01:00
parent d94b7ec658
commit 392d4c1f73

View File

@@ -1112,6 +1112,10 @@ CustomizeMode.prototype = {
},
_addDragHandlers(aTarget) {
// Allow dropping on the padding of the arrow panel.
if (gPhotonStructure && aTarget.id == CustomizableUI.AREA_FIXED_OVERFLOW_PANEL) {
aTarget = this.document.getElementById("customization-panelHolder");
}
aTarget.addEventListener("dragstart", this, true);
aTarget.addEventListener("dragover", this, true);
aTarget.addEventListener("dragexit", this, true);
@@ -1128,6 +1132,11 @@ CustomizeMode.prototype = {
},
_removeDragHandlers(aTarget) {
// Remove handler from different target if it was added to
// allow dropping on the padding of the arrow panel.
if (gPhotonStructure && aTarget.id == CustomizableUI.AREA_FIXED_OVERFLOW_PANEL) {
aTarget = this.document.getElementById("customization-panelHolder");
}
aTarget.removeEventListener("dragstart", this, true);
aTarget.removeEventListener("dragover", this, true);
aTarget.removeEventListener("dragexit", this, true);
@@ -2195,6 +2204,14 @@ CustomizeMode.prototype = {
},
_getCustomizableParent(aElement) {
if (gPhotonStructure && aElement) {
// Deal with drag/drop on the padding of the panel in photon.
let containingPanelHolder = aElement.closest("#customization-panelHolder");
if (containingPanelHolder) {
return containingPanelHolder.firstChild;
}
}
let areas = CustomizableUI.areas;
areas.push(kPaletteId);
while (aElement) {
@@ -2203,6 +2220,7 @@ CustomizeMode.prototype = {
}
aElement = aElement.parentNode;
}
return null;
},