[tbb-commits] [tor-browser] 01/06: Revert "Bug 32220: Improve the letterboxing experience"
gitolite role
git at cupani.torproject.org
Thu Nov 17 15:54:57 UTC 2022
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.13.0esr-11.5-1
in repository tor-browser.
commit 4388893254f0cf6af8b07137eace051ce32984af
Author: hackademix <giorgio at maone.net>
AuthorDate: Thu Nov 17 13:31:32 2022 +0000
Revert "Bug 32220: Improve the letterboxing experience"
This reverts commit 30ddf9a89933a98f28fc3e2202b819a704d96320.
---
browser/base/content/browser.css | 7 --
browser/base/content/tabbrowser-tab.js | 9 ---
browser/themes/shared/tabs.inc.css | 6 --
.../components/resistfingerprinting/RFPHelper.jsm | 94 +++-------------------
4 files changed, 12 insertions(+), 104 deletions(-)
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css
index 0a766b976fc5..2d74162b1543 100644
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -94,13 +94,6 @@ body {
}
}
-.browserStack > browser.letterboxing {
- border-color: var(--chrome-content-separator-color);
- border-style: solid;
- border-width : 1px;
- border-top: none;
-}
-
%ifdef MENUBAR_CAN_AUTOHIDE
#toolbar-menubar[autohide="true"] {
overflow: hidden;
diff --git a/browser/base/content/tabbrowser-tab.js b/browser/base/content/tabbrowser-tab.js
index 524493ac9afb..2d12c357da14 100644
--- a/browser/base/content/tabbrowser-tab.js
+++ b/browser/base/content/tabbrowser-tab.js
@@ -230,15 +230,6 @@
return true;
}
- get needsLetterbox() {
- let browser = this.linkedBrowser;
- if (isBlankPageURL(browser.currentURI.spec)) {
- return false;
- }
-
- return true;
- }
-
get lastAccessed() {
return this._lastAccessed == Infinity ? Date.now() : this._lastAccessed;
}
diff --git a/browser/themes/shared/tabs.inc.css b/browser/themes/shared/tabs.inc.css
index 98f3c68e4a04..2a572d2dce2c 100644
--- a/browser/themes/shared/tabs.inc.css
+++ b/browser/themes/shared/tabs.inc.css
@@ -50,12 +50,6 @@
background-color: var(--tabpanel-background-color);
}
-/* extend down the toolbar's colors when letterboxing is enabled*/
-#tabbrowser-tabpanels.letterboxing {
- background-color: var(--toolbar-bgcolor);
- background-image: var(--toolbar-bgimage);
-}
-
#tabbrowser-tabs,
#tabbrowser-arrowscrollbox,
#tabbrowser-tabs[positionpinnedtabs] > #tabbrowser-arrowscrollbox > .tabbrowser-tab[pinned] {
diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm
index 9520d8720631..166ad21e9013 100644
--- a/toolkit/components/resistfingerprinting/RFPHelper.jsm
+++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm
@@ -40,7 +40,6 @@ class _RFPHelper {
// ============================================================================
constructor() {
this._initialized = false;
- this._borderDimensions = null;
}
init() {
@@ -362,24 +361,6 @@ class _RFPHelper {
});
}
- getBorderDimensions(aBrowser) {
- if (this._borderDimensions) {
- return this._borderDimensions;
- }
-
- const win = aBrowser.ownerGlobal;
- const browserStyle = win.getComputedStyle(aBrowser);
-
- this._borderDimensions = {
- top : parseInt(browserStyle.borderTopWidth),
- right: parseInt(browserStyle.borderRightWidth),
- bottom : parseInt(browserStyle.borderBottomWidth),
- left : parseInt(browserStyle.borderLeftWidth),
- };
-
- return this._borderDimensions;
- }
-
_addOrClearContentMargin(aBrowser) {
let tab = aBrowser.getTabBrowser().getTabForBrowser(aBrowser);
@@ -388,13 +369,9 @@ class _RFPHelper {
return;
}
- // we add the letterboxing class even if the content does not need letterboxing
- // in which case margins are set such that the borders are hidden
- aBrowser.classList.add("letterboxing");
-
// We should apply no margin around an empty tab or a tab with system
// principal.
- if (!tab.needsLetterbox || aBrowser.contentPrincipal.isSystemPrincipal) {
+ if (tab.isEmpty || aBrowser.contentPrincipal.isSystemPrincipal) {
this._clearContentViewMargin(aBrowser);
} else {
this._roundContentView(aBrowser);
@@ -562,29 +539,10 @@ class _RFPHelper {
// Calculating the margins around the browser element in order to round the
// content viewport. We will use a 200x100 stepping if the dimension set
// is not given.
-
- const borderDimensions = this.getBorderDimensions(aBrowser);
- const marginDims = calcMargins(containerWidth, containerHeight - borderDimensions.top);
-
- let margins = {
- top : 0,
- right : 0,
- bottom : 0,
- left : 0,
- };
-
- // snap browser element to top
- margins.top = 0;
- // and leave 'double' margin at the bottom
- margins.bottom = 2 * marginDims.height - borderDimensions.bottom;
- // identical margins left and right
- margins.right = marginDims.width - borderDimensions.right;
- margins.left = marginDims.width - borderDimensions.left;
-
- const marginStyleString = `${margins.top}px ${margins.right}px ${margins.bottom}px ${margins.left}px`;
+ let margins = calcMargins(containerWidth, containerHeight);
// If the size of the content is already quantized, we do nothing.
- if (aBrowser.style.margin === marginStyleString) {
+ if (aBrowser.style.margin == `${margins.height}px ${margins.width}px`) {
log("_roundContentView[" + logId + "] is_rounded == true");
if (this._isLetterboxingTesting) {
log(
@@ -605,35 +563,19 @@ class _RFPHelper {
"_roundContentView[" +
logId +
"] setting margins to " +
- marginStyleString
+ margins.width +
+ " x " +
+ margins.height
);
-
- // The margin background color is determined by the background color of the
- // window's tabpanels#tabbrowser-tabpanels element
- aBrowser.style.margin = marginStyleString;
+ // One cannot (easily) control the color of a margin unfortunately.
+ // An initial attempt to use a border instead of a margin resulted
+ // in offset event dispatching; so for now we use a colorless margin.
+ aBrowser.style.margin = `${margins.height}px ${margins.width}px`;
});
}
_clearContentViewMargin(aBrowser) {
- const borderDimensions = this.getBorderDimensions(aBrowser);
- // set the margins such that the browser elements border is visible up top, but
- // are rendered off-screen on the remaining sides
- let margins = {
- top : 0,
- right : -borderDimensions.right,
- bottom : -borderDimensions.bottom,
- left : -borderDimensions.left,
- };
- const marginStyleString = `${margins.top}px ${margins.right}px ${margins.bottom}px ${margins.left}px`;
-
- aBrowser.ownerGlobal.requestAnimationFrame(() => {
- aBrowser.style.margin = marginStyleString;
- });
- }
-
- _removeLetterboxing(aBrowser) {
aBrowser.ownerGlobal.requestAnimationFrame(() => {
- aBrowser.classList.remove("letterboxing");
aBrowser.style.margin = "";
});
}
@@ -651,11 +593,6 @@ class _RFPHelper {
aWindow.gBrowser.addTabsProgressListener(this);
aWindow.addEventListener("TabOpen", this);
- const tabPanel = aWindow.document.getElementById("tabbrowser-tabpanels");
- if (tabPanel) {
- tabPanel.classList.add("letterboxing");
- }
-
// Rounding the content viewport.
this._updateMarginsForTabsInWindow(aWindow);
}
@@ -679,17 +616,10 @@ class _RFPHelper {
tabBrowser.removeTabsProgressListener(this);
aWindow.removeEventListener("TabOpen", this);
- // revert tabpanel's background colors to default
- const tabPanel = aWindow.document.getElementById("tabbrowser-tabpanels");
- if (tabPanel) {
- tabPanel.classList.remove("letterboxing");
- }
-
- // and revert each browser element to default,
- // restore default margins and remove letterboxing class
+ // Clear all margins and tooltip for all browsers.
for (let tab of tabBrowser.tabs) {
let browser = tab.linkedBrowser;
- this._removeLetterboxing(browser);
+ this._clearContentViewMargin(browser);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tbb-commits
mailing list