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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-layoutObject.html

Issue 2484563003: Determine the layoutobject of middleClickAutoscroll by the scroll direction. (Closed)
Patch Set: Move the logic to AutoscrollController.cpp Created 4 years, 1 month 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/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <div id = "div" style="overflow: auto; width: 1400px">
5 <table style="height:2000px; width: 1800px">
6 <tbody>
7 <tr style="height: 2000px">
8 <td id="td" style="width: 600px; height: 2000px"></td>
9 <td id="iframe" style="width: 1200px; height: 2000px">
10 <iframe style="width: 1000px; height: 2000px" src="resources/middleClick Autoscroll-iframe.html"></iframe>
11 </td>
12 </tr>
13 </tbody>
14 </table>
15 </div>
16 <script>
17 var testBubble = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an unscrollable direction.")
18 testBubble.step(function() {
19 if (!window.eventSender)
20 return;
21 var td = document.getElementById("td");
22 // Start a downward middle-click-autoscroll in the left td element.
23 var startx = td.getBoundingClientRect().left + 100;
24 var starty = td.getBoundingClientRect().top + 100;
25 var endx = startx;
26 var endy = starty + 100;
27 eventSender.mouseMoveTo(startx, starty);
28 eventSender.mouseDown(1);
29 eventSender.mouseMoveTo(endx, endy)
30
31 var animationFrameCount = 0;
32 var animation = function () {
33 animationFrameCount++;
34 if (animationFrameCount == 160) {
35 testIFrame();
36 testBubble.done();
37 return;
38 }
39 if (animationFrameCount == 60) {
40 var div = document.getElementById("div");
41 assert_not_equals(window.scrollX, 0);
42 assert_equals(div.scrollLeft, 0);
43 eventSender.mouseUp(1);
44 }
45 if (animationFrameCount == 30) {
bokan 2016/11/11 19:48:45 Why do these constants have to be so high? Shouldn
46 assert_not_equals(window.scrollY, 0);
47 // Change the direction of the middle-click-autoscroll to rightward.
48 endx = startx + 100;
49 endy = starty;
50 eventSender.mouseMoveTo(endx, endy)
51 }
52 window.requestAnimationFrame(animation);
53 };
54 window.requestAnimationFrame(animation);
55 });
56
57 function testIFrame() {
58 var testIFrame = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an iframe, and the latching is correctly implemented.")
59 testIFrame.step(function() {
60 if (!window.eventSender)
61 return;
62 var iframe = document.getElementById("iframe");
63 // Start a rightward middle-click-autoscroll in the iframe inside the right
64 // td element.
65 var startx = Math.max(iframe.getBoundingClientRect().left, 10);
66 var starty = Math.max(iframe.getBoundingClientRect().top, 500);
67 var endx = startx + 100;
68 var endy = starty;
69 var pageScrollTop = window.scrollY;
70 eventSender.mouseMoveTo(startx, starty);
71 eventSender.mouseDown(1);
72 eventSender.mouseMoveTo(endx, endy);
73
74 var animationFrameCount = 0;
75 var animation = function () {
76 animationFrameCount++;
77 if (animationFrameCount == 30) {
78 var div = document.getElementById("div");
79 assert_not_equals(div.scrollLeft, 0);
80 // Change the direction of the middle-click-autoscroll to upward.
81 endx = startx;
82 endy = starty - 100;
83 eventSender.mouseMoveTo(endx, endy);
84 }
85 if (animationFrameCount == 60) {
86 assert_equals(window.scrollY, pageScrollTop);
87 testIFrame.done();
88 return;
89 }
90 window.requestAnimationFrame(animation);
91 };
92 window.requestAnimationFrame(animation);
93 });
94 }
95 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698