<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
<style>
    #base {
        width: 300px;
        height: 100px;
    }

    #border {
        border: 10px solid #999;
        width: 300px;
        height: 100px;
    }

    #margin {
        margin: 10px;
        width: 300px;
        height: 100px;
    }

    #transform {
        -webkit-transform: translateX(50px) rotate(45deg);
        width: 100px;
        height: 100px;
    }

    #columns {
        -webkit-column-count: 3;
        width: 300px;
    }

    #inline {
        display: inline;
    }

    #outer {
        width: 100px;
        height: 100px;
    }

    #inner {
        width: 200px;
        height: 200px;
    }

    table {
        width: 300px;
    }

    img {
        width: 100px;
        height: 100px;
    }

    .testBox {
        background-color: green;
    }

    #testArea {
        width: 300px;
    }

    .bbox {
        position:absolute;
        outline: 5px solid rgba(255, 0, 0, .75);
    }

    #console {
        position:absolute;
        left: 500px;
    }
</style>

<div id="console"></div>
<div id="testArea">

<p>1. Base</p>                  <div id="base" class="testBox"></div>
<p>2. Border</p>                <div id="border" class="testBox"></div>
<p>3. Margin</p>                <div id="margin" class="testBox"></div>
<p>4. Transform</p>             <div id="transform" class="testBox"></div>
<p>5. Column</p>                <div id="columns" class="testBox">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<p>6. In a column</p>           <div id="columns">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<span id="in-columns" class="testBox knownFailure">In columns</span> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<p>7. Inline</p>                <div id="inline" class="testBox">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<p>8. Table</p>                 <table class="testBox"><tr><td>table data</td><td>table data</td></tr><tr><td>table data</td><td>table data</td></tr></table>
<p>9. Table with Caption</p>    <table class="testBox"><caption>caption</caption><tr><td>table data</td><td>table data</td></tr><tr><td>table data</td><td>table data</td></tr></table>
<p>10. Table Row</p>            <table><tr class="testBox"><td>table data</td><td>table data</td></tr><tr><td>table data</td><td>table data</td></tr></table>
<p>11. Table Cell</p>           <table><tr><td class="testBox">table data</td><td>table data</td></tr><tr><td>table data</td><td>table data</td></tr></table>
<p>12. Big block in little</p>  <div id="outer" class="testBox"><div id="inner"></div></div>
<p>13. Replaced in inline</p>   <span class="testBox">Lorem<img>ipsum</span>
<p>14. Block in inline</p>      <span class="testBox">Lorem<div id="inner"></div>ipsum</span>
<p>15. Float in inline</p>      <span class="testBox"><img style="float:right"></span>

</div>

<script>
    if (window.layoutTestController)
        layoutTestController.dumpAsText();

    var testRect;
    function testClientRect(toTest, expectedRect)
    {
        testRect = toTest;
        
        debug("testRect.top " + testRect.top);
        debug("testRect.left " + testRect.left);
        debug("testRect.width " + testRect.width);
        debug("testRect.height " + testRect.height);
        debug("testRect.bottom " + testRect.bottom);
        debug("testRect.right " + testRect.right);
        debug("");

        shouldBe("testRect.top", String(expectedRect.top));
        shouldBe("testRect.left", String(expectedRect.left));
        shouldBe("testRect.width", String(expectedRect.width));
        shouldBe("testRect.height", String(expectedRect.height));
        shouldBe("testRect.bottom", "testRect.top + testRect.height");
        shouldBe("testRect.right", "testRect.left + testRect.width");
        debug("");
    }

    function addBBoxOverClientRect(rect)
    {
        var bbox = document.createElement('div');
        bbox.className = "bbox";
        var style = "";
        style += "left: "   + rect.left + "px;";
        style += "top: "    + rect.top + "px;";
        style += "width: "  + (rect.right - rect.left) + "px;";
        style += "height: " + (rect.bottom - rect.top) + "px;";
        bbox.setAttribute("style", style);
        document.documentElement.appendChild(bbox);
    }

    var fail = undefined;

    var expectedResults = [
        /*1*/  { top: 42, left: 8, width: 300, height: 100 },
        /*2*/  { top: 192, left: 8, width: 320, height: 120 },
        /*3*/  { top: 362, left: 18, width: 300, height: 100 },
        /*4*/  { top: 491, left: 37, width: 142, height: 142 },
        /*5*/  { top: 662, left: 8, width: 300, height: 234 },
        /*6*/  { top: fail, left: fail, width: fail, height: fail },
        /*7*/  { top: 1230, left: 8, width: 299, height: 180 },
        /*8*/  { top: 1460, left: 8, width: 300, height: 46 },
        /*9*/  { top: 1556, left: 8, width: 300, height: 64 },
        /*10*/ { top: 1672, left: 8, width: 300, height: 20 },
        /*11*/ { top: 1768, left: 10, width: 147, height: 20 },
        /*12*/ { top: 1862, left: 8, width: 100, height: 100 },
        /*13*/ { top: 2098, left: 8, width: 180, height: 18 },
        /*14*/ { top: 2166, left: 8, width: 200, height: 236 },
        /*15*/ { top: 2452, left: 8, width: 0, height: 0 }
    ];

    function test(number, element)
    {
        debug("Client bounding rect for #" + number);

        if (element.className.match("knownFailure")) {
            debug("Known failure. Skipping.");
            debug("");
            return;
        }

        var boundingRect = element.getBoundingClientRect();
        addBBoxOverClientRect(boundingRect);
        testClientRect(boundingRect, expectedResults[number - 1]);
    }

    var tests = document.getElementsByClassName("testBox");
    for (var i = 0; i < tests.length; ++i)
        test(i + 1, tests[i]);

    if (window.layoutTestController) {
        var area = document.getElementById('testArea');
        area.parentNode.removeChild(area);
    }

    successfullyParsed = true;
</script>
<script src="../js/resources/js-test-post.js"></script>
