mirror of
https://github.com/zen-browser/desktop.git
synced 2025-11-10 04:25:12 +00:00
156 lines
6.2 KiB
C++
156 lines
6.2 KiB
C++
diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
|
|
index 4c1a48424316b29d27ae2bc8b64004df41c87bb6..f1ff9bf0947127a8e9115357cedac577b5fad08c 100644
|
|
--- a/browser/components/tabbrowser/content/tab.js
|
|
+++ b/browser/components/tabbrowser/content/tab.js
|
|
@@ -21,6 +21,7 @@
|
|
<hbox class="tab-group-line"/>
|
|
</vbox>
|
|
<hbox class="tab-content" align="center">
|
|
+ <box class="tab-reset-pin-button" role="button" data-l10n-id="tabbrowser-reset-pin-button" data-l10n-args='{"tabCount": 1}' keyNav="false"><image/></box>
|
|
<stack class="tab-icon-stack">
|
|
<hbox class="tab-throbber"/>
|
|
<hbox class="tab-icon-pending"/>
|
|
@@ -37,8 +38,10 @@
|
|
<hbox class="tab-secondary-label">
|
|
<label class="tab-icon-sound-label tab-icon-sound-pip-label" data-l10n-id="browser-tab-audio-pip" role="presentation"/>
|
|
</hbox>
|
|
+ <label class="tab-reset-pin-label" data-l10n-id="tab-reset-pin-label" role="presentation"/>
|
|
</vbox>
|
|
<image class="tab-close-button close-icon" role="button" data-l10n-id="tabbrowser-close-tabs-button" data-l10n-args='{"tabCount": 1}' keyNav="false"/>
|
|
+ <image class="tab-reset-button reset-icon" role="button" data-l10n-id="tabbrowser-unload-tab-button" data-l10n-args='{"tabCount": 1}' keyNav="false"/>
|
|
</hbox>
|
|
</stack>
|
|
`;
|
|
@@ -84,7 +87,7 @@
|
|
".tab-content":
|
|
"pinned,selected=visuallyselected,multiselected,titlechanged,attention",
|
|
".tab-icon-stack":
|
|
- "sharing,pictureinpicture,crashed,busy,soundplaying,soundplaying-scheduledremoval,pinned,muted,blocked,selected=visuallyselected,activemedia-blocked",
|
|
+ "zen-essential,sharing,pictureinpicture,crashed,busy,soundplaying,soundplaying-scheduledremoval,pinned,muted,blocked,selected=visuallyselected,activemedia-blocked",
|
|
".tab-throbber":
|
|
"fadein,pinned,busy,progress,selected=visuallyselected",
|
|
".tab-icon-pending":
|
|
@@ -93,9 +96,9 @@
|
|
"src=image,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing,pictureinpicture,pending,discarded",
|
|
".tab-sharing-icon-overlay": "sharing,selected=visuallyselected,pinned",
|
|
".tab-icon-overlay":
|
|
- "sharing,pictureinpicture,crashed,busy,soundplaying,soundplaying-scheduledremoval,pinned,muted,blocked,selected=visuallyselected,activemedia-blocked",
|
|
+ "zen-essential,sharing,pictureinpicture,crashed,busy,soundplaying,soundplaying-scheduledremoval,pinned,muted,blocked,selected=visuallyselected,activemedia-blocked",
|
|
".tab-audio-button":
|
|
- "crashed,soundplaying,soundplaying-scheduledremoval,pinned,muted,activemedia-blocked",
|
|
+ "zen-essential,crashed,soundplaying,soundplaying-scheduledremoval,pinned,muted,activemedia-blocked",
|
|
".tab-label-container":
|
|
"pinned,selected=visuallyselected,labeldirection",
|
|
".tab-label":
|
|
@@ -186,7 +189,7 @@
|
|
}
|
|
|
|
set _visuallySelected(val) {
|
|
- if (val == this.hasAttribute("visuallyselected")) {
|
|
+ if (val == this.hasAttribute("visuallyselected") || (!val && this.linkedBrowser?.closest('.browserSidebarContainer').classList.contains('zen-glance-background'))) {
|
|
return;
|
|
}
|
|
|
|
@@ -222,11 +225,21 @@
|
|
}
|
|
|
|
get visible() {
|
|
- return (
|
|
- this.isOpen &&
|
|
- !this.hidden &&
|
|
- (!this.group || this.group.isTabVisibleInGroup(this))
|
|
- );
|
|
+ if (!this.isOpen || this.hidden || this.hasAttribute("zen-empty-tab")) {
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ // Selected tabs are always visible
|
|
+ if (this.selected || this.multiselected || this.hasAttribute("folder-active")) return true;
|
|
+ // Recursively check all parent groups
|
|
+ let currentParent = this.group;
|
|
+ while (currentParent) {
|
|
+ if (currentParent.collapsed) {
|
|
+ return false;
|
|
+ }
|
|
+ currentParent = currentParent.group;
|
|
+ }
|
|
+ return true;
|
|
}
|
|
|
|
get hidden() {
|
|
@@ -297,7 +310,7 @@
|
|
return false;
|
|
}
|
|
|
|
- return true;
|
|
+ return !this.hasAttribute("zen-empty-tab");
|
|
}
|
|
|
|
get lastAccessed() {
|
|
@@ -374,8 +387,11 @@
|
|
}
|
|
|
|
get group() {
|
|
- if (this.parentElement?.tagName == "tab-group") {
|
|
- return this.parentElement;
|
|
+ if (typeof gBrowser === "undefined") {
|
|
+ return null;
|
|
+ }
|
|
+ if (gBrowser.isTabGroup(this.parentElement?.parentElement)) {
|
|
+ return this.parentElement.parentElement;
|
|
}
|
|
return null;
|
|
}
|
|
@@ -470,6 +486,8 @@
|
|
this.style.MozUserFocus = "ignore";
|
|
} else if (
|
|
event.target.classList.contains("tab-close-button") ||
|
|
+ event.target.classList.contains("tab-reset-button") ||
|
|
+ event.target.classList.contains("tab-reset-pin-button") ||
|
|
event.target.classList.contains("tab-icon-overlay") ||
|
|
event.target.classList.contains("tab-audio-button")
|
|
) {
|
|
@@ -524,6 +542,10 @@
|
|
this.style.MozUserFocus = "";
|
|
}
|
|
|
|
+ get glanceTab() {
|
|
+ return this.querySelector("tab[zen-glance-tab]");
|
|
+ }
|
|
+
|
|
on_click(event) {
|
|
if (event.button != 0) {
|
|
return;
|
|
@@ -572,6 +594,7 @@
|
|
)
|
|
);
|
|
} else {
|
|
+ gZenPinnedTabManager._removePinnedAttributes(this, true);
|
|
gBrowser.removeTab(this, {
|
|
animate: true,
|
|
triggeringEvent: event,
|
|
@@ -584,6 +607,14 @@
|
|
// (see tabbrowser-tabs 'click' handler).
|
|
gBrowser.tabContainer._blockDblClick = true;
|
|
}
|
|
+
|
|
+ if (event.target.classList.contains("tab-reset-pin-button")) {
|
|
+ gZenPinnedTabManager._onTabResetPinButton(event, this, 'reset');
|
|
+ gBrowser.tabContainer._blockDblClick = true;
|
|
+ } else if (event.target.classList.contains("tab-reset-button")) {
|
|
+ gZenPinnedTabManager.onCloseTabShortcut(event, this);
|
|
+ gBrowser.tabContainer._blockDblClick = true;
|
|
+ }
|
|
}
|
|
|
|
on_dblclick(event) {
|
|
@@ -607,6 +638,8 @@
|
|
animate: true,
|
|
triggeringEvent: event,
|
|
});
|
|
+ } else if (this.hasAttribute('zen-essential') && !event.target.classList.contains("tab-icon-overlay")) {
|
|
+ gZenPinnedTabManager._onTabResetPinButton(event, this, 'reset');
|
|
}
|
|
}
|
|
|