mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-07 03:48:22 +00:00
feat: update preferences and UI components for new features and improvements
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
||||
index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d734668f2a 100644
|
||||
index 0fbdbf3aefc467880e6b0bae2615cb145735cb0f..0175072d29597633c04724b1824e2187bcdda61d 100644
|
||||
--- a/browser/components/tabbrowser/content/tabs.js
|
||||
+++ b/browser/components/tabbrowser/content/tabs.js
|
||||
@@ -94,7 +94,7 @@
|
||||
@@ -93,7 +93,7 @@
|
||||
};
|
||||
this.arrowScrollbox._canScrollToElement = element => {
|
||||
if (isTab(element)) {
|
||||
@@ -11,7 +11,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -339,7 +339,7 @@
|
||||
@@ -347,7 +347,7 @@
|
||||
// and we're not hitting the scroll buttons.
|
||||
if (
|
||||
event.button != 0 ||
|
||||
@@ -20,7 +20,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
event.composedTarget.localName == "toolbarbutton"
|
||||
) {
|
||||
return;
|
||||
@@ -388,6 +388,7 @@
|
||||
@@ -396,6 +396,7 @@
|
||||
// Reset the "ignored click" flag
|
||||
target._ignoredCloseButtonClicks = false;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
|
||||
/* Protects from close-tab-button errant doubleclick:
|
||||
@@ -683,7 +684,7 @@
|
||||
@@ -693,7 +694,7 @@
|
||||
if (this.#isContainerVerticalPinnedExpanded(tab)) {
|
||||
// In expanded vertical mode, the max number of pinned tabs per row is dynamic
|
||||
// Set this before adjusting dragged tab's position
|
||||
@@ -37,7 +37,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
let tabsPerRow = 0;
|
||||
let position = 0;
|
||||
for (let pinnedTab of pinnedTabs) {
|
||||
@@ -883,6 +884,10 @@
|
||||
@@ -899,6 +900,10 @@
|
||||
}
|
||||
|
||||
let draggedTab = event.dataTransfer.mozGetDataAt(TAB_DROP_TYPE, 0);
|
||||
@@ -48,7 +48,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
if (
|
||||
(effects == "move" || effects == "copy") &&
|
||||
this == draggedTab.container &&
|
||||
@@ -996,6 +1001,18 @@
|
||||
@@ -1012,6 +1017,18 @@
|
||||
|
||||
this._tabDropIndicator.hidden = true;
|
||||
event.stopPropagation();
|
||||
@@ -67,41 +67,32 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
if (draggedTab && dropEffect == "copy") {
|
||||
// copy the dropped tab (wherever it's from)
|
||||
let newIndex = this._getDropIndex(event);
|
||||
@@ -1034,10 +1051,11 @@
|
||||
@@ -1050,10 +1067,11 @@
|
||||
}
|
||||
} else {
|
||||
let pinned = draggedTab.pinned;
|
||||
let isPinned = draggedTab.pinned;
|
||||
- let numPinned = gBrowser.pinnedTabCount;
|
||||
- let tabs = this.visibleTabs.slice(
|
||||
- pinned ? 0 : numPinned,
|
||||
- pinned ? numPinned : undefined
|
||||
- let tabs = this.ariaFocusableItems.slice(
|
||||
- isPinned ? 0 : numPinned,
|
||||
- isPinned ? numPinned : undefined
|
||||
+ let numPinned = gBrowser._numVisiblePinTabs;
|
||||
+ let essential = draggedTab.hasAttribute("zen-essential");
|
||||
+ let tabs = this.visibleTabs.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(
|
||||
+ pinned ? (essential ? 0 : gBrowser._numZenVisibleEssentials) : numPinned,
|
||||
+ pinned ? (essential ? gBrowser._numZenVisibleEssentials : numPinned) : undefined
|
||||
+ let tabs = this.ariaFocusableItems.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(
|
||||
+ isPinned ? (essential ? 0 : gBrowser._numZenVisibleEssentials) : numPinned,
|
||||
+ isPinned ? (essential ? gBrowser._numZenVisibleEssentials : numPinned) : undefined
|
||||
);
|
||||
let size = this.verticalMode ? "height" : "width";
|
||||
let screenAxis = this.verticalMode ? "screenY" : "screenX";
|
||||
@@ -1114,7 +1132,7 @@
|
||||
let postTransitionCleanup = () => {
|
||||
@@ -1129,7 +1147,7 @@
|
||||
tab.removeAttribute("tabdrop-samewindow");
|
||||
|
||||
- this._finishAnimateTabMove();
|
||||
+ this._finishAnimateTabMove(true);
|
||||
if (dropIndex !== false) {
|
||||
gBrowser.moveTabTo(tab, dropIndex);
|
||||
if (!directionForward) {
|
||||
@@ -1122,7 +1140,7 @@
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
};
|
||||
- if (gReduceMotion) {
|
||||
+ if (true || gReduceMotion) {
|
||||
postTransitionCleanup();
|
||||
} else {
|
||||
let onTransitionEnd = transitionendEvent => {
|
||||
@@ -1249,7 +1267,7 @@
|
||||
@@ -1246,7 +1264,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +101,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
gBrowser.loadTabs(urls, {
|
||||
inBackground,
|
||||
replace,
|
||||
@@ -1279,13 +1297,23 @@
|
||||
@@ -1276,13 +1294,23 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -136,7 +127,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
) {
|
||||
delete draggedTab._dragData;
|
||||
return;
|
||||
@@ -1517,7 +1545,7 @@
|
||||
@@ -1504,7 +1532,7 @@
|
||||
}
|
||||
|
||||
get newTabButton() {
|
||||
@@ -145,7 +136,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
|
||||
get verticalMode() {
|
||||
@@ -1537,29 +1565,41 @@
|
||||
@@ -1524,29 +1552,41 @@
|
||||
if (this.#allTabs) {
|
||||
return this.#allTabs;
|
||||
}
|
||||
@@ -195,7 +186,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1579,7 +1619,7 @@
|
||||
@@ -1566,7 +1606,7 @@
|
||||
*/
|
||||
get visibleTabs() {
|
||||
if (!this.#visibleTabs) {
|
||||
@@ -204,20 +195,23 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
return this.#visibleTabs;
|
||||
}
|
||||
@@ -1613,10 +1653,8 @@
|
||||
return this.#focusableItems;
|
||||
@@ -1601,13 +1641,11 @@
|
||||
}
|
||||
|
||||
let elementIndex = 0;
|
||||
- let verticalPinnedTabsContainer = document.getElementById(
|
||||
- "vertical-pinned-tabs-container"
|
||||
- );
|
||||
+ let verticalPinnedTabsContainer = this.verticalPinnedTabsContainer
|
||||
for (let i = 0; i < verticalPinnedTabsContainer.childElementCount; i++) {
|
||||
verticalPinnedTabsContainer.children[i].elementIndex = elementIndex++;
|
||||
}
|
||||
- let children = Array.from(this.arrowScrollbox.children);
|
||||
+ let verticalPinnedTabsContainer = this.verticalPinnedTabsContainer;
|
||||
+ let children = ZenWorkspaces.tabboxChildrenWithoutEmpty;
|
||||
|
||||
let focusableItems = [];
|
||||
for (let child of children) {
|
||||
@@ -1632,6 +1670,7 @@
|
||||
@@ -1628,6 +1666,7 @@
|
||||
}
|
||||
|
||||
this.#focusableItems = [
|
||||
@@ -225,7 +219,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
...verticalPinnedTabsContainer.children,
|
||||
...focusableItems,
|
||||
];
|
||||
@@ -1642,6 +1681,7 @@
|
||||
@@ -1638,6 +1677,7 @@
|
||||
_invalidateCachedTabs() {
|
||||
this.#allTabs = null;
|
||||
this._invalidateCachedVisibleTabs();
|
||||
@@ -233,7 +227,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
|
||||
_invalidateCachedVisibleTabs() {
|
||||
@@ -1656,8 +1696,8 @@
|
||||
@@ -1652,8 +1692,8 @@
|
||||
#isContainerVerticalPinnedExpanded(tab) {
|
||||
return (
|
||||
this.verticalMode &&
|
||||
@@ -244,7 +238,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1672,7 +1712,7 @@
|
||||
@@ -1668,7 +1708,7 @@
|
||||
|
||||
if (node == null) {
|
||||
// We have a container for non-tab elements at the end of the scrollbox.
|
||||
@@ -253,7 +247,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
|
||||
node.before(tab);
|
||||
@@ -1772,7 +1812,7 @@
|
||||
@@ -1763,7 +1803,7 @@
|
||||
// There are separate "new tab" buttons for horizontal tabs toolbar, vertical tabs and
|
||||
// for when the tab strip is overflowed (which is shared by vertical and horizontal tabs);
|
||||
// Attach the long click popup to all of them.
|
||||
@@ -262,7 +256,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
const newTab2 = this.newTabButton;
|
||||
const newTabVertical = document.getElementById(
|
||||
"vertical-tabs-newtab-button"
|
||||
@@ -1855,7 +1895,7 @@
|
||||
@@ -1846,7 +1886,7 @@
|
||||
let rect = ele => {
|
||||
return window.windowUtils.getBoundsWithoutFlushing(ele);
|
||||
};
|
||||
@@ -271,7 +265,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
if (tab && rect(tab).width <= this._tabClipWidth) {
|
||||
this.setAttribute("closebuttons", "activetab");
|
||||
} else {
|
||||
@@ -1867,10 +1907,12 @@
|
||||
@@ -1858,10 +1898,12 @@
|
||||
|
||||
_handleTabSelect(aInstant) {
|
||||
let selectedTab = this.selectedItem;
|
||||
@@ -284,7 +278,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
selectedTab._notselectedsinceload = false;
|
||||
}
|
||||
|
||||
@@ -1882,7 +1924,7 @@
|
||||
@@ -1873,7 +1915,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -293,7 +287,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
if (!tabs.length) {
|
||||
return;
|
||||
}
|
||||
@@ -1918,7 +1960,7 @@
|
||||
@@ -1909,7 +1951,7 @@
|
||||
if (isEndTab && !this._hasTabTempMaxWidth) {
|
||||
return;
|
||||
}
|
||||
@@ -302,7 +296,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
// 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.
|
||||
@@ -1933,7 +1975,7 @@
|
||||
@@ -1924,7 +1966,7 @@
|
||||
let tabsToReset = [];
|
||||
for (let i = numPinned; i < tabs.length; i++) {
|
||||
let tab = tabs[i];
|
||||
@@ -311,7 +305,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
if (!isEndTab) {
|
||||
// keep tabs the same width
|
||||
tab.style.transition = "none";
|
||||
@@ -1999,16 +2041,15 @@
|
||||
@@ -1990,16 +2032,15 @@
|
||||
// Move pinned tabs to another container when the tabstrip is toggled to vertical
|
||||
// and when session restore code calls _positionPinnedTabs; update styling whenever
|
||||
// the number of pinned tabs changes.
|
||||
@@ -334,7 +328,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2016,9 +2057,7 @@
|
||||
@@ -2007,9 +2048,7 @@
|
||||
}
|
||||
|
||||
_resetVerticalPinnedTabs() {
|
||||
@@ -345,7 +339,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
|
||||
if (!verticalTabsContainer.children.length) {
|
||||
return;
|
||||
@@ -2031,8 +2070,8 @@
|
||||
@@ -2022,8 +2061,8 @@
|
||||
}
|
||||
|
||||
_positionPinnedTabs() {
|
||||
@@ -356,7 +350,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
let absPositionHorizontalTabs =
|
||||
this.overflowing && tabs.length > numPinned && numPinned > 0;
|
||||
|
||||
@@ -2041,7 +2080,7 @@
|
||||
@@ -2032,7 +2071,7 @@
|
||||
|
||||
if (this.verticalMode) {
|
||||
this._updateVerticalPinnedTabs();
|
||||
@@ -365,7 +359,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
let layoutData = this._pinnedTabsLayoutCache;
|
||||
let uiDensity = document.documentElement.getAttribute("uidensity");
|
||||
if (!layoutData || layoutData.uiDensity != uiDensity) {
|
||||
@@ -2113,7 +2152,7 @@
|
||||
@@ -2104,7 +2143,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -374,7 +368,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
|
||||
let directionX = screenX > dragData.animLastScreenX;
|
||||
let directionY = screenY > dragData.animLastScreenY;
|
||||
@@ -2121,7 +2160,7 @@
|
||||
@@ -2112,7 +2151,7 @@
|
||||
dragData.animLastScreenX = screenX;
|
||||
|
||||
let { width: tabWidth, height: tabHeight } =
|
||||
@@ -384,18 +378,18 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
let shiftSizeY = tabHeight;
|
||||
dragData.tabWidth = tabWidth;
|
||||
@@ -2296,10 +2335,11 @@
|
||||
}
|
||||
this.#clearDragOverCreateGroupTimer();
|
||||
|
||||
let pinned = draggedTab.pinned;
|
||||
let isPinned = draggedTab.pinned;
|
||||
- let numPinned = gBrowser.pinnedTabCount;
|
||||
- let tabs = this.visibleTabs.slice(
|
||||
- pinned ? 0 : numPinned,
|
||||
- pinned ? numPinned : undefined
|
||||
- let tabs = this.ariaFocusableItems.slice(
|
||||
- isPinned ? 0 : numPinned,
|
||||
- isPinned ? numPinned : undefined
|
||||
+ let numPinned = gBrowser._numVisiblePinTabs;
|
||||
+ let essential = draggedTab.hasAttribute("zen-essential");
|
||||
+ let tabs = this.visibleTabs.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(
|
||||
+ pinned ? (essential ? 0 : gBrowser._numZenVisibleEssentials) : numPinned,
|
||||
+ pinned ? (essential ? gBrowser._numZenVisibleEssentials : numPinned) : undefined
|
||||
+ let tabs = this.ariaFocusableItems.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice(
|
||||
+ isPinned ? (essential ? 0 : gBrowser._numZenVisibleEssentials) : numPinned,
|
||||
+ isPinned ? (essential ? gBrowser._numZenVisibleEssentials : numPinned) : undefined
|
||||
);
|
||||
|
||||
if (this.#rtlMode) {
|
||||
@@ -412,25 +406,28 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
}
|
||||
|
||||
dragData.translatePos = translate;
|
||||
@@ -2484,12 +2528,16 @@
|
||||
@@ -2639,7 +2683,7 @@
|
||||
// Shift background tabs to leave a gap where the dragged tab
|
||||
// would currently be dropped.
|
||||
for (let tab of tabs) {
|
||||
- if (tab == draggedTab) {
|
||||
+ if (tab == draggedTab || (tab.group?.hasAttribute("split-view-group") && tab.group == draggedTab.group)) {
|
||||
for (let item of tabs) {
|
||||
- if (item == draggedTab) {
|
||||
+ if (item == draggedTab || (item.group?.hasAttribute("split-view-group") && item.group == draggedTab.group)) {
|
||||
continue;
|
||||
}
|
||||
let shift = getTabShift(tab, newIndex);
|
||||
let transform = shift ? `${translateAxis}(${shift}px)` : "";
|
||||
+ if (tab.group?.hasAttribute("split-view-group")) {
|
||||
+ tab.group.style.transform = transform;
|
||||
|
||||
@@ -2649,7 +2693,11 @@
|
||||
// Shift the `.tab-group-label-container` to shift the label element.
|
||||
item = item.parentElement;
|
||||
}
|
||||
+ if (item.group?.hasAttribute("split-view-group")) {
|
||||
+ item.group.style.transform = transform;
|
||||
+ } else {
|
||||
tab.style.transform = transform;
|
||||
item.style.transform = transform;
|
||||
+ }
|
||||
if (tab.group?.tabs[0] == tab) {
|
||||
tab.group.style.setProperty(
|
||||
"--tabgroup-dragover-transform",
|
||||
@@ -2541,8 +2589,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2697,8 +2745,9 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -442,16 +439,8 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2553,6 +2602,7 @@
|
||||
tab.style.transform = "";
|
||||
if (tab.group) {
|
||||
tab.group.style.removeProperty("--tabgroup-dragover-transform");
|
||||
+ tab.group.style.transform = "";
|
||||
}
|
||||
tab.removeAttribute("dragover-createGroup");
|
||||
}
|
||||
@@ -2604,7 +2654,7 @@
|
||||
movingTab._moveTogetherSelectedTabsData.newIndex = movingTabNewIndex;
|
||||
@@ -2754,7 +2803,7 @@
|
||||
let postTransitionCleanup = () => {
|
||||
movingTab._moveTogetherSelectedTabsData.animate = false;
|
||||
};
|
||||
- if (gReduceMotion) {
|
||||
@@ -459,19 +448,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..13a870629a98304cb18dc09b5ae075d7
|
||||
postTransitionCleanup();
|
||||
} else {
|
||||
let onTransitionEnd = transitionendEvent => {
|
||||
@@ -2707,9 +2757,9 @@
|
||||
function newIndex(aTab, index) {
|
||||
// Don't allow mixing pinned and unpinned tabs.
|
||||
if (aTab.pinned) {
|
||||
- return Math.min(index, gBrowser.pinnedTabCount - 1);
|
||||
+ return Math.min(index, gBrowser._numVisiblePinTabs - 1);
|
||||
}
|
||||
- return Math.max(index, gBrowser.pinnedTabCount);
|
||||
+ return Math.max(index, gBrowser._numVisiblePinTabs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2793,7 +2843,7 @@
|
||||
@@ -2924,7 +2973,7 @@
|
||||
}
|
||||
|
||||
_notifyBackgroundTab(aTab) {
|
||||
|
Reference in New Issue
Block a user