[tbb-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-115.10.0esr-13.5-1] Revert "Bug 23104: Add a default line height compensation"

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Thu Apr 11 13:18:27 UTC 2024



Pier Angelo Vendrame pushed to branch mullvad-browser-115.10.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser


Commits:
792ec04b by Pier Angelo Vendrame at 2024-04-11T15:18:16+02:00
Revert "Bug 23104: Add a default line height compensation"

Bug 40919: Drop line-height protection introduced in #23104.

The main purpose of this patch was to hide the operating system.
However, we don't hide it anymore, so it is not necessary and we do not
have any proof of other benefits e.g., that it hides the OS minor
version.

This reverts commit 15172f2895e0691b57f12c24e99c9b84ee9395ff.

- - - - -


3 changed files:

- layout/generic/ReflowInput.cpp
- layout/generic/test/mochitest.ini
- − layout/generic/test/test_tor_bug23104.html


Changes:

=====================================
layout/generic/ReflowInput.cpp
=====================================
@@ -34,7 +34,6 @@
 #include "nsTableCellFrame.h"
 #include "nsTableFrame.h"
 #include "StickyScrollContainer.h"
-#include "nsContentUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::css;
@@ -2724,12 +2723,12 @@ void ReflowInput::CalculateBlockSideMargins() {
 // This is necessary because without this compensation, normal line height might
 // look too tight.
 constexpr float kNormalLineHeightFactor = 1.2f;
-static nscoord GetNormalLineHeight(nsFontMetrics* aFontMetrics, bool aRFP) {
+static nscoord GetNormalLineHeight(nsFontMetrics* aFontMetrics) {
   MOZ_ASSERT(aFontMetrics, "no font metrics");
   nscoord externalLeading = aFontMetrics->ExternalLeading();
   nscoord internalLeading = aFontMetrics->InternalLeading();
   nscoord emHeight = aFontMetrics->EmHeight();
-  if ((!internalLeading && !externalLeading) || aRFP) {
+  if (!internalLeading && !externalLeading) {
     return NSToCoordRound(emHeight * kNormalLineHeightFactor);
   }
   return emHeight + internalLeading + externalLeading;
@@ -2769,9 +2768,7 @@ static inline nscoord ComputeLineHeight(const StyleLineHeight& aLh,
     RefPtr<nsFontMetrics> fm = nsLayoutUtils::GetMetricsFor(
         aPresContext, aIsVertical, &aRelativeToFont, size,
         /* aUseUserFontSet = */ true);
-    return GetNormalLineHeight(
-        fm, aPresContext->Document()->ShouldResistFingerprinting(
-                RFPTarget::Unknown));
+    return GetNormalLineHeight(fm);
   }
   // If we don't have a pres context, use a 1.2em fallback.
   size.ScaleBy(kNormalLineHeightFactor);


=====================================
layout/generic/test/mochitest.ini
=====================================
@@ -164,4 +164,3 @@ support-files =
 [test_scroll_on_display_contents.html]
 support-files = !/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
 [test_bug1803209.html]
-[test_tor_bug23104.html]


=====================================
layout/generic/test/test_tor_bug23104.html deleted
=====================================
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML>
-<meta charset="UTF-8">
-<html>
-<head>
-  <title>Test for Tor Bug #23104: CSS line-height reveals the platform Tor browser is running</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
-  <style type="text/css">
-    span {
-      background-color: #000;
-      color: #fff;
-      font-size: 16.5px;
-    }
-  </style>
-</head>
-<body>
-<span id="test1">Test1</span>
-<span id="test2">كلمة</span>
-<span id="test3">ação</span>
-<script>
-
-let setPref = async function (key, value) {
-  await SpecialPowers.pushPrefEnv({"set": [[key, value]]});
-}
-
-function getStyle(el, styleprop) {
-  el = document.getElementById(el);
-  return document.defaultView.getComputedStyle(el, null).getPropertyValue(styleprop);
-}
-
-function validateElement(elementName, isFingerprintResistent) {
-  var fontSize = getStyle(elementName, 'font-size');
-  var lineHeight = getStyle(elementName, 'line-height');
-  var validationCb = isFingerprintResistent ? is : isnot;
-  validationCb(parseFloat(lineHeight), Math.round(parseFloat(fontSize)) * 1.2, 'Line Height validation');
-}
-
-add_task(async function() {
-  await setPref("layout.css.line-height.normal-as-resolved-value.enabled", false);
-  for (let resistFingerprintingValue of [true, false]) {
-    await setPref("privacy.resistFingerprinting", resistFingerprintingValue);
-    for (let elementId of ['test1', 'test2', 'test3']) {
-      validateElement(elementId, resistFingerprintingValue);
-    }
-  }
-});
-
-</script>
-</body>
-</html>



View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/792ec04b260b200d8b738d7882dffc511501e8a1

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/792ec04b260b200d8b738d7882dffc511501e8a1
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240411/beb6fcb5/attachment-0001.htm>


More information about the tbb-commits mailing list