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
-
313af76b
by hackademix at 2025-04-07T22:14:40+02:00
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:
... | ... | @@ -7513,6 +7513,7 @@ var StatusPanel = { |
7513 | 7513 | if (XULBrowserWindow.busyUI) {
|
7514 | 7514 | types.push("status");
|
7515 | 7515 | }
|
7516 | + types.push("letterboxingStatus");
|
|
7516 | 7517 | types.push("defaultStatus");
|
7517 | 7518 | for (type of types) {
|
7518 | 7519 | if ((text = XULBrowserWindow[type])) {
|
... | ... | @@ -115,6 +115,7 @@ |
115 | 115 | min-width: min(23em, 33%);
|
116 | 116 | }
|
117 | 117 | |
118 | + &[type=letterboxingStatus],
|
|
118 | 119 | &[type=overLink] {
|
119 | 120 | transition: opacity 120ms ease-out, visibility 120ms;
|
120 | 121 | }
|
... | ... | @@ -123,12 +124,14 @@ |
123 | 124 | direction: ltr;
|
124 | 125 | }
|
125 | 126 | |
127 | + .exclude-letterboxing &[type=letterboxingStatus],
|
|
126 | 128 | &[inactive],
|
127 | 129 | :root[inDOMFullscreen] &:not([type=overLink]) {
|
128 | 130 | transition: none;
|
129 | 131 | opacity: 0;
|
130 | 132 | visibility: hidden;
|
131 | 133 | |
134 | + &[previoustype=letterboxingStatus],
|
|
132 | 135 | &[previoustype=overLink] {
|
133 | 136 | transition: opacity 200ms ease-out, visibility 200ms;
|
134 | 137 | }
|
... | ... | @@ -177,6 +180,21 @@ |
177 | 180 | }
|
178 | 181 | }
|
179 | 182 | |
183 | +#statuspanel[type=letterboxingStatus] > #statuspanel-label,
|
|
184 | +#statuspanel[previoustype=letterboxingStatus][inactive] > #statuspanel-label {
|
|
185 | + background-image: url("chrome://browser/skin/window.svg");
|
|
186 | + background-size: 1em;
|
|
187 | + background-repeat: no-repeat;
|
|
188 | + background-position-x: .5em;
|
|
189 | + background-position-y: center;
|
|
190 | + padding-inline-start: 2em;
|
|
191 | + -moz-context-properties: fill;
|
|
192 | + fill: var(--color-accent-primary);
|
|
193 | + @media (forced-colors) {
|
|
194 | + fill: var(--icon-color);
|
|
195 | + }
|
|
196 | +}
|
|
197 | + |
|
180 | 198 | /**
|
181 | 199 | * Dialogs
|
182 | 200 | */
|
... | ... | @@ -245,7 +245,7 @@ class _RFPHelper { |
245 | 245 | switch (aMessage.type) {
|
246 | 246 | case "TabOpen": {
|
247 | 247 | let browser = aMessage.target.linkedBrowser;
|
248 | - this._roundOrResetContentSize(browser, /* isNewTab = */ true);
|
|
248 | + this._roundOrResetContentSize(browser, { isNewTab: true });
|
|
249 | 249 | browser.ownerGlobal._rfpResizeObserver.observe(browser.parentElement);
|
250 | 250 | break;
|
251 | 251 | }
|
... | ... | @@ -509,7 +509,7 @@ class _RFPHelper { |
509 | 509 | );
|
510 | 510 | }
|
511 | 511 | |
512 | - _roundOrResetContentSize(aBrowser, isNewTab = false) {
|
|
512 | + _roundOrResetContentSize(aBrowser, context = {}) {
|
|
513 | 513 | // We won't do anything for lazy browsers.
|
514 | 514 | if (!aBrowser?.isConnected) {
|
515 | 515 | return;
|
... | ... | @@ -518,7 +518,7 @@ class _RFPHelper { |
518 | 518 | // this tab doesn't need letterboxing
|
519 | 519 | this._resetContentSize(aBrowser);
|
520 | 520 | } else {
|
521 | - this._roundContentSize(aBrowser, isNewTab);
|
|
521 | + this._roundContentSize(aBrowser, context);
|
|
522 | 522 | }
|
523 | 523 | }
|
524 | 524 | |
... | ... | @@ -544,7 +544,8 @@ class _RFPHelper { |
544 | 544 | /**
|
545 | 545 | * The function will round the given browser size
|
546 | 546 | */
|
547 | - async _roundContentSize(aBrowser, isNewTab = false) {
|
|
547 | + async _roundContentSize(aBrowser, context) {
|
|
548 | + const { isResize, isNewTab } = context;
|
|
548 | 549 | let logPrefix = `_roundContentSize[${Math.random()}]`;
|
549 | 550 | log(logPrefix);
|
550 | 551 | let win = aBrowser.ownerGlobal;
|
... | ... | @@ -716,6 +717,26 @@ class _RFPHelper { |
716 | 717 | borderRadius === 0 ? "hidden" : "",
|
717 | 718 | "--letterboxing-border-radius": borderRadius,
|
718 | 719 | });
|
720 | + |
|
721 | + if (
|
|
722 | + isResize &&
|
|
723 | + this.letterboxingEnabled &&
|
|
724 | + (parentWidth > lastRoundedSize.width ||
|
|
725 | + parentHeight > lastRoundedSize.height)
|
|
726 | + ) {
|
|
727 | + const updateStatus = async args => {
|
|
728 | + win.XULBrowserWindow.letterboxingStatus = args
|
|
729 | + ? await win.document.l10n.formatValue(
|
|
730 | + "letterboxing-size-status",
|
|
731 | + args
|
|
732 | + )
|
|
733 | + : "";
|
|
734 | + win.StatusPanel.update();
|
|
735 | + };
|
|
736 | + updateStatus(lastRoundedSize);
|
|
737 | + win.clearTimeout(win._letterboxingStatusTimeout);
|
|
738 | + win._letterboxingStatusTimeout = win.setTimeout(updateStatus, 1000);
|
|
739 | + }
|
|
719 | 740 | }
|
720 | 741 | |
721 | 742 | // If the size of the content is already quantized, we do nothing.
|
... | ... | @@ -818,8 +839,12 @@ class _RFPHelper { |
818 | 839 | aWindow.addEventListener("TabOpen", this);
|
819 | 840 | const resizeObserver = (aWindow._rfpResizeObserver =
|
820 | 841 | new aWindow.ResizeObserver(entries => {
|
842 | + const context = { isResize: true };
|
|
821 | 843 | for (let { target } of entries) {
|
822 | - this._roundOrResetContentSize(target.querySelector("browser"));
|
|
844 | + this._roundOrResetContentSize(
|
|
845 | + target.querySelector("browser"),
|
|
846 | + context
|
|
847 | + );
|
|
823 | 848 | }
|
824 | 849 | }));
|
825 | 850 | // observe resizing of each browser's parent (gets rid of RPC from content windows)
|
... | ... | @@ -17,6 +17,15 @@ basebrowser-rfp-maximize-warning-message = Maximizing the browser window can all |
17 | 17 | basebrowser-rfp-restore-window-size-button-label = Restore
|
18 | 18 | basebrowser-rfp-restore-window-size-button-ak = R
|
19 | 19 | |
20 | +## Letterbox size indicator (appearing on the bottom of the viewport)
|
|
21 | + |
|
22 | +# Shows the current tab's letterboxed vieport size when resizing.
|
|
23 | +# "Letterbox(ing)" should be treated as a feature/product name, and likely not changed in other languages.
|
|
24 | +# The "×" symbol is a unicode (U+00D7) symbol for multiply.
|
|
25 | +# $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.
|
|
26 | +# $height (Number) - The window height.
|
|
27 | +letterboxing-size-status = Letterbox size: { NUMBER($width, useGrouping: "false") } × { NUMBER($height, useGrouping: "false") }
|
|
28 | + |
|
20 | 29 | ## Tooltip for the about:addons recommended badge
|
21 | 30 | |
22 | 31 | basebrowser-addon-badge-recommended = Mozilla only recommends extensions that meet their standards for security and performance
|