Fixes after rebase

This commit is contained in:
Kristijan Ribarić
2025-01-31 20:11:48 +01:00
parent d3a04d043b
commit 384e268516
2 changed files with 66 additions and 24 deletions

View File

@@ -327,6 +327,10 @@
}
const actualPin = this._pinsCache.find((pin) => pin.uuid === tab.getAttribute('zen-pin-id'));
if(!actualPin) {
return;
}
actualPin.position = tab.position;
await ZenPinnedTabsStorage.savePin(actualPin);
}
@@ -648,7 +652,7 @@
let moved = false;
let isVertical = true;
let isRegularTabs = false;
// Check for pinned tabs container
if (pinnedTabsTarget) {
if (!draggedTab.pinned) {
@@ -673,9 +677,11 @@
if (draggedTab.pinned && !draggedTab.hasAttribute("zen-essential")) {
gBrowser.unpinTab(draggedTab);
moved = true;
isRegularTabs = true;
} else if (draggedTab.hasAttribute("zen-essential")) {
this.removeEssentials(draggedTab);
moved = true;
isRegularTabs = true;
}
}
@@ -688,9 +694,12 @@
if (isVertical) {
const middleY = targetTab.screenY + rect.height / 2;
if (event.screenY > middleY) {
if(!isRegularTabs && event.screenY > middleY) {
newIndex++;
} else if(isRegularTabs && event.screenY < middleY) {
newIndex--;
}
} else {
const middleX = targetTab.screenX + rect.width / 2;
if (event.screenX > middleX) {

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0de37c4d15 100644
index 8aeb244ffca9f48661805f5b7d860b5896055562..49b01f6e645c07eece98c49e63ed17b5eb31daca 100644
--- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js
@@ -94,7 +94,7 @@
@@ -29,7 +29,40 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
let tabsPerRow = 0;
let position = 0;
for (let pinnedTab of pinnedTabs) {
@@ -1010,7 +1010,7 @@
@@ -859,6 +859,9 @@
}
let draggedTab = event.dataTransfer.mozGetDataAt(TAB_DROP_TYPE, 0);
+ if (draggedTab && effects === "move") {
+ gZenPinnedTabManager.applyDragoverClass(event, draggedTab);
+ }
if (
(effects == "move" || effects == "copy") &&
this == draggedTab.container &&
@@ -955,6 +958,7 @@
// eslint-disable-next-line complexity
on_drop(event) {
+ gZenPinnedTabManager.removeTabContainersDragoverClass();
var dt = event.dataTransfer;
var dropEffect = dt.dropEffect;
var draggedTab;
@@ -972,6 +976,14 @@
this._tabDropIndicator.hidden = true;
event.stopPropagation();
+ if (draggedTab && dropEffect == "move") {
+ let moved = gZenPinnedTabManager.moveToAnotherTabContainerIfNecessary(event, draggedTab);
+
+ if (moved) {
+ this._finishMoveTogetherSelectedTabs(draggedTab);
+ return;
+ }
+ }
if (draggedTab && dropEffect == "copy") {
// copy the dropped tab (wherever it's from)
let newIndex = this._getDropIndex(event);
@@ -1010,7 +1022,7 @@
}
} else {
let pinned = draggedTab.pinned;
@@ -38,7 +71,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
let tabs = this.visibleTabs.slice(
pinned ? 0 : numPinned,
pinned ? numPinned : undefined
@@ -1090,7 +1090,7 @@
@@ -1090,7 +1102,7 @@
let postTransitionCleanup = () => {
tab.removeAttribute("tabdrop-samewindow");
@@ -47,7 +80,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
if (dropIndex !== false) {
gBrowser.moveTabTo(tab, dropIndex);
if (!directionForward) {
@@ -1100,7 +1100,7 @@
@@ -1100,7 +1112,7 @@
gBrowser.syncThrobberAnimations(tab);
};
@@ -56,7 +89,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
postTransitionCleanup();
} else {
let onTransitionEnd = transitionendEvent => {
@@ -1263,7 +1263,8 @@
@@ -1263,7 +1275,8 @@
if (
dt.mozUserCancelled ||
dt.dropEffect != "none" ||
@@ -66,7 +99,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
) {
delete draggedTab._dragData;
return;
@@ -1512,7 +1513,7 @@
@@ -1512,7 +1525,7 @@
}
this.#allTabs = [
@@ -75,7 +108,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
...children,
];
return this.#allTabs;
@@ -1593,6 +1594,7 @@
@@ -1593,6 +1606,7 @@
}
this.#focusableItems = [
@@ -83,7 +116,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
...verticalPinnedTabsContainer.children,
...focusableItems,
];
@@ -1617,8 +1619,8 @@
@@ -1617,8 +1631,8 @@
#isContainerVerticalPinnedExpanded(tab) {
return (
this.verticalMode &&
@@ -94,7 +127,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
);
}
@@ -1816,7 +1818,7 @@
@@ -1816,7 +1830,7 @@
let rect = ele => {
return window.windowUtils.getBoundsWithoutFlushing(ele);
};
@@ -103,7 +136,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
if (tab && rect(tab).width <= this._tabClipWidth) {
this.setAttribute("closebuttons", "activetab");
} else {
@@ -1832,6 +1834,7 @@
@@ -1832,6 +1846,7 @@
this.arrowScrollbox.ensureElementIsVisible(selectedTab, aInstant);
}
@@ -111,7 +144,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
selectedTab._notselectedsinceload = false;
}
@@ -1879,7 +1882,7 @@
@@ -1879,7 +1894,7 @@
if (isEndTab && !this._hasTabTempMaxWidth) {
return;
}
@@ -120,7 +153,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
// Force tabs to stay the same width, unless we're closing the last tab,
// which case we need to let them expand just enough so that the overall
// tabbar width is the same.
@@ -1894,7 +1897,7 @@
@@ -1894,7 +1909,7 @@
let tabsToReset = [];
for (let i = numPinned; i < tabs.length; i++) {
let tab = tabs[i];
@@ -129,7 +162,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
if (!isEndTab) {
// keep tabs the same width
tab.style.transition = "none";
@@ -1963,13 +1966,13 @@
@@ -1963,13 +1978,13 @@
let verticalTabsContainer = document.getElementById(
"vertical-pinned-tabs-container"
);
@@ -146,7 +179,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
}
}
@@ -1993,7 +1996,7 @@
@@ -1993,7 +2008,7 @@
_positionPinnedTabs() {
let tabs = this.visibleTabs;
@@ -155,7 +188,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
let absPositionHorizontalTabs =
this.overflowing && tabs.length > numPinned && numPinned > 0;
@@ -2074,7 +2077,7 @@
@@ -2074,7 +2089,7 @@
return;
}
@@ -164,7 +197,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
let directionX = screenX > dragData.animLastScreenX;
let directionY = screenY > dragData.animLastScreenY;
@@ -2257,9 +2260,9 @@
@@ -2257,9 +2272,9 @@
}
let pinned = draggedTab.pinned;
@@ -176,7 +209,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
pinned ? numPinned : undefined
);
@@ -2502,8 +2505,8 @@
@@ -2502,8 +2517,8 @@
);
}
@@ -187,7 +220,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
return;
}
@@ -2668,9 +2671,9 @@
@@ -2668,9 +2683,9 @@
function newIndex(aTab, index) {
// Don't allow mixing pinned and unpinned tabs.
if (aTab.pinned) {
@@ -199,7 +232,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
}
}
@@ -2754,7 +2757,7 @@
@@ -2754,7 +2769,7 @@
}
_notifyBackgroundTab(aTab) {
@@ -208,7 +241,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
return;
}
@@ -2772,12 +2775,14 @@
@@ -2772,12 +2787,14 @@
selectedTab = {
left: selectedTab.left,
right: selectedTab.right,
@@ -224,7 +257,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
selectedTab,
];
})
@@ -2794,8 +2799,11 @@
@@ -2794,8 +2811,11 @@
delete this._lastTabToScrollIntoView;
// Is the new tab already completely visible?
if (
@@ -238,7 +271,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..94b6a5ee6b89965fc63a8e8d1075bd0d
) {
return;
}
@@ -2803,21 +2811,29 @@
@@ -2803,21 +2823,29 @@
if (this.arrowScrollbox.smoothScroll) {
// Can we make both the new tab and the selected tab completely visible?
if (