chromium/third_party/blink/web_tests/svg/custom/boundingBox.html

<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
    testRunner.dumpAsText()

function runTest()
{
    var target = document.getElementById("target");
    if (window.internals) {
        var boundingBox = internals.boundingBox(target);
        var boundingClientRect = target.getBoundingClientRect();
        var rectsAreEqual = (boundingBox.width === boundingClientRect.width
            && boundingBox.height === boundingClientRect.height
            && boundingBox.left === boundingClientRect.left
            && boundingBox.top === boundingClientRect.top);

        document.getElementById("result").innerHTML = rectsAreEqual ? "PASS" : "FAIL: boundingBox: " + boundingBox.width + " x " + boundingBox.height + " @ (" + boundingBox.left + ", " + boundingBox.top + "), boundingClientRect: "
            + boundingClientRect.width + " x " + boundingClientRect.height + " @ (" + boundingClientRect.left + ", " + boundingClientRect.top + ")";
    }
}
</script>
</head>
<body onload="runTest()">
<div style="height: 200px;"></div>
<svg width=400 height=400>
    <image width=200 height=200 x=50 y=50 id="target" />
</svg>
<p>
    Test that -[DOMNode boundingBox] returns reasonable results for SVG elements.
</p>
<p id="result">This test can only be run in DumpRenderTree.</p>
</body>
</html>