[Pale-Moon] Issue #1908 - Fade tab titles instead of using ellipses

This commit is contained in:
FranklinDM 2023-02-05 19:20:02 +08:00 committed by roytam1
commit 21f0c3de63
4 changed files with 36 additions and 3 deletions

View file

@ -473,6 +473,10 @@ pref("browser.tabs.delayHidingAudioPlayingIconMS", 3000);
// window is enabled.
pref("browser.tabs.allowTabDetach", true);
// Whether to fade tab labels instead of using ellipses when cutting off
// long page titles.
pref("browser.tabs.fadeLabels", true);
pref("browser.allTabs.previews", true);
pref("browser.allTabs.hidePinnedTabs", false);
pref("browser.ctrlTab.previews", true);

View file

@ -82,6 +82,16 @@ tabbrowser {
transition: transform 200ms ease-out;
}
@supports -moz-bool-pref("browser.tabs.fadeLabels") {
.tabbrowser-tab .tab-text[_is_cropped] {
mask-image: linear-gradient(to left, transparent, black 2em);
}
.tabbrowser-tab .tab-text[_is_cropped]:-moz-locale-dir(rtl) {
mask-image: linear-gradient(to right, transparent, black 2em);
}
}
#alltabs-popup {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-alltabs-popup");
}

View file

@ -1258,7 +1258,11 @@
<body>
<![CDATA[
aTab.label = this.mStringBundle.getString("tabs.connecting");
aTab.crop = "end";
if (Services.prefs.getBoolPref("browser.tabs.fadeLabels")) {
aTab.crop = "clip";
} else {
aTab.crop = "end";
}
this._tabAttrModified(aTab, ["label", "crop"]);
]]>
</body>
@ -1298,6 +1302,10 @@
title = this.mStringBundle.getString("tabs.emptyTabTitle");
}
if (Services.prefs.getBoolPref("browser.tabs.fadeLabels")) {
crop = "clip";
}
if (aTab.label == title &&
aTab.crop == crop)
return false;
@ -1521,7 +1529,11 @@
else
t.setAttribute("label", aURI);
t.setAttribute("crop", "end");
if (Services.prefs.getBoolPref("browser.tabs.fadeLabels")) {
t.setAttribute("crop", "clip");
} else {
t.setAttribute("crop", "end");
}
t.setAttribute("validate", "never"); //PMed
t.setAttribute("onerror", "this.removeAttribute('image');");
@ -3602,7 +3614,11 @@
var tab = this.firstChild;
tab.setAttribute("label",
this.tabbrowser.mStringBundle.getString("tabs.emptyTabTitle"));
tab.setAttribute("crop", "end");
if (Services.prefs.getBoolPref("browser.tabs.fadeLabels")) {
tab.setAttribute("crop", "clip");
} else {
tab.setAttribute("crop", "end");
}
tab.setAttribute("onerror", "this.removeAttribute('image');");
this.adjustTabstrip();

View file

@ -3045,6 +3045,9 @@ var SessionStoreInternal = {
tab.label = activePageData.url;
tab.crop = "center";
}
if (this._prefBranch.getBoolPref("tabs.fadeLabels")) {
tab.crop = "clip";
}
}
}