mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 01:16:35 +00:00
Refactor zen-glance styles and improve tab handling in ZenGlanceManager
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
||||
index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c45dd02404 100644
|
||||
index 8aeb244ffca9f48661805f5b7d860b5896055562..e07019130c199401702889c6765434de0bd708a2 100644
|
||||
--- a/browser/components/tabbrowser/content/tabs.js
|
||||
+++ b/browser/components/tabbrowser/content/tabs.js
|
||||
@@ -94,7 +94,7 @@
|
||||
@@ -99,7 +99,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
) {
|
||||
delete draggedTab._dragData;
|
||||
return;
|
||||
@@ -1512,7 +1525,7 @@
|
||||
@@ -1512,9 +1525,18 @@
|
||||
}
|
||||
|
||||
this.#allTabs = [
|
||||
@@ -107,8 +107,19 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
+ ...document.getElementById("zen-essentials-container").children, ...this.verticalPinnedTabsContainer.children,
|
||||
...children,
|
||||
];
|
||||
+ for (let i = 0; i < this.#allTabs.length; i++) {
|
||||
+ // add glance tabs (tabs inside tabs) to the list
|
||||
+ const glanceTab = this.#allTabs[i].querySelector("tab[zen-glance-tab]");
|
||||
+ if (glanceTab) {
|
||||
+ // insert right after the parent tab
|
||||
+ this.#allTabs.splice(i + 1, 0, glanceTab);
|
||||
+ i++;
|
||||
+ }
|
||||
+ }
|
||||
return this.#allTabs;
|
||||
@@ -1593,6 +1606,7 @@
|
||||
}
|
||||
|
||||
@@ -1593,6 +1615,7 @@
|
||||
}
|
||||
|
||||
this.#focusableItems = [
|
||||
@@ -116,7 +127,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
...verticalPinnedTabsContainer.children,
|
||||
...focusableItems,
|
||||
];
|
||||
@@ -1617,8 +1631,8 @@
|
||||
@@ -1617,8 +1640,8 @@
|
||||
#isContainerVerticalPinnedExpanded(tab) {
|
||||
return (
|
||||
this.verticalMode &&
|
||||
@@ -127,7 +138,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1816,7 +1830,7 @@
|
||||
@@ -1816,7 +1839,7 @@
|
||||
let rect = ele => {
|
||||
return window.windowUtils.getBoundsWithoutFlushing(ele);
|
||||
};
|
||||
@@ -136,7 +147,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
if (tab && rect(tab).width <= this._tabClipWidth) {
|
||||
this.setAttribute("closebuttons", "activetab");
|
||||
} else {
|
||||
@@ -1832,6 +1846,7 @@
|
||||
@@ -1832,6 +1855,7 @@
|
||||
this.arrowScrollbox.ensureElementIsVisible(selectedTab, aInstant);
|
||||
}
|
||||
|
||||
@@ -144,7 +155,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
selectedTab._notselectedsinceload = false;
|
||||
}
|
||||
|
||||
@@ -1879,7 +1894,7 @@
|
||||
@@ -1879,7 +1903,7 @@
|
||||
if (isEndTab && !this._hasTabTempMaxWidth) {
|
||||
return;
|
||||
}
|
||||
@@ -153,7 +164,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
// 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 +1909,7 @@
|
||||
@@ -1894,7 +1918,7 @@
|
||||
let tabsToReset = [];
|
||||
for (let i = numPinned; i < tabs.length; i++) {
|
||||
let tab = tabs[i];
|
||||
@@ -162,7 +173,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
if (!isEndTab) {
|
||||
// keep tabs the same width
|
||||
tab.style.transition = "none";
|
||||
@@ -1963,13 +1978,13 @@
|
||||
@@ -1963,13 +1987,13 @@
|
||||
let verticalTabsContainer = document.getElementById(
|
||||
"vertical-pinned-tabs-container"
|
||||
);
|
||||
@@ -179,7 +190,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1993,7 +2008,7 @@
|
||||
@@ -1993,7 +2017,7 @@
|
||||
|
||||
_positionPinnedTabs() {
|
||||
let tabs = this.visibleTabs;
|
||||
@@ -188,7 +199,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
let absPositionHorizontalTabs =
|
||||
this.overflowing && tabs.length > numPinned && numPinned > 0;
|
||||
|
||||
@@ -2074,7 +2089,7 @@
|
||||
@@ -2074,7 +2098,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,7 +208,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
|
||||
let directionX = screenX > dragData.animLastScreenX;
|
||||
let directionY = screenY > dragData.animLastScreenY;
|
||||
@@ -2257,9 +2272,9 @@
|
||||
@@ -2257,9 +2281,9 @@
|
||||
}
|
||||
|
||||
let pinned = draggedTab.pinned;
|
||||
@@ -209,7 +220,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
pinned ? numPinned : undefined
|
||||
);
|
||||
|
||||
@@ -2502,8 +2517,9 @@
|
||||
@@ -2502,8 +2526,9 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -221,7 +232,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2668,9 +2684,9 @@
|
||||
@@ -2668,9 +2693,9 @@
|
||||
function newIndex(aTab, index) {
|
||||
// Don't allow mixing pinned and unpinned tabs.
|
||||
if (aTab.pinned) {
|
||||
@@ -233,7 +244,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2754,7 +2770,7 @@
|
||||
@@ -2754,7 +2779,7 @@
|
||||
}
|
||||
|
||||
_notifyBackgroundTab(aTab) {
|
||||
@@ -242,7 +253,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2772,12 +2788,14 @@
|
||||
@@ -2772,12 +2797,14 @@
|
||||
selectedTab = {
|
||||
left: selectedTab.left,
|
||||
right: selectedTab.right,
|
||||
@@ -258,7 +269,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
selectedTab,
|
||||
];
|
||||
})
|
||||
@@ -2794,8 +2812,11 @@
|
||||
@@ -2794,8 +2821,11 @@
|
||||
delete this._lastTabToScrollIntoView;
|
||||
// Is the new tab already completely visible?
|
||||
if (
|
||||
@@ -272,7 +283,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..a36fc2cb5761323fd40d367fd04234c4
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -2803,21 +2824,29 @@
|
||||
@@ -2803,21 +2833,29 @@
|
||||
if (this.arrowScrollbox.smoothScroll) {
|
||||
// Can we make both the new tab and the selected tab completely visible?
|
||||
if (
|
||||
|
Reference in New Issue
Block a user