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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html

Issue 1646663002: Refactor Scroll Customization to share cc::ScrollStateData with blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linking. 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>ScrollState consumeDelta</title> 4 <title>ScrollState consumeDelta</title>
5 <script src="../../../resources/testharness.js"></script> 5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script> 6 <script src="../../../resources/testharnessreport.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 10
11 function deltaShouldBe(scrollState, x, y, testName) { 11 function deltaShouldBe(scrollState, x, y, testName) {
12 test(function() { 12 test(function() {
13 assert_equals(scrollState.deltaX, x); 13 assert_equals(scrollState.deltaX, x);
14 assert_equals(scrollState.deltaY, y); 14 assert_equals(scrollState.deltaY, y);
15 }, testName); 15 }, testName);
16 } 16 }
17 17
18 test(function() { 18 test(function() {
19 assert_true('ScrollState' in window, "'ScrollState' in window"); 19 assert_true('ScrollState' in window, "'ScrollState' in window");
20 }, "These tests only work with scroll customization enabled."); 20 }, "These tests only work with scroll customization enabled.");
21 21
22 if ('ScrollState' in window) { 22 if ('ScrollState' in window) {
23 var scrollState = new ScrollState(10, -20); 23 var scrollState = new ScrollState({deltaX: 10, deltaY: -20});
24 deltaShouldBe(scrollState, 10, -20, "Unconsumed deltas"); 24 deltaShouldBe(scrollState, 10, -20, "Unconsumed deltas");
25 scrollState.consumeDelta(2, -3); 25 scrollState.consumeDelta(2, -3);
26 deltaShouldBe(scrollState, 8, -17, "Partially consumed deltas"); 26 deltaShouldBe(scrollState, 8, -17, "Partially consumed deltas");
27 scrollState.consumeDelta(8, -17); 27 scrollState.consumeDelta(8, -17);
28 deltaShouldBe(scrollState, 0, 0, "Fully consumed deltas"); 28 deltaShouldBe(scrollState, 0, 0, "Fully consumed deltas");
29 } 29 }
30 </script> 30 </script>
31 </body> 31 </body>
32 </html> 32 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698