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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html

Issue 1755773002: Pass the physical scroll delta through the scroll customization path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@removeOneDimensionalScrolls
Patch Set: Updated LayoutTest Created 4 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <title>Scroll customization methods are called appropriately.</title> 5 <title>Scroll customization methods are called appropriately.</title>
6 <script src="../../../resources/testharness.js"></script> 6 <script src="../../../resources/testharness.js"></script>
7 <script src="../../../resources/testharnessreport.js"></script> 7 <script src="../../../resources/testharnessreport.js"></script>
8 <style> 8 <style>
9 9
10 * { 10 * {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 <script> 61 <script>
62 test(function() { 62 test(function() {
63 assert_true('ScrollState' in window, "'ScrollState' in window"); 63 assert_true('ScrollState' in window, "'ScrollState' in window");
64 }, "These tests only work with scroll customization enabled."); 64 }, "These tests only work with scroll customization enabled.");
65 65
66 internals.settings.setScrollAnimatorEnabled(false); 66 internals.settings.setScrollAnimatorEnabled(false);
67 67
68 var originalApplyScrolls = []; 68 var originalApplyScrolls = [];
69 var originalDistributeScrolls = []; 69 var originalDistributeScrolls = [];
70 var deltas = [-85, -75, -65, -55, -45]; 70 var deltas = [85, 75, 65, 55, 45];
71 71
72 var elements = [ 72 var elements = [
73 document.getElementById("d"), 73 document.getElementById("d"),
74 document.getElementById("c"), 74 document.getElementById("c"),
75 document.getElementById("b"), 75 document.getElementById("b"),
76 document.getElementById("a"), 76 document.getElementById("a"),
77 document.scrollingElement]; 77 document.scrollingElement];
78 78
79 var scrollableElements = [elements[1], elements[3], elements[4]]; 79 var scrollableElements = [elements[1], elements[3], elements[4]];
80 80
(...skipping 21 matching lines...) Expand all
102 this.distributedDeltaY.push(scrollState.deltaY); 102 this.distributedDeltaY.push(scrollState.deltaY);
103 }).bind(elements[i]), "perform-before-native-scroll"); 103 }).bind(elements[i]), "perform-before-native-scroll");
104 104
105 // Add a gc, to ensure that these callbacks don't get collected. 105 // Add a gc, to ensure that these callbacks don't get collected.
106 gc(); 106 gc();
107 } 107 }
108 } 108 }
109 109
110 function applyDelta(d) { 110 function applyDelta(d) {
111 eventSender.gestureScrollBegin(10, 10); 111 eventSender.gestureScrollBegin(10, 10);
112 eventSender.gestureScrollUpdate(0, d); 112 eventSender.gestureScrollUpdate(0, -d);
113 eventSender.gestureScrollEnd(0, 0); 113 eventSender.gestureScrollEnd(0, 0);
114 } 114 }
115 115
116 if ('ScrollState' in window) { 116 if ('ScrollState' in window) {
117 test(function() { 117 test(function() {
118 reset(); 118 reset();
119 119
120 // Scroll five times, with three scrollable elements. 120 // Scroll five times, with three scrollable elements.
121 var cScrollTop = [85, 100, 100, 100, 100]; 121 var cScrollTop = [85, 100, 100, 100, 100];
122 var aScrollTop = [0, 0, 65, 100, 100]; 122 var aScrollTop = [0, 0, 65, 100, 100];
123 var scrollingElementScrollTop = [0, 0, 0, 0, 45]; 123 var scrollingElementScrollTop = [0, 0, 0, 0, 45];
124 124
125 for (var i = 0; i < deltas.length; ++i) { 125 for (var i = 0; i < deltas.length; ++i) {
126 applyDelta(deltas[i]); 126 applyDelta(deltas[i]);
127 assert_equals(a.scrollTop, aScrollTop[i], "For id 'a' on step " + i); 127 assert_equals(a.scrollTop, aScrollTop[i], "For id 'a' on step " + i);
128 assert_equals(c.scrollTop, cScrollTop[i], "For id 'c' on step " + i); 128 assert_equals(c.scrollTop, cScrollTop[i], "For id 'c' on step " + i);
129 assert_equals(document.scrollingElement.scrollTop, scrollingElementScrollT op[i], "For scrollingElement on step " + i); 129 assert_equals(document.scrollingElement.scrollTop, scrollingElementScrollT op[i], "For scrollingElement on step " + i);
130 } 130 }
131 }, "Scroll offsets are modified correctly."); 131 }, "Scroll offsets are modified correctly.");
132 132
133 test(function() { 133 test(function() {
134 reset(); 134 reset();
135 135
136 // Scroll five times, with five elements. 136 // Scroll five times, with five elements.
137 var unapplied = [ 137 var unapplied = [
138 // d, the innermost element, never applies any scroll. 138 // d, the innermost element, never applies any scroll.
139 [-85, -75, -65, -55, -45], 139 [85, 75, 65, 55, 45],
140 // c applies the first two scrolls, and then hits its scroll extents. 140 // c applies the first two scrolls, and then hits its scroll extents.
141 [0, 0, -65, -55, -45], 141 [0, 0, 65, 55, 45],
142 // b doesn't scroll, and so leaves the same deltas unapplied as c. 142 // b doesn't scroll, and so leaves the same deltas unapplied as c.
143 [-65, -55, -45], 143 [65, 55, 45],
144 // a hits its scroll extent on the second last step. 144 // a hits its scroll extent on the second last step.
145 [0, 0, -45], 145 [0, 0, 45],
146 // The scrollingElement performs the frame scroll. 146 // The scrollingElement performs the frame scroll.
147 [0]]; 147 [0]];
148 148
149 for (var i = 0; i < deltas.length; ++i) 149 for (var i = 0; i < deltas.length; ++i)
150 applyDelta(deltas[i]); 150 applyDelta(deltas[i]);
151 151
152 for (var i = 0; i < elements.length; ++i) { 152 for (var i = 0; i < elements.length; ++i) {
153 var el = elements[i]; 153 var el = elements[i];
154 // Every element sees the same deltas being distributed. 154 // Every element sees the same deltas being distributed.
155 assert_array_equals(el.distributedDeltaY, deltas, "distributed delta for " + el.id + ":"); 155 assert_array_equals(el.distributedDeltaY, deltas, "distributed delta for " + el.id + ":");
156 assert_array_equals(el.unappliedDeltaY, unapplied[i], "unapplied delta for " + el.id + ":"); 156 assert_array_equals(el.unappliedDeltaY, unapplied[i], "unapplied delta for " + el.id + ":");
157 } 157 }
158 158
159 // Ensure that the document leaves scroll unapplied when appropriate. 159 // Ensure that the document leaves scroll unapplied when appropriate.
160 var documentUnapplied = document.scrollingElement.unappliedDeltaY; 160 var documentUnapplied = document.scrollingElement.unappliedDeltaY;
161 applyDelta(-4000); 161 applyDelta(4000);
162 assert_equals(documentUnapplied[documentUnapplied.length - 1], 0); 162 assert_equals(documentUnapplied[documentUnapplied.length - 1], 0);
163 applyDelta(-4000); 163 applyDelta(4000);
164 assert_equals(documentUnapplied[documentUnapplied.length - 1], -4000); 164 assert_equals(documentUnapplied[documentUnapplied.length - 1], 4000);
165 }, "Correct amount of delta is consumed."); 165 }, "Correct amount of delta is consumed.");
166 166
167 test(function() { 167 test(function() {
168 reset(); 168 reset();
169 169
170 // Scroll five times, with three scrollable elements. 170 // Scroll five times, with three scrollable elements.
171 var cScrollTop = [85, 100, 100, 100, 100]; 171 var cScrollTop = [85, 100, 100, 100, 100];
172 var aScrollTop = [0, 0, 65, 100, 100]; 172 var aScrollTop = [0, 0, 65, 100, 100];
173 var scrollingElementScrollTop = [0, 0, 0, 0, 45]; 173 var scrollingElementScrollTop = [0, 0, 0, 0, 45];
174 for (var i = 0; i < deltas.length; ++i) { 174 for (var i = 0; i < deltas.length; ++i) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 window.requestAnimationFrame(raf); 235 window.requestAnimationFrame(raf);
236 } 236 }
237 237
238 executeFrameActions(frame_actions); 238 executeFrameActions(frame_actions);
239 } 239 }
240 } 240 }
241 241
242 </script> 242 </script>
243 </body> 243 </body>
244 </html> 244 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698