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

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

Issue 1320543006: Remove touch scroll chaining from main thread scrolling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@gclient
Patch Set: Fix silly mistake in mac expectations. Created 5 years, 2 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 <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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 [0, 0, -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, 0, 0, -45], 145 [0, 0, -45],
146 // The scrollingElement performs the frame scroll. 146 // The scrollingElement performs the frame scroll.
147 [0, 0, 0, 0, 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 // Consume one pixel of delta per call to applyScroll.
171 for (var i = 0; i < elements.length; ++i) {
172 if (scrollableElements.indexOf(elements[i]) == -1)
173 continue;
174 elements[i].setApplyScroll((function(scrollState) {
175 if (scrollState.deltaY !== 0)
176 scrollState.consumeDelta(0, -1);
177 }).bind(elements[i]), "perform-before-native-scroll");
178 }
179
180 // Scroll five times, with three scrollable elements. 170 // Scroll five times, with three scrollable elements.
181 // The scroll distance is decreased more the higher up the scroll chain the element is. 171 var cScrollTop = [85, 100, 100, 100, 100];
182 var cScrollTop = [85 - 1, 100, 100, 100, 100]; 172 var aScrollTop = [0, 0, 65, 100, 100];
183 var aScrollTop = [0, 0, 65 - 2, 100, 100]; 173 var scrollingElementScrollTop = [0, 0, 0, 0, 45];
184 var scrollingElementScrollTop = [0, 0, 0, 0, 45 - 3];
185 for (var i = 0; i < deltas.length; ++i) { 174 for (var i = 0; i < deltas.length; ++i) {
186 applyDelta(deltas[i]); 175 applyDelta(deltas[i]);
187 assert_equals(c.scrollTop, cScrollTop[i], "For id 'c' on step " + i); 176 assert_equals(c.scrollTop, cScrollTop[i], "For id 'c' on step " + i);
188 assert_equals(a.scrollTop, aScrollTop[i], "For id 'a' on step " + i); 177 assert_equals(a.scrollTop, aScrollTop[i], "For id 'a' on step " + i);
189 assert_equals(document.scrollingElement.scrollTop, scrollingElementScrollT op[i], "For scrollingElement on step " + i); 178 assert_equals(document.scrollingElement.scrollTop, scrollingElementScrollT op[i], "For scrollingElement on step " + i);
190 } 179 }
191 }, "Consuming deltas prevents scrolling."); 180 }, "Scroll propagation behaves correctly.");
192 181
193 test(function() { 182 test(function() {
194 reset(); 183 reset();
195 184
196 for (var i = 0; i < deltas.length; ++i) 185 for (var i = 0; i < deltas.length; ++i)
197 applyDelta(deltas[i]); 186 applyDelta(deltas[i]);
198 187
199 for (var i = 0; i < elements.length; ++i) { 188 for (var i = 0; i < elements.length; ++i) {
200 assert_equals(elements[i].numberOfScrollBegins, deltas.length, "Incorrect number of begin events for " + elements[i].id); 189 assert_equals(elements[i].numberOfScrollBegins, deltas.length, "Incorrect number of begin events for " + elements[i].id);
201 assert_equals(elements[i].numberOfScrollEnds, deltas.length, "Incorrect nu mber of end events for " + elements[i].id); 190 assert_equals(elements[i].numberOfScrollEnds, deltas.length, "Incorrect nu mber of end events for " + elements[i].id);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 window.requestAnimationFrame(raf); 235 window.requestAnimationFrame(raf);
247 } 236 }
248 237
249 executeFrameActions(frame_actions); 238 executeFrameActions(frame_actions);
250 } 239 }
251 } 240 }
252 241
253 </script> 242 </script>
254 </body> 243 </body>
255 </html> 244 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698