blob: 225182f7493449466b00a36e84f486513b5e2a43 (
plain)
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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Test for bug 1519339</title>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<style>
/* To exercise this bug, the page needs to be overflow:hidden in
* only one direction, and have actual room to scroll in the other.
* Otherwise we wouldn't try to hand the scroll off to APZ even
* before the fix.
*/
html {
overflow-y: hidden;
}
div {
width: 200vw;
height: 10000px;
background-color: lightblue;
}
</style>
</head>
<body>
<div></div>
<script>
async function test() {
info("Testing scrollTo() in overflow:hidden direction");
let scrollEndPromise = promiseScrollend();
window.scrollTo({ top: 2000, behavior: 'smooth' });
await scrollEndPromise;
await promiseApzFlushedRepaints();
is(window.scrollY, 2000,
"scrollTo() in overflow:hidden direction scrolled to destination");
info("Testing scrollBy() in overflow:hidden direction");
scrollEndPromise = promiseScrollend();
window.scrollBy({ top: 2000, behavior: 'smooth'});
await scrollEndPromise;
await promiseApzFlushedRepaints();
is(window.scrollY, 4000,
"scrollBy() in overflow:hidden direction scrolled to destination");
info("Testing scrollByLines() in overflow:hidden direction");
scrollEndPromise = promiseScrollend();
window.scrollByLines(5, { behavior: 'smooth' });
await scrollEndPromise;
await promiseApzFlushedRepaints();
// Don't try to predict the exact scroll distance, just check we've
// scrolled at all.
ok(window.scrollY > 4000,
"scrollByLines() in overflow:hidden direction performed scrolling");
}
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
</script>
</body>
</html>
|