Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html

Issue 882813005: Respect the smooth scrolling setting in LayerScrollableArea. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <style>
3
4 #container {
5 width: 200px;
6 height: 200px;
7 overflow: scroll;
8 }
9
10 #content {
11 width: 7500px;
12 height: 7500px;
13 background-color: blue;
14 }
15
16 </style>
17 <script src="../../resources/js-test.js"></script>
18 <div id="container">
19 <div id="content"></div>
20 </div>
21 <div id="console"></div>
22 <script>
23
24 jsTestIsAsync = true;
25 element = document.getElementById("container");
26
27 var testConfigs = [
28 {preciseDeltas: false, expectSmooth: true},
29 {preciseDeltas: true, expectSmooth: false},
30 ];
31 var config;
32 var waitingForScroll = false;
33 var scrollStart, scrollDuration;
34
35 function nextConfig() {
36 config = testConfigs.shift();
37 if (!config)
38 finishJSTest();
39
40 element.addEventListener("scroll", onElementScroll);
41
42 eventSender.mouseMoveTo(100, 100);
43 eventSender.mouseScrollBy(0, -2, /* paged */ false,
44 config.preciseDeltas);
45 scrollStart = performance.now();
46 }
47
48 function reset() {
49 element.removeEventListener("scroll", onElementScroll);
50 element.scrollTop = 0;
51 waitingForScroll = false;
52 }
53
54 function onElementScroll() {
55 if (waitingForScroll) {
56 if (element.scrollTop == 80) {
57 scrollDuration = performance.now() - scrollStart;
58 shouldBeTrue("scrollDuration < 500");
59 reset();
60 nextConfig();
61 }
62 } else if (config.expectSmooth) {
63 shouldNotBe("element.scrollTop", "80");
64 waitingForScroll = true;
65 } else {
66 shouldBe("element.scrollTop", "80");
67 reset();
68 nextConfig();
69 }
70 }
71
72 function runTest() {
73 internals.settings.setScrollAnimatorEnabled(true);
74 nextConfig();
75 }
76
77 description("Tests that overflow scrolls are animated, unless the wheel " +
78 "event has precise scrolling deltas.");
79
80 if (window.eventSender)
81 runTest();
82 else
83 debug("FAIL: This test requires window.eventSender.");
84
85 </script>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/scroll-behavior/overflow-scroll-animates-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698