ma1 pushed to branch tor-browser-128.9.0esr-14.5-1 at The Tor Project / Applications / Tor Browser
Commits: 07ea8b99 by hackademix at 2025-04-07T22:14:39+02:00 fixup! Base Browser strings
BB 41919: Letterboxing, add temporarily visible web content-size indicator on window resizing.
- - - - - 313af76b by hackademix at 2025-04-07T22:14:40+02:00 BB 41919: Letterboxing, add temporarily visible web content-size indicator on window resizing.
- - - - -
4 changed files:
- browser/components/tabbrowser/content/tabbrowser.js - browser/themes/shared/tabbrowser/content-area.css - toolkit/components/resistfingerprinting/RFPHelper.sys.mjs - toolkit/locales/en-US/toolkit/global/base-browser.ftl
Changes:
===================================== browser/components/tabbrowser/content/tabbrowser.js ===================================== @@ -7513,6 +7513,7 @@ var StatusPanel = { if (XULBrowserWindow.busyUI) { types.push("status"); } + types.push("letterboxingStatus"); types.push("defaultStatus"); for (type of types) { if ((text = XULBrowserWindow[type])) {
===================================== browser/themes/shared/tabbrowser/content-area.css ===================================== @@ -115,6 +115,7 @@ min-width: min(23em, 33%); }
+ &[type=letterboxingStatus], &[type=overLink] { transition: opacity 120ms ease-out, visibility 120ms; } @@ -123,12 +124,14 @@ direction: ltr; }
+ .exclude-letterboxing &[type=letterboxingStatus], &[inactive], :root[inDOMFullscreen] &:not([type=overLink]) { transition: none; opacity: 0; visibility: hidden;
+ &[previoustype=letterboxingStatus], &[previoustype=overLink] { transition: opacity 200ms ease-out, visibility 200ms; } @@ -177,6 +180,21 @@ } }
+#statuspanel[type=letterboxingStatus] > #statuspanel-label, +#statuspanel[previoustype=letterboxingStatus][inactive] > #statuspanel-label { + background-image: url("chrome://browser/skin/window.svg"); + background-size: 1em; + background-repeat: no-repeat; + background-position-x: .5em; + background-position-y: center; + padding-inline-start: 2em; + -moz-context-properties: fill; + fill: var(--color-accent-primary); + @media (forced-colors) { + fill: var(--icon-color); + } +} + /** * Dialogs */
===================================== toolkit/components/resistfingerprinting/RFPHelper.sys.mjs ===================================== @@ -245,7 +245,7 @@ class _RFPHelper { switch (aMessage.type) { case "TabOpen": { let browser = aMessage.target.linkedBrowser; - this._roundOrResetContentSize(browser, /* isNewTab = */ true); + this._roundOrResetContentSize(browser, { isNewTab: true }); browser.ownerGlobal._rfpResizeObserver.observe(browser.parentElement); break; } @@ -509,7 +509,7 @@ class _RFPHelper { ); }
- _roundOrResetContentSize(aBrowser, isNewTab = false) { + _roundOrResetContentSize(aBrowser, context = {}) { // We won't do anything for lazy browsers. if (!aBrowser?.isConnected) { return; @@ -518,7 +518,7 @@ class _RFPHelper { // this tab doesn't need letterboxing this._resetContentSize(aBrowser); } else { - this._roundContentSize(aBrowser, isNewTab); + this._roundContentSize(aBrowser, context); } }
@@ -544,7 +544,8 @@ class _RFPHelper { /** * The function will round the given browser size */ - async _roundContentSize(aBrowser, isNewTab = false) { + async _roundContentSize(aBrowser, context) { + const { isResize, isNewTab } = context; let logPrefix = `_roundContentSize[${Math.random()}]`; log(logPrefix); let win = aBrowser.ownerGlobal; @@ -716,6 +717,26 @@ class _RFPHelper { borderRadius === 0 ? "hidden" : "", "--letterboxing-border-radius": borderRadius, }); + + if ( + isResize && + this.letterboxingEnabled && + (parentWidth > lastRoundedSize.width || + parentHeight > lastRoundedSize.height) + ) { + const updateStatus = async args => { + win.XULBrowserWindow.letterboxingStatus = args + ? await win.document.l10n.formatValue( + "letterboxing-size-status", + args + ) + : ""; + win.StatusPanel.update(); + }; + updateStatus(lastRoundedSize); + win.clearTimeout(win._letterboxingStatusTimeout); + win._letterboxingStatusTimeout = win.setTimeout(updateStatus, 1000); + } }
// If the size of the content is already quantized, we do nothing. @@ -818,8 +839,12 @@ class _RFPHelper { aWindow.addEventListener("TabOpen", this); const resizeObserver = (aWindow._rfpResizeObserver = new aWindow.ResizeObserver(entries => { + const context = { isResize: true }; for (let { target } of entries) { - this._roundOrResetContentSize(target.querySelector("browser")); + this._roundOrResetContentSize( + target.querySelector("browser"), + context + ); } })); // observe resizing of each browser's parent (gets rid of RPC from content windows)
===================================== toolkit/locales/en-US/toolkit/global/base-browser.ftl ===================================== @@ -17,6 +17,15 @@ basebrowser-rfp-maximize-warning-message = Maximizing the browser window can all basebrowser-rfp-restore-window-size-button-label = Restore basebrowser-rfp-restore-window-size-button-ak = R
+## Letterbox size indicator (appearing on the bottom of the viewport) + +# Shows the current tab's letterboxed vieport size when resizing. +# "Letterbox(ing)" should be treated as a feature/product name, and likely not changed in other languages. +# The "×" symbol is a unicode (U+00D7) symbol for multiply. +# $width (Number) - The window width. The "NUMBER" function will format this number to the same locale, and the "useGrouping" option will remove grouping symbols, like thousand separators. +# $height (Number) - The window height. +letterboxing-size-status = Letterbox size: { NUMBER($width, useGrouping: "false") } × { NUMBER($height, useGrouping: "false") } + ## Tooltip for the about:addons recommended badge
basebrowser-addon-badge-recommended = Mozilla only recommends extensions that meet their standards for security and performance
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/9461cc7...
tor-commits@lists.torproject.org