Pier Angelo Vendrame pushed to branch base-browser-115.10.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
d1853152
by Pier Angelo Vendrame at 2024-04-11T15:17:31+02:00
3 changed files:
- layout/generic/ReflowInput.cpp
- layout/generic/test/mochitest.ini
- − layout/generic/test/test_tor_bug23104.html
Changes:
... | ... | @@ -34,7 +34,6 @@ |
34 | 34 | #include "nsTableCellFrame.h"
|
35 | 35 | #include "nsTableFrame.h"
|
36 | 36 | #include "StickyScrollContainer.h"
|
37 | -#include "nsContentUtils.h"
|
|
38 | 37 | |
39 | 38 | using namespace mozilla;
|
40 | 39 | using namespace mozilla::css;
|
... | ... | @@ -2724,12 +2723,12 @@ void ReflowInput::CalculateBlockSideMargins() { |
2724 | 2723 | // This is necessary because without this compensation, normal line height might
|
2725 | 2724 | // look too tight.
|
2726 | 2725 | constexpr float kNormalLineHeightFactor = 1.2f;
|
2727 | -static nscoord GetNormalLineHeight(nsFontMetrics* aFontMetrics, bool aRFP) {
|
|
2726 | +static nscoord GetNormalLineHeight(nsFontMetrics* aFontMetrics) {
|
|
2728 | 2727 | MOZ_ASSERT(aFontMetrics, "no font metrics");
|
2729 | 2728 | nscoord externalLeading = aFontMetrics->ExternalLeading();
|
2730 | 2729 | nscoord internalLeading = aFontMetrics->InternalLeading();
|
2731 | 2730 | nscoord emHeight = aFontMetrics->EmHeight();
|
2732 | - if ((!internalLeading && !externalLeading) || aRFP) {
|
|
2731 | + if (!internalLeading && !externalLeading) {
|
|
2733 | 2732 | return NSToCoordRound(emHeight * kNormalLineHeightFactor);
|
2734 | 2733 | }
|
2735 | 2734 | return emHeight + internalLeading + externalLeading;
|
... | ... | @@ -2769,9 +2768,7 @@ static inline nscoord ComputeLineHeight(const StyleLineHeight& aLh, |
2769 | 2768 | RefPtr<nsFontMetrics> fm = nsLayoutUtils::GetMetricsFor(
|
2770 | 2769 | aPresContext, aIsVertical, &aRelativeToFont, size,
|
2771 | 2770 | /* aUseUserFontSet = */ true);
|
2772 | - return GetNormalLineHeight(
|
|
2773 | - fm, aPresContext->Document()->ShouldResistFingerprinting(
|
|
2774 | - RFPTarget::Unknown));
|
|
2771 | + return GetNormalLineHeight(fm);
|
|
2775 | 2772 | }
|
2776 | 2773 | // If we don't have a pres context, use a 1.2em fallback.
|
2777 | 2774 | size.ScaleBy(kNormalLineHeightFactor);
|
... | ... | @@ -164,4 +164,3 @@ support-files = |
164 | 164 | [test_scroll_on_display_contents.html]
|
165 | 165 | support-files = !/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
|
166 | 166 | [test_bug1803209.html] |
167 | -[test_tor_bug23104.html] |
1 | -<!DOCTYPE HTML>
|
|
2 | -<meta charset="UTF-8">
|
|
3 | -<html>
|
|
4 | -<head>
|
|
5 | - <title>Test for Tor Bug #23104: CSS line-height reveals the platform Tor browser is running</title>
|
|
6 | - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
7 | - <script type="application/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
|
|
8 | - <style type="text/css">
|
|
9 | - span {
|
|
10 | - background-color: #000;
|
|
11 | - color: #fff;
|
|
12 | - font-size: 16.5px;
|
|
13 | - }
|
|
14 | - </style>
|
|
15 | -</head>
|
|
16 | -<body>
|
|
17 | -<span id="test1">Test1</span>
|
|
18 | -<span id="test2">كلمة</span>
|
|
19 | -<span id="test3">ação</span>
|
|
20 | -<script>
|
|
21 | - |
|
22 | -let setPref = async function (key, value) {
|
|
23 | - await SpecialPowers.pushPrefEnv({"set": [[key, value]]});
|
|
24 | -}
|
|
25 | - |
|
26 | -function getStyle(el, styleprop) {
|
|
27 | - el = document.getElementById(el);
|
|
28 | - return document.defaultView.getComputedStyle(el, null).getPropertyValue(styleprop);
|
|
29 | -}
|
|
30 | - |
|
31 | -function validateElement(elementName, isFingerprintResistent) {
|
|
32 | - var fontSize = getStyle(elementName, 'font-size');
|
|
33 | - var lineHeight = getStyle(elementName, 'line-height');
|
|
34 | - var validationCb = isFingerprintResistent ? is : isnot;
|
|
35 | - validationCb(parseFloat(lineHeight), Math.round(parseFloat(fontSize)) * 1.2, 'Line Height validation');
|
|
36 | -}
|
|
37 | - |
|
38 | -add_task(async function() {
|
|
39 | - await setPref("layout.css.line-height.normal-as-resolved-value.enabled", false);
|
|
40 | - for (let resistFingerprintingValue of [true, false]) {
|
|
41 | - await setPref("privacy.resistFingerprinting", resistFingerprintingValue);
|
|
42 | - for (let elementId of ['test1', 'test2', 'test3']) {
|
|
43 | - validateElement(elementId, resistFingerprintingValue);
|
|
44 | - }
|
|
45 | - }
|
|
46 | -});
|
|
47 | - |
|
48 | -</script>
|
|
49 | -</body>
|
|
50 | -</html> |