mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 964204 - Australis - glitch when dragging in toolbars, r=jaws
--HG-- extra : rebase_source : 2121a53b1893b23bb51598e17a3e3ff0854c3cb9
This commit is contained in:
parent
dc23e6347a
commit
32e87646e9
@ -38,6 +38,8 @@ let gModuleName = "[CustomizeMode]";
|
||||
|
||||
let gDisableAnimation = null;
|
||||
|
||||
let gDraggingInToolbars;
|
||||
|
||||
function CustomizeMode(aWindow) {
|
||||
if (gDisableAnimation === null) {
|
||||
gDisableAnimation = Services.prefs.getPrefType(kPrefCustomizationAnimation) == Ci.nsIPrefBranch.PREF_BOOL &&
|
||||
@ -1052,6 +1054,8 @@ CustomizeMode.prototype = {
|
||||
this._dragOffset = {x: aEvent.clientX - itemCenter.x,
|
||||
y: aEvent.clientY - itemCenter.y};
|
||||
|
||||
gDraggingInToolbars = new Set();
|
||||
|
||||
// Hack needed so that the dragimage will still show the
|
||||
// item as it appeared before it was hidden.
|
||||
this._initializeDragAfterMove = function() {
|
||||
@ -1062,8 +1066,10 @@ CustomizeMode.prototype = {
|
||||
item.hidden = true;
|
||||
this._showPanelCustomizationPlaceholders();
|
||||
DragPositionManager.start(this.window);
|
||||
if (!isInToolbar && item.nextSibling) {
|
||||
this._setDragActive(item.nextSibling, "before", draggedItem.id, false);
|
||||
if (item.nextSibling) {
|
||||
this._setDragActive(item.nextSibling, "before", draggedItem.id, isInToolbar);
|
||||
} else if (isInToolbar && item.previousSibling) {
|
||||
this._setDragActive(item.previousSibling, "after", draggedItem.id, isInToolbar);
|
||||
}
|
||||
}
|
||||
this._initializeDragAfterMove = null;
|
||||
@ -1412,7 +1418,7 @@ CustomizeMode.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aItem.hasAttribute("dragover") != aValue) {
|
||||
if (aItem.getAttribute("dragover") != aValue) {
|
||||
aItem.setAttribute("dragover", aValue);
|
||||
|
||||
let window = aItem.ownerDocument.defaultView;
|
||||
@ -1420,6 +1426,14 @@ CustomizeMode.prototype = {
|
||||
if (!aInToolbar) {
|
||||
this._setGridDragActive(aItem, draggedItem, aValue);
|
||||
} else {
|
||||
let targetArea = this._getCustomizableParent(aItem);
|
||||
let makeSpaceImmediately = false;
|
||||
if (!gDraggingInToolbars.has(targetArea.id)) {
|
||||
gDraggingInToolbars.add(targetArea.id);
|
||||
let draggedWrapper = this.document.getElementById("wrapper-" + aDraggedItemId);
|
||||
let originArea = this._getCustomizableParent(draggedWrapper);
|
||||
makeSpaceImmediately = originArea == targetArea;
|
||||
}
|
||||
// Calculate width of the item when it'd be dropped in this position
|
||||
let width = this._getDragItemSize(aItem, draggedItem).width;
|
||||
let direction = window.getComputedStyle(aItem).direction;
|
||||
@ -1433,8 +1447,16 @@ CustomizeMode.prototype = {
|
||||
prop = "borderRightWidth";
|
||||
otherProp = "border-left-width";
|
||||
}
|
||||
if (makeSpaceImmediately) {
|
||||
aItem.setAttribute("notransition", "true");
|
||||
}
|
||||
aItem.style[prop] = width + 'px';
|
||||
aItem.style.removeProperty(otherProp);
|
||||
if (makeSpaceImmediately) {
|
||||
// Force a layout flush:
|
||||
aItem.getBoundingClientRect();
|
||||
aItem.removeAttribute("notransition");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1445,12 +1467,21 @@ CustomizeMode.prototype = {
|
||||
}
|
||||
let isToolbar = CustomizableUI.getAreaType(currentArea.id) == "toolbar";
|
||||
if (isToolbar) {
|
||||
if (aNoTransition) {
|
||||
aItem.setAttribute("notransition", "true");
|
||||
}
|
||||
aItem.removeAttribute("dragover");
|
||||
// Remove both property values in the case that the end padding
|
||||
// had been set.
|
||||
aItem.style.removeProperty("border-left-width");
|
||||
aItem.style.removeProperty("border-right-width");
|
||||
if (aNoTransition) {
|
||||
// Force a layout flush:
|
||||
aItem.getBoundingClientRect();
|
||||
aItem.removeAttribute("notransition");
|
||||
}
|
||||
} else {
|
||||
aItem.removeAttribute("dragover");
|
||||
if (aNextItem) {
|
||||
let nextArea = this._getCustomizableParent(aNextItem);
|
||||
if (nextArea == currentArea) {
|
||||
|
@ -117,7 +117,7 @@
|
||||
background-attachment: scroll, scroll, fixed, fixed, scroll;
|
||||
}
|
||||
|
||||
toolbarpaletteitem {
|
||||
toolbarpaletteitem[place="toolbar"] {
|
||||
transition: border-width 250ms ease-in-out;
|
||||
}
|
||||
|
||||
@ -132,6 +132,7 @@ toolbarpaletteitem[place="panel"] {
|
||||
}
|
||||
|
||||
toolbarpaletteitem[notransition].panel-customization-placeholder,
|
||||
toolbarpaletteitem[notransition][place="toolbar"],
|
||||
toolbarpaletteitem[notransition][place="palette"],
|
||||
toolbarpaletteitem[notransition][place="panel"] {
|
||||
transition: none;
|
||||
|
Loading…
Reference in New Issue
Block a user