summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-iframe-no-focusable-content.html
blob: b90e78c081978d4ba3e9a8038e7e77f1ee96e454 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<html>
  <!--
    This test ensures the basic traversal correctness of Spatial Navigation
    algorithm: iframes without any focusable content should be ignored.

    * Pre-conditions:
    1) DRT support for SNav enable/disable.

    * Navigation steps:
    1) Loads this page, focus goes to "start" automatically.
    2) Focus moves from "start" to "end" bypassing the two iframes
       in between them, once both have no focusable elements inside.
  -->
  <head>
    <script src="../../resources/js-test.js"></script>
    <script src="resources/spatial-navigation-utils.js"></script>
    <script type="application/javascript">

    var resultMap = [
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "start"],
      ["DONE", "DONE"]
    ];

    if (window.testRunner) {
      testRunner.dumpAsText();
      testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
      window.internals.settings.setSpatialNavigationEnabled(true);
      testRunner.waitUntilDone();
    }

    function runTest()
    {
      // starting the test itself: get to a known place.
      document.getElementById("start").focus();

      initTest(resultMap, testCompleted);
    }

    function testCompleted()
    {
      if (window.testRunner)
        testRunner.notifyDone();
    }

    window.onload = runTest;
    </script>
  </head>
  <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
    <div><a id="start" href="a">a</a></div>

    <iframe width="80" height="80" scrolling="auto" src="data:text/html,
      <body>
        <img width=120 height=200 src='resources/green.png'>
      </body>
    "></iframe><br>

    <iframe scrolling="auto" src="data:text/html,
      <body>
        <img width=120 height=200 src='resources/green.png'>
      </body>
    "></iframe><br>

    <a id="end" href="a">e</a>
    <div id="console"></div>
    This is to test that an iframe with no focusable content still scrolls
  </body>
</html>