9 border:
1px solid black;
18 background-color: gray;
25 background-color: green;
45 background-color: black;
51 if (window
.testRunner
) {
52 testRunner
.waitUntilDone();
53 testRunner
.dumpAsText();
56 // We always want to print the iframe output last, and then let the
57 // testRunner know we're done.
58 var shouldFinishTest
= false;
59 var iframeOutput
= '';
61 function receiveIframeOutput(e
)
63 if (window
.testRunner
) {
64 if (shouldFinishTest
) {
65 var pre
= document
.getElementById('console');
66 var text
= document
.createTextNode(e
.data
+ '\n');
67 pre
.appendChild(text
);
69 testRunner
.notifyDone();
71 iframeOutput
= e
.data
;
72 shouldFinishTest
= true;
79 var pre
= document
.getElementById('console');
80 var testDescription
= 'This test ensures that Layer::scrollsWithRespectTo ' +
81 'always returns the correct answer on relatively ' +
82 '"basic" elements as well as fixed- and absolute-' +
83 'positioned elements (ie, those with non-obvious ' +
84 'containing blocks), and iframes.\n\n';
85 var text
= document
.createTextNode(testDescription
);
86 pre
.appendChild(text
);
91 var divs
= ['predecessor', 'container', 'scrolled1', 'scrolled2', 'scrolled3', 'fixed-descendant', 'successor', 'root', 'descendant'];
92 for (var i
= 0; i
< divs
.length
; i
++) {
93 var div1
= document
.getElementById(divs
[i
]);
94 for (var j
= 0; j
< divs
.length
; j
++) {
95 var div2
= document
.getElementById(divs
[j
]);
96 var scrollsWithRespectTo
= window
.internals
.scrollsWithRespectTo(div1
, div2
);
98 var successText
= scrollsWithRespectTo
? 'scrolls with respect to' : 'does not scroll with respect to';
99 var messageText
= div1
.id
+ ' ' + successText
+ ' ' + div2
.id
;
100 text
= document
.createTextNode(messageText
+ '\n');
101 pre
.appendChild(text
);
105 if (window
.testRunner
) {
106 if (shouldFinishTest
) {
107 text
= document
.createTextNode(iframeOutput
+ '\n');
108 pre
.appendChild(text
);
110 testRunner
.notifyDone();
113 shouldFinishTest
= true;
117 window
.onload
= doTest
;
118 window
.onmessage
= receiveIframeOutput
;
123 <div class='positioned' id='predecessor'
></div>
124 <div class='container' id='container'
>
125 <div class='scrolled' id='scrolled1'
>
126 <div id='descendant' class='descendant'
></div>
128 <div class='scrolled' style='z-index:
2;' id='scrolled2'
>
129 <div class='descendant'
></div>
130 <div class='descendant' style='position:fixed' id='fixed-descendant'
></div>
132 <div class='scrolled' style='background-color: blue; position: absolute' id='scrolled3'
>
133 <div class='descendant'
></div>
136 <iframe id='inner-iframe' src='resources/scrolls-with-respect-to-iframe.html' style='width:
500px; height:
500px; position: relative; top:
500px;'
></iframe>
137 <div class='positioned' id='successor'
></div>
138 <pre id='console'
></pre>