1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
<!DOCTYPE HTML>
<title>Test for Bug 1832110</title>
<style>
:root {
--bw: 1px;
}
div {
display: inline-block;
}
table {
border-collapse: collapse;
}
td {
border: var(--bw) solid black;
line-height: 0;
padding: 0;
}
span {
display: inline-block;
width: 10px;
height: 10px;
background: grey;
}
.hide {
display: none;
}
</style>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/WindowSnapshot.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script class="testbody" type="text/javascript">
function set_td_border(width) {
document.documentElement.style.setProperty("--bw", width + "px");
}
function raf() {
return new Promise(resolve => {
requestAnimationFrame(resolve);
});
}
async function show_table(table, other) {
// TODO(dshin): Once bug 1825384 resolves, this should not be needed.
table.classList.remove("hide");
other.classList.add("hide");
getComputedStyle(table).getPropertyValue("display");
await raf();
}
async function run_test(relativeZoom, width) {
SpecialPowers.setFullZoom(window, relativeZoom);
set_td_border(width);
show_table(emptyrows, normal);
const s1 = await snapshotRect(window, emptyrows.getBoundingClientRect());
show_table(normal, emptyrows);
const s2 = await snapshotRect(window, normal.getBoundingClientRect());
assertSnapshots(s1, s2, true, null, "emptyrows", "normal " + relativeZoom + " " + width);
}
SimpleTest.waitForExplicitFinish();
const zoomsToTest = [
100,
110,
120,
130,
140,
150,
200,
250,
300,
];
const originalZoom = SpecialPowers.getFullZoom(window);
const widthsToTest = [
1,
3,
7,
11,
23,
];
for (let i = 0; i < zoomsToTest.length; ++i) {
let relativeZoom = originalZoom * zoomsToTest[i] / 100;
for (let j = 0; j < widthsToTest.length; ++j) {
add_task(async () => { await run_test(relativeZoom, widthsToTest[j]); });
}
}
add_task(async () => { SpecialPowers.setFullZoom(window, originalZoom); });
</script>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1832110">Mozilla Bug 1832110</a><br>
<div id="emptyrows" class="hide">
<table>
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
<tr></tr>
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
<tr></tr>
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
<tr></tr>
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
</table>
</div><div id="normal" class="hide">
<table>
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
</table>
</div>
|