[JSC] Int52Rep(DoubleRepAnyIntUse) should not call operation function
[WebKit-https.git] / LayoutTests / accessibility / scroll-to-make-visible-nested-2.html
1 <!DOCTYPE html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 </head>
5 <body>
6
7 <p id="description"></p>
8
9 <div id="container" style="width: 100px; overflow: scroll">
10   <div style="border: 1px solid #000; width: 1000px; height: 5000px;">5000-pixel box</div>
11   <button id="target1">Target</button>
12   <button id="target2">Target</button>
13   <button id="target3">Target</button>
14   <div style="border: 1px solid #000; width: 1000px; height: 5000px;">5000-pixel box</div>
15 </div>
16
17 <div id="console"></div>
18
19 <script>
20 description("Tests that scrolling to make an element visible works when the inner scroll container doesn't need to be scrolled, but the other one does.");
21
22 function runTest() {
23     window.container = document.getElementById("container");
24     window.target1 = document.getElementById("target1");
25     window.target2 = document.getElementById("target2");
26     window.target3 = document.getElementById("target3");
27
28     var target1AccessibleObject;
29     var target2AccessibleObject;
30     var target3AccessibleObject;
31     if (window.accessibilityController) {
32         target1.focus();
33         target1AccessibleObject = accessibilityController.focusedElement;
34         target2.focus();
35         target2AccessibleObject = accessibilityController.focusedElement;
36         target3.focus();
37         target3AccessibleObject = accessibilityController.focusedElement;
38     }
39
40     // Reset the initial scroll positions (since calling focus() can scroll the page too).
41     window.scrollTo(0, 0);
42     container.scrollTop = 0;
43     shouldBeZero("window.pageYOffset");
44     shouldBeZero("container.scrollTop");
45     shouldBeGreaterThanOrEqual("target1.getBoundingClientRect().top", "5000");
46
47     // Scroll to make the middle target visible.
48     if (window.accessibilityController)
49         target2AccessibleObject.scrollToMakeVisible();
50
51     // Instead of testing the exact scroll offsets of the two containers, just test that
52     // the new absolute position of the target is on-screen.
53     shouldBeGreaterThanOrEqual("window.innerHeight", "target2.getBoundingClientRect().bottom");
54
55     // Make sure that calling scrollToMakeVisible on target1 and target3 don't result in any
56     // scrolling, because they should already be within the viewport.
57     window.target2top = target2.getBoundingClientRect().top;
58     if (window.accessibilityController)
59         target1AccessibleObject.scrollToMakeVisible();
60     shouldBe("target2top", "target2.getBoundingClientRect().top");
61     if (window.accessibilityController)
62         target3AccessibleObject.scrollToMakeVisible();
63     shouldBe("target2top", "target2.getBoundingClientRect().top");
64
65     finishJSTest();
66 }
67
68 runTest();
69
70 </script>
71
72 </body>
73 </html>