Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / block / positioning / offsetLeft-relative-iframe.html
blobde69742dbe216ff3402321a4f38bb0160823eedf
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5 if (window.testRunner)
6 testRunner.dumpAsText();
8 function log(str) {
9 var li = document.createElement("li");
10 li.appendChild(document.createTextNode(str));
11 var console = document.getElementById("console");
12 console.appendChild(li);
15 function findPosX(obj) {
16 var ret = 0;
17 do {
18 ret += obj.offsetLeft;
19 obj = obj.offsetParent;
20 } while (obj);
21 return ret;
24 function printDivPlacement() {
25 var the_node = document.getElementById('frame');
26 log("node.offsetLeft=" + the_node.offsetLeft + " (Should be 303 as in FF and IE)");
27 log("findPosX=" + findPosX(the_node) + " (Should be 303 as in FF and IE)");
29 </script>
30 </head>
31 <body onload="printDivPlacement()">
32 <div style="position:absolute; top:0px; left:0px; width:800px; background-color:#C3DCBF;">
33 <table width="200px" style="margin: auto;">
34 <tr>
35 <td>
36 <iframe id=frame style="position: relative; width:20px; height:20px"></iframe>
37 </td>
38 </tr>
39 </table>
40 </div>
41 <br><br>
42 <h3>This test verifies that offsetLeft is calculated correctly for a relatively positioned iframe element inside a table.</h3>
43 <ul id=console></ul>
44 </body>
45 </html>