5 var horizontalOverflow = testResults[currentTest][1];
6 if (horizontalOverflow) {
7 document.getElementById('child').style.width = '200px';
9 document.getElementById('child').style.width = '50px';
12 var verticalOverflow = testResults[currentTest][2];
13 if (verticalOverflow) {
14 document.getElementById('child').style.height = '200px';
16 document.getElementById('child').style.height = '50px';
20 function finished(result)
22 document.getElementById('result').innerHTML = result;
24 if (window.testRunner)
25 testRunner.notifyDone();
29 if (currentTest == testResults.length) {
39 function overflowChanged(event) {
40 var result = [event.orient, event.horizontalOverflow, event.verticalOverflow];
42 if ('' + result == testResults[currentTest]) {
46 finished("FAILURE: expected " + testResults[currentTest] + " got " + result);
49 function forceLayout() {
50 document.body.offsetTop;
54 if (window.testRunner) {
55 testRunner.dumpAsText();
56 testRunner.waitUntilDone();
59 testResults = [[OverflowEvent.HORIZONTAL, true, false],
60 [OverflowEvent.HORIZONTAL, false, false],
61 [OverflowEvent.VERTICAL, false, true],
62 [OverflowEvent.VERTICAL, false, false],
63 [OverflowEvent.BOTH, true, true],
64 [OverflowEvent.BOTH, false, false],
65 [OverflowEvent.VERTICAL, false, true],
66 [OverflowEvent.BOTH, true, false],
67 [OverflowEvent.BOTH, false, true]];
71 var c = document.getElementById('container');
72 c.addEventListener('overflowchanged', overflowChanged, false);
77 <body onload="runTest()">
78 <div id="container" style="width:100; height:100px; border: solid red 2px; overflow: hidden">
79 <div id="child" style="margin-top: 30px; margin-left: 30px; width:50px; height:50px; border: solid blue 2px;"></div>
81 This tests that overflowchanged events are fired correctly. If the test is successful, the text "SUCCESS" should be shown below.
82 <div id="result">FAILURE</div>