Files
desktop/src/browser/components/urlbar/UrlbarValueFormatter-sys-mjs.patch
2026-05-10 23:26:52 +02:00

54 lines
2.1 KiB
C++

diff --git a/browser/components/urlbar/UrlbarValueFormatter.sys.mjs b/browser/components/urlbar/UrlbarValueFormatter.sys.mjs
index f28d277764158566bc9406ce0e6160d92d346a63..aee17083999f99670c2de7b47cb917e400da86a6 100644
--- a/browser/components/urlbar/UrlbarValueFormatter.sys.mjs
+++ b/browser/components/urlbar/UrlbarValueFormatter.sys.mjs
@@ -77,7 +77,7 @@ export class UrlbarValueFormatter {
if (this.#updateInstance != instance) {
return;
}
- this.#formattingApplied = this.#formatURL() || this.#formatSearchAlias();
+ this.#formattingApplied = this._formatURL() || this.#formatSearchAlias();
});
}
@@ -105,6 +105,22 @@ export class UrlbarValueFormatter {
}
#ensureFormattedHostVisible(urlMetaData) {
+ // Make sure the domain is visible even with long subdomains when the single sidebar is being used
+ if (
+ this.#window.gZenVerticalTabsManager?._hasSetSingleToolbar
+ && Services.prefs.getBoolPref("zen.urlbar.show-domain-only-in-sidebar")
+ ) {
+ const hoverAttr = "zen-has-implicit-hover";
+ const hasHover = this.#window.gNavToolbox.hasAttribute(hoverAttr);
+ this.#window.gNavToolbox.removeAttribute(hoverAttr);
+
+ this.#inputField.scrollLeft = this.#inputField.scrollLeftMax;
+
+ if (hasHover) {
+ this.#window.gNavToolbox.setAttribute(hoverAttr, true);
+ }
+ return;
+ }
// Make sure the host is always visible. Since it is aligned on
// the first strong directional character, we set scrollLeft
// appropriately to ensure the domain stays visible in case of an
@@ -371,7 +387,7 @@ export class UrlbarValueFormatter {
* @returns {boolean}
* True if formatting was applied and false if not.
*/
- #formatURL() {
+ _formatURL() {
let urlMetaData = this.#getUrlMetaData();
if (!urlMetaData) {
return false;
@@ -640,6 +656,7 @@ export class UrlbarValueFormatter {
this.#window.requestAnimationFrame(() => {
if (instance == this.#resizeInstance) {
this.#ensureFormattedHostVisible();
+ this._formatURL();
}
});
}, 100);