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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/panScroll-click-hyperlink.html

Issue 2289213002: Implement Middle Click Autoscroll on all platforms not just Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into panscroll Created 4 years, 3 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
(Empty)
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script>
5 window.jsTestIsAsync = true;
6 if (window.testRunner)
7 testRunner.waitUntilDone()
8
9 var LeftMouseButton = 0;
10 var MiddleMouseButton = 1;
11
12 var testContainer;
13 var didClickLink1 = false;
14
15 window.onload = function()
16 {
17 testContainer = document.getElementById("test-container");
18 if (window.testRunner)
19 document.body.removeChild(document.getElementById("manual-instructions") );
20 runTest();
21 }
22
23 function checkIfClickedLink1AndFinish()
24 {
25 if (didClickLink1)
26 testFailed("Link 1 was clicked, but shouldn't have been.");
27 else
28 testPassed("Link 1 wasn't clicked.");
29 finished();
30 }
31
32 function runTest()
33 {
34 if (!window.eventSender)
35 return;
36
37 eventSender.mouseMoveTo(testContainer.offsetLeft + 10, testContainer.offsetT op + 10);
38 eventSender.mouseDown(MiddleMouseButton);
39 eventSender.mouseUp(MiddleMouseButton);
40 eventSender.mouseMoveTo(testContainer.offsetLeft + 10, testContainer.offsetT op + testContainer.offsetHeight);
41 setTimeout(clickHyperlinksIfScrolledToBottomOtherwiseFail, 500); // 500ms sh ould be reasonable to scroll to the bottom of the <div>.
42 }
43
44 function finished()
45 {
46 document.body.removeChild(document.getElementById("test-container"));
47 finishJSTest();
48 }
49
50 function clickHyperlinksIfScrolledToBottomOtherwiseFail()
51 {
52 var didScrollToBottom = testContainer.scrollTop === testContainer.scrollHeig ht - testContainer.clientHeight;
53 if (!didScrollToBottom) {
54 testFailed("either pan scrolling is disabled or this platform doesn't su pport pan scrolling.");
55 finished();
56 return;
57 }
58
59 if (!window.eventSender)
60 return;
61
62 var firstLinkBoundingBox = document.getElementById("firstLink").getBoundingC lientRect();
63 var secondLinkBoundingBox = document.getElementById("secondLink").getBoundin gClientRect();
64 eventSender.mouseMoveTo(firstLinkBoundingBox.left + 10, firstLinkBoundingBox .top);
65 eventSender.mouseDown(LeftMouseButton);
66 eventSender.mouseUp(LeftMouseButton);
67 eventSender.leapForward(100);
68 eventSender.mouseMoveTo(secondLinkBoundingBox.left + 10, secondLinkBoundingB ox.top);
69 eventSender.mouseDown(LeftMouseButton);
70 eventSender.mouseUp(LeftMouseButton);
71 }
72 </script>
73 </head>
74 <body>
75 <p id="description"></p>
76 <ol id="manual-instructions">
77 <li>Middle-click inside the &lt;div&gt; with the red border below.</li>
78 <li>Move the mouse such that you scroll the &lt;div&gt; until you see the hy perlinks &quot;Link 1&quot; and &quot;Link 2&quot;.</li>
79 <li>Left-click the hyperlink &quot;Link 1&quot;.</li>
80 <li>Left-click the hyperlink &quot;Link 2&quot;.</li>
81 </ol>
82 <div id="test-container" style="width:500px; height:100px; overflow:auto; border :2px solid red; padding:0px">
83 <div id="dummy" style="height:200px"><!-- dummy element to overflow test-con tainer --></div>
84 <a id="firstLink" href="#" onclick="didClickLink1=true">Link 1</a> <a id="se condLink" href="#" onclick="checkIfClickedLink1AndFinish()">Link 2</a>
85 </div>
86 <div id="console"></div>
87 <script>
88 description("This test can be used to verify that clicking on a hyperlink is ignored when in pan scroll mode. <br/>" +
89 "Note, this test is expected to fail on the Apple Mac and Chromi um Mac port since they don't support pan scrolling.");
90 </script>
91 </body>
92 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698