Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / scroll-to-make-visible-div-overflow.html
blob5d1c91a84472b7c4fecb443140ea1a62917baad7
1 <html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 </head>
5 <body>
7 <p id="description"></p>
9 <div id="container" style="height: 100px; overflow: scroll">
10 <button id="upper_target">Upper Target</button>
11 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
12 <button id="lower_target">Lower Target</button>
13 </div>
15 <div id="console"></div>
17 <script>
18 description("Tests that scrolling to make an element visible successfully scrolls an arbitrary HTML element that has CSS overflow set to 'scroll'.");
20 function runTest() {
21 window.container = document.getElementById("container");
22 var upperTarget = document.getElementById("upper_target");
23 var lowerTarget = document.getElementById("lower_target");
25 if (window.accessibilityController) {
26 lowerTarget.focus();
27 var lowerTargetAccessibleObject = accessibilityController.focusedElement;
28 upperTarget.focus();
29 var upperTargetAccessibleObject = accessibilityController.focusedElement;
32 // Reset the initial scroll position (since calling focus() can scroll the page too).
33 container.scrollTop = 0;
34 shouldBe("container.scrollTop", "0");
36 // Scroll to make lower target visible and check.
37 if (window.accessibilityController)
38 lowerTargetAccessibleObject.scrollToMakeVisible();
39 var top = lowerTarget.offsetTop - container.offsetTop;
40 window.minYOffset = top + lowerTarget.offsetHeight - container.offsetHeight;
41 window.maxYOffset = top;
42 shouldBe("container.scrollTop >= minYOffset", "true");
43 shouldBe("container.scrollTop <= maxYOffset", "true");
45 // Do it again. It shouldn't scroll.
46 if (window.accessibilityController)
47 lowerTargetAccessibleObject.scrollToMakeVisible();
48 var top = lowerTarget.offsetTop - container.offsetTop;
49 window.minYOffset = top + lowerTarget.offsetHeight - container.offsetHeight;
50 window.maxYOffset = top;
51 shouldBe("container.scrollTop >= minYOffset", "true");
52 shouldBe("container.scrollTop <= maxYOffset", "true");
54 // Scroll to make upper target visible and check.
55 if (window.accessibilityController)
56 upperTargetAccessibleObject.scrollToMakeVisible();
57 top = upperTarget.offsetTop - container.offsetTop;
58 window.minYOffset = top + upperTarget.offsetHeight - container.offsetHeight;
59 window.maxYOffset = top;
60 shouldBe("container.scrollTop >= minYOffset", "true");
61 shouldBe("container.scrollTop <= maxYOffset", "true");
63 finishJSTest();
66 runTest();
68 </script>
70 </body>
71 </html>