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

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

Issue 2484563003: Determine the layoutobject of middleClickAutoscroll by the scroll direction. (Closed)
Patch Set: Better tests. 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/resources/middleClickAutoscroll-iframe.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 div = document.getElementById("div");
22 var td = document.getElementById("td");
23 // Start a downward middle-click-autoscroll in the left td element.
24 var startx = td.getBoundingClientRect().left + 100;
25 var starty = td.getBoundingClientRect().top + 100;
26 var endx = startx;
27 var endy = starty + 100;
28 var scrolledY = false;
29 eventSender.mouseMoveTo(startx, starty);
30 eventSender.mouseDown(1);
31 eventSender.mouseMoveTo(endx, endy);
32
33 window.onscroll = function() {
34 if (!scrolledY) {
35 assert_not_equals(window.scrollY, 0);
36 scrolledY = true;
37 // Change the direction of the middle-click-autoscroll to rightward.
38 endx = startx + 100;
39 endy = starty;
40 eventSender.mouseMoveTo(endx, endy);
41 } else {
42 if (window.scrollX != 0) {
43 assert_equals(div.scrollLeft, 0);
44 eventSender.mouseUp(1);
45 testBubble.done();
46 testIFrame();
47 }
48 }
49 };
50 });
51
52 function testIFrame() {
53 var testIFrame = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an iframe, and the latching is correctly implemented.")
54 testIFrame.step(function() {
55 if (!window.eventSender)
56 return;
57 var iframe = document.getElementById("iframe");
58 var div = document.getElementById("div");
59 // Start a rightward middle-click-autoscroll in the iframe inside the right
60 // td element.
61 var startx = Math.max(iframe.getBoundingClientRect().left, 10);
62 var starty = Math.max(iframe.getBoundingClientRect().top, 500);
63 var endx = startx + 100;
64 var endy = starty;
65 var pageScrollTop = window.scrollY;
66 eventSender.mouseMoveTo(startx, starty);
67 eventSender.mouseDown(1);
68 eventSender.mouseMoveTo(endx, endy);
69
70 div.onscroll = function() {
71 assert_not_equals(div.scrollLeft, 0);
72 eventSender.mouseUp(1);
73 testIFrame.done();
74 };
75 });
76 }
77 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/resources/middleClickAutoscroll-iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698