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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html
diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html b/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html
new file mode 100644
index 0000000000000000000000000000000000000000..154b1153b5d2e3dbaeaa8c1e8e1a95b42cab9b62
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<script src="../../../../../resources/js-test.js"></script>
+<style>
+ body {
+ height: 2000px;
+ width: 2000px;
+ }
+</style>
+
+<script>
+window.jsTestIsAsync = true;
+
+description("This test ensures that input driven user scrolls get cancelled\
+ by non-input driven scrolls.");
+
+// From ScrollAnimatorCompositorCoordinator::RunState.
+var IDLE = 0;
+var RUNNING_ON_COMPOSITOR = 2;
+var WAITING_TO_CANCEL_ON_COMPOSITOR = 5;
+function isOrWillBeCancelled(node) {
+ var state = internals.getScrollAnimationState(node);
+ return state == WAITING_TO_CANCEL_ON_COMPOSITOR || state == IDLE;
+}
+
+function runTest() {
+ if (document.scrollingElement.scrollTop == 0) {
+ requestAnimationFrame(runTest);
+ } else {
+ shouldBeTrue("internals.getScrollAnimationState(document) " +
+ "== RUNNING_ON_COMPOSITOR");
+
+ // Programmatic scroll should cancel smooth scroll.
+ document.scrollingElement.scrollBy({top: 1, behavior: "smooth"});
+ shouldBeTrue("isOrWillBeCancelled(document)");
+ shouldBecomeEqual("document.scrollingElement.scrollTop < 40 && " +
+ "document.scrollingElement.scrollLeft == 0", "true", finishJSTest);
+ }
+}
+
+onload = function() {
+ if (!window.eventSender || !window.internals) {
+ finishJSTest();
+ return;
+ }
+
+ // Turn on smooth scrolling.
+ internals.settings.setScrollAnimatorEnabled(true);
+
+ document.scrollingElement.scrollTop = 0;
+
+ // Scroll down 1 tick (40px).
+ eventSender.mouseMoveTo(20, 20);
+ eventSender.mouseScrollBy(0, -1);
+
+ requestAnimationFrame(runTest);
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698