blob: bd743f2bf681d2ede7a501f057895eb1254e4515 (
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
|
<!DOCTYPE html>
<html>
<head>
<style>
#container {
width: 200px;
height: 200px;
overflow: scroll;
}
#content {
width: 7500px;
height: 7500px;
background-color: blue;
}
</style>
<script src="../../resources/js-test.js"></script>
<script type="text/javascript">
jsTestIsAsync = true;
description("This test checks that a smooth scroll finishes even when composited scrolling " +
"is lost during the animation.");
function startSmoothScroll() {
var scrollToOptions = {behavior: "smooth", top: 6000};
document.getElementById("container").scrollTo(scrollToOptions);
window.requestAnimationFrame(preventCompositedScrolling);
}
function preventCompositedScrolling() {
document.getElementById("container").style.borderRadius = "4px";
window.requestAnimationFrame(waitForSmoothScrollEnd);
}
function waitForSmoothScrollEnd() {
if (document.getElementById("container").scrollTop == 6000) {
testPassed("Scroll destination reached.");
finishJSTest();
} else {
window.requestAnimationFrame(waitForSmoothScrollEnd);
}
}
window.onload = function() {
if (window.internals) {
window.internals.settings.setPreferCompositingToLCDTextEnabled(true);
}
window.requestAnimationFrame(startSmoothScroll);
}
</script>
</head>
<body>
<div id="container">
<div id="content"></div>
</div>
</body>
</html>
|