chromium/third_party/blink/web_tests/svg/custom/object-sizing-zero-intrinsic-width-height.html

<!DOCTYPE html>
<title>SVG in &lt;object> with zero intrinsic size</title>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<object data-expected="0x0" data="data:image/svg+xml,
    <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='0' height='0'>
        <rect width='50' height='50' fill='red'/>
    </svg>"></object>
<object data-expected="50x0" data="data:image/svg+xml,
    <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='50' height='0'>
        <rect width='50' height='50' fill='red'/>
    </svg>"></object>
<object data-expected="0x50" data="data:image/svg+xml,
    <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='0' height='50'>
        <rect width='50' height='50' fill='red'/>
    </svg>"></object>
<object data-expected="0x150" data="data:image/svg+xml,
    <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='0'>
        <rect width='50' height='50' fill='red'/>
    </svg>"></object>
<object data-expected="300x0" data="data:image/svg+xml,
    <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='0'>
        <rect width='50' height='50' fill='red'/>
    </svg>"></object>
<script>
Array.prototype.forEach.call(document.querySelectorAll('object'), function(element) {
    var t = async_test(document.title + " - " + element.dataset.expected);
    element.onload = function() {
        requestAnimationFrame(t.step_func(function() {
            var clientRect = element.getBoundingClientRect();
            assert_equals(clientRect.width + "x" + clientRect.height, element.dataset.expected);
            t.done();
        }));
    }
});
</script>