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

Side by Side Diff: third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html

Issue 1678713002: Correctly handle cancelling compositor animations initiated from main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 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 <script src="../../../../../resources/js-test.js"></script>
3 <style>
4 body {
5 height: 2000px;
6 width: 2000px;
7 }
8 </style>
9
10 <script>
11 window.jsTestIsAsync = true;
12
13 description("This test ensures that input driven user scrolls get cancelled\
14 by non-input driven scrolls.");
15
16 // From ScrollAnimatorCompositorCoordinator::RunState.
17 var IDLE = 0;
18 var RUNNING_ON_COMPOSITOR = 2;
19 var WAITING_TO_CANCEL_ON_COMPOSITOR = 5;
20 function isOrWillBeCancelled(node) {
21 var state = internals.getScrollAnimationState(node);
22 return state == WAITING_TO_CANCEL_ON_COMPOSITOR || state == IDLE;
23 }
24
25 function runTest() {
26 if (document.scrollingElement.scrollTop == 0) {
27 requestAnimationFrame(runTest);
28 } else {
29 shouldBeTrue("internals.getScrollAnimationState(document) " +
30 "== RUNNING_ON_COMPOSITOR");
31
32 // Programmatic scroll should cancel smooth scroll.
33 document.scrollingElement.scrollBy({top: 1, behavior: "smooth"});
34 shouldBeTrue("isOrWillBeCancelled(document)");
35 shouldBecomeEqual("document.scrollingElement.scrollTop < 40 && " +
36 "document.scrollingElement.scrollLeft == 0", "true", finishJSTest);
37 }
38 }
39
40 onload = function() {
41 if (!window.eventSender || !window.internals) {
42 finishJSTest();
43 return;
44 }
45
46 // Turn on smooth scrolling.
47 internals.settings.setScrollAnimatorEnabled(true);
48
49 document.scrollingElement.scrollTop = 0;
50
51 // Scroll down 1 tick (40px).
52 eventSender.mouseMoveTo(20, 20);
53 eventSender.mouseScrollBy(0, -1);
54
55 requestAnimationFrame(runTest);
56 }
57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698