blob: 29b11072cae28fa4a884c5f62503dd8e01b983cb (
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
62
63
64
65
|
<!DOCTYPE HTML>
<head>
<title>APZ overscroll handoff for fixed elements</title>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<meta name="viewport" content="width=device-width"/>
<style>
html, body {
margin: 0;
}
html {
overflow: auto;
background: blue;
}
.spacer {
height: 2000px;
}
#fixed {
position: fixed;
overflow: auto;
background: red;
width: 200px;
height: 200px;
top: 0;
left: 0;
}
</style>
</head>
<div id="fixed">
<div class="spacer"></div>
</div>
<div class="spacer"></div>
<script type="application/javascript">
async function test() {
// Scroll to the bottom of the fixed position element that should
// allow overscroll handoff.
fixed.scrollTop = fixed.scrollHeight;
// After scrolling to bottom tick the refresh driver.
await promiseFrame();
info("Start: fixed=" + fixed.scrollTop + " window=" + window.scrollY);
// Async scroll the fixed element by 200 pixels using the mouse-wheel.
// This should handoff the overscroll to the window.
await promiseMoveMouseAndScrollWheelOver(fixed, 50, 50, false, 200);
// Make sure scrolling that has happened is propagated to the main thread.
await promiseApzFlushedRepaints();
// Try another gesture to ensure the overscroll handoff runs.
await promiseMoveMouseAndScrollWheelOver(fixed, 50, 50, false, 200);
await promiseApzFlushedRepaints();
// Ensure that the window has scrolled.
isnot(window.scrollY, 0, "The overscroll should not handoff");
}
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
</script>
|