1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 17:39:59 +02:00

Fixed glance opening tabs

This commit is contained in:
mr. m 2025-02-06 11:13:59 +01:00
parent 1e624ae580
commit 23697a8930
No known key found for this signature in database
GPG key ID: 419302196C23B258
4 changed files with 2050 additions and 23 deletions

1916
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -67,7 +67,7 @@
} }
getTabPosition(tab) { getTabPosition(tab) {
return Math.max(gBrowser._numVisiblePinTabs, tab._tPos) + 1; return Math.max(gBrowser.pinnedTabCount, tab._tPos) + 1;
} }
createBrowserElement(url, currentTab, existingTab = null) { createBrowserElement(url, currentTab, existingTab = null) {

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857a82ff94c 100644 index 8aeb244ffca9f48661805f5b7d860b5896055562..d5ac2cf891ec928bec4f95fd5ff0ee8d91294f78 100644
--- a/browser/components/tabbrowser/content/tabs.js --- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js +++ b/browser/components/tabbrowser/content/tabs.js
@@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
@ -28,6 +28,17 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
} }
/* Protects from close-tab-button errant doubleclick: /* Protects from close-tab-button errant doubleclick:
@@ -455,8 +456,8 @@
let winUtils = window.windowUtils;
let endOfTab =
winUtils.getBoundsWithoutFlushing(lastTab)[
- (this.verticalMode && "bottom") ||
- (this.#rtlMode ? "left" : "right")
+ (this.verticalMode && "bottom") ||
+ (this.#rtlMode ? "left" : "right")
];
if (
(this.verticalMode && event.clientY > endOfTab) ||
@@ -659,7 +660,7 @@ @@ -659,7 +660,7 @@
if (this.#isContainerVerticalPinnedExpanded(tab)) { if (this.#isContainerVerticalPinnedExpanded(tab)) {
// In expanded vertical mode, the max number of pinned tabs per row is dynamic // In expanded vertical mode, the max number of pinned tabs per row is dynamic
@ -78,7 +89,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
tab.removeAttribute("tabdrop-samewindow"); tab.removeAttribute("tabdrop-samewindow");
- this._finishAnimateTabMove(); - this._finishAnimateTabMove();
+ this._finishAnimateTabMove(true); + this._finishAnimateTabMove(true);
if (dropIndex !== false) { if (dropIndex !== false) {
gBrowser.moveTabTo(tab, dropIndex); gBrowser.moveTabTo(tab, dropIndex);
if (!directionForward) { if (!directionForward) {
@ -87,10 +98,19 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
gBrowser.syncThrobberAnimations(tab); gBrowser.syncThrobberAnimations(tab);
}; };
- if (gReduceMotion) { - if (gReduceMotion) {
+ if (gReduceMotion || true) { + if (gReduceMotion || true) {
postTransitionCleanup(); postTransitionCleanup();
} else { } else {
let onTransitionEnd = transitionendEvent => { let onTransitionEnd = transitionendEvent => {
@@ -1191,7 +1203,7 @@
let links;
try {
links = browserDragAndDrop.dropLinks(event, true);
- } catch (ex) {}
+ } catch (ex) { }
if (!links || links.length === 0) {
return;
@@ -1263,7 +1275,8 @@ @@ -1263,7 +1275,8 @@
if ( if (
dt.mozUserCancelled || dt.mozUserCancelled ||
@ -101,6 +121,33 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
) { ) {
delete draggedTab._dragData; delete draggedTab._dragData;
return; return;
@@ -1346,7 +1359,7 @@
var left = Math.min(
Math.max(
event.screenX * ourCssToDesktopScale -
- draggedTab._dragData.offsetX * screenCssToDesktopScale,
+ draggedTab._dragData.offsetX * screenCssToDesktopScale,
availX
),
availX + availWidth - winWidth
@@ -1354,7 +1367,7 @@
var top = Math.min(
Math.max(
event.screenY * ourCssToDesktopScale -
- draggedTab._dragData.offsetY * screenCssToDesktopScale,
+ draggedTab._dragData.offsetY * screenCssToDesktopScale,
availY
),
availY + availHeight - winHeight
@@ -1467,7 +1480,7 @@
// Normal tab title is used also in the permanent private browsing mode.
const l10nId =
PrivateBrowsingUtils.isWindowPrivate(window) &&
- !Services.prefs.getBoolPref("browser.privatebrowsing.autostart")
+ !Services.prefs.getBoolPref("browser.privatebrowsing.autostart")
? "tabbrowser-empty-private-tab-title"
: "tabbrowser-empty-tab-title";
return gBrowser.tabLocalization.formatValueSync(l10nId);
@@ -1512,9 +1525,18 @@ @@ -1512,9 +1525,18 @@
} }
@ -140,6 +187,15 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
); );
} }
@@ -1684,7 +1707,7 @@
// The height we got may be incorrect if a flush is pending so re-check it after
// a flush completes.
window
- .promiseDocumentFlushed(() => {})
+ .promiseDocumentFlushed(() => { })
.then(
() => {
height =
@@ -1816,7 +1839,7 @@ @@ -1816,7 +1839,7 @@
let rect = ele => { let rect = ele => {
return window.windowUtils.getBoundsWithoutFlushing(ele); return window.windowUtils.getBoundsWithoutFlushing(ele);
@ -184,12 +240,18 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
if (!isEndTab) { if (!isEndTab) {
// keep tabs the same width // keep tabs the same width
tab.style.transition = "none"; tab.style.transition = "none";
@@ -1963,13 +1987,13 @@ @@ -1904,7 +1928,7 @@
let verticalTabsContainer = document.getElementById(
"vertical-pinned-tabs-container" if (tabsToReset.length) {
window
- .promiseDocumentFlushed(() => {})
+ .promiseDocumentFlushed(() => { })
.then(() => {
window.requestAnimationFrame(() => {
for (let tab of tabsToReset) {
@@ -1965,11 +1989,11 @@
); );
- let numPinned = gBrowser.pinnedTabCount; let numPinned = gBrowser.pinnedTabCount;
+ let numPinned = gBrowser._numVisiblePinTabs;
- if (gBrowser.pinnedTabCount !== verticalTabsContainer.children.length) { - if (gBrowser.pinnedTabCount !== verticalTabsContainer.children.length) {
- let tabs = this.visibleTabs; - let tabs = this.visibleTabs;
@ -235,6 +297,26 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
pinned ? numPinned : undefined pinned ? numPinned : undefined
); );
@@ -2367,8 +2391,8 @@
};
let moveOverThreshold = gBrowser._tabGroupsEnabled
? Services.prefs.getIntPref(
- "browser.tabs.dragdrop.moveOverThresholdPercent"
- ) / 100
+ "browser.tabs.dragdrop.moveOverThresholdPercent"
+ ) / 100
: 0.5;
moveOverThreshold = Math.min(1, Math.max(0, moveOverThreshold));
let newIndex = getDragOverIndex(moveOverThreshold);
@@ -2420,7 +2444,7 @@
if (
groupDropIndex in this.allTabs &&
this.allTabs[groupDropIndex] ==
- this.allTabs[groupDropIndex].group?.tabs.at(-1)
+ this.allTabs[groupDropIndex].group?.tabs.at(-1)
) {
dragData.groupDropIndex = groupDropIndex;
dragData.groupDropAction = GROUP_DROP_ACTION_APPEND;
@@ -2502,8 +2526,9 @@ @@ -2502,8 +2526,9 @@
); );
} }
@ -247,7 +329,27 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
return; return;
} }
@@ -2668,9 +2693,9 @@ @@ -2552,7 +2577,7 @@
let movingTabSize =
movingTab.getBoundingClientRect()[
- this.verticalMode ? "height" : "width"
+ this.verticalMode ? "height" : "width"
];
let shift = (movingTabNewIndex - movingTabOldIndex) * movingTabSize;
@@ -2659,18 +2684,17 @@
let translatePos =
(this.#rtlMode ? -1 : 1) *
t._moveTogetherSelectedTabsData.translatePos;
- t.style.transform = `translate${
- this.verticalMode ? "Y" : "X"
- }(${translatePos}px)`;
+ t.style.transform = `translate${this.verticalMode ? "Y" : "X"
+ }(${translatePos}px)`;
}
}
function newIndex(aTab, index) { function newIndex(aTab, index) {
// Don't allow mixing pinned and unpinned tabs. // Don't allow mixing pinned and unpinned tabs.
if (aTab.pinned) { if (aTab.pinned) {
@ -259,7 +361,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
} }
} }
@@ -2754,7 +2779,7 @@ @@ -2754,7 +2778,7 @@
} }
_notifyBackgroundTab(aTab) { _notifyBackgroundTab(aTab) {
@ -268,7 +370,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
return; return;
} }
@@ -2772,12 +2797,14 @@ @@ -2772,12 +2796,14 @@
selectedTab = { selectedTab = {
left: selectedTab.left, left: selectedTab.left,
right: selectedTab.right, right: selectedTab.right,
@ -284,7 +386,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
selectedTab, selectedTab,
]; ];
}) })
@@ -2794,8 +2821,11 @@ @@ -2794,8 +2820,11 @@
delete this._lastTabToScrollIntoView; delete this._lastTabToScrollIntoView;
// Is the new tab already completely visible? // Is the new tab already completely visible?
if ( if (
@ -292,13 +394,13 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
- tabRect.right <= scrollRect.right - tabRect.right <= scrollRect.right
+ this.verticalMode + this.verticalMode
+ ? scrollRect.top <= tabRect.top && + ? scrollRect.top <= tabRect.top &&
+ tabRect.bottom <= scrollRect.bottom + tabRect.bottom <= scrollRect.bottom
+ : scrollRect.left <= tabRect.left && + : scrollRect.left <= tabRect.left &&
+ tabRect.right <= scrollRect.right + tabRect.right <= scrollRect.right
) { ) {
return; return;
} }
@@ -2803,21 +2833,29 @@ @@ -2803,21 +2832,29 @@
if (this.arrowScrollbox.smoothScroll) { if (this.arrowScrollbox.smoothScroll) {
// Can we make both the new tab and the selected tab completely visible? // Can we make both the new tab and the selected tab completely visible?
if ( if (
@ -309,13 +411,13 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
- ) <= scrollRect.width - ) <= scrollRect.width
+ !selectedRect || (this.verticalMode + !selectedRect || (this.verticalMode
+ ? Math.max( + ? Math.max(
+ tabRect.bottom - selectedRect.top, + tabRect.bottom - selectedRect.top,
+ selectedRect.bottom - tabRect.top + selectedRect.bottom - tabRect.top
+ ) <= scrollRect.height + ) <= scrollRect.height
+ : Math.max( + : Math.max(
+ tabRect.right - selectedRect.left, + tabRect.right - selectedRect.left,
+ selectedRect.right - tabRect.left + selectedRect.right - tabRect.left
+ ) <= scrollRect.width) + ) <= scrollRect.width)
) { ) {
this.arrowScrollbox.ensureElementIsVisible(tabToScrollIntoView); this.arrowScrollbox.ensureElementIsVisible(tabToScrollIntoView);
return; return;
@ -338,3 +440,12 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad28d73fe7cc6eadc4b4724c75d54857
} }
if (!this._animateElement.hasAttribute("highlight")) { if (!this._animateElement.hasAttribute("highlight")) {
@@ -2904,7 +2941,7 @@
sourceNode.localName == "tab" &&
sourceNode.ownerGlobal.isChromeWindow &&
sourceNode.ownerDocument.documentElement.getAttribute("windowtype") ==
- "navigator:browser" &&
+ "navigator:browser" &&
sourceNode.ownerGlobal.gBrowser.tabContainer == sourceNode.container
) {
// Do not allow transfering a private tab to a non-private window

View file

@ -53,4 +53,4 @@
"licenseType": "MPL-2.0" "licenseType": "MPL-2.0"
}, },
"updateHostname": "updates.zen-browser.app" "updateHostname": "updates.zen-browser.app"
} }