Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / spatial-navigation / snav-fully-aligned-vertically.html
blob1f549e7bac1034e13f502c687daee292c08ee62a
1 <html>
2 <!--
3 This test ensures the correctness of the "Fully aligned" precedence
4 logic implemented by Spatial Navigation algorithm in an vertical direction:
5 targets whose middle falls between the top and bottom of the current focused
6 element are preferably to move focus to, even if it is not the shortest distance.
8 * Pre-conditions:
9 1) DRT support for SNav enable/disable.
11 * Navigation steps:
12 1) Loads this page, focus goes to "start" automatically.
13 2) Focus moves preferably to elements right up or above the
14 current focused element, even when there are some other closer
15 but not vertically aligned elements in the same direction.
16 -->
17 <head>
18 <script src="../../resources/js-test.js"></script>
19 <script src="resources/spatial-navigation-utils.js"></script>
20 <script type="application/javascript">
22 var resultMap = [
23 ["Down", "4"],
24 ["Down", "6"],
25 ["Down", "7"],
26 ["Down", "end"],
27 ["Up", "8"],
28 ["Up", "6"],
29 ["DONE", "DONE"]
32 if (window.testRunner) {
33 testRunner.dumpAsText();
34 testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
35 window.internals.settings.setSpatialNavigationEnabled(true);
36 testRunner.waitUntilDone();
39 function runTest()
41 // starting the test itself: get to a known place.
42 document.getElementById("start").focus();
44 initTest(resultMap, testCompleted);
47 function testCompleted()
49 if (window.testRunner)
50 testRunner.notifyDone();
53 window.onload = runTest;
54 </script>
55 </head>
56 <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
57 <div style="margin-left: 40px; text-align: left;">
58 <div style="margin-left: 40px;">
59 <a id="start" href="a">test<br></a>
60 </div>
61 <a id="2" href="a">test</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="3" href="a">test</a><br>
62 <div style="margin-left: 40px;">
63 <a id="4" href="a">test<br></a>
64 </div>
65 <div style="margin-left: 80px;">
66 <a id="5" href="a">test<br></a>
67 </div>
68 <div style="margin-left: 40px;">
69 <a id="6" href="a">test<br></a>
70 </div>
71 <a id="7" href="a">test<br></a>
72 <br><br><br><br>
73 <div style="margin-left: 40px;">
74 <a id="8" href="a">test<br></a>
75 </div>
76 <a id="end" href="a">test<br></a>
77 </div>
78 <div id="console"></div>
79 </body>
80 </html>