chromium/third_party/blink/web_tests/fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell.html

<!DOCTYPE html>
<head>
<title>Test for embedded iframe with height: 100% and anonymous table cell parent.</title>
<script src="../../resources/js-test.js"></script>
<script>
if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}

function getComputedStyleForElement(element, cssPropertyName)
{
    if (!element) {
        return null;
    }
    if (window.getComputedStyle) {
        return window.getComputedStyle(element, '').getPropertyValue(cssPropertyName.replace(/([A-Z])/g, "-$1").toLowerCase());
    }
    if (element.currentStyle) {
        return element.currentStyle[cssPropertyName];
    }
    return null;
}

function parsePixelValue(str)
{
    if (typeof str != "string" || str.length < 3 || str.substr(str.length - 2) != "px") {
        testFailed(str + " is unparsable.");
        return -1;
    }
    return parseFloat(str);
}

function getHeight(id)
{
    return parsePixelValue(getComputedStyleForElement(document.getElementById(id), 'height'));
}

function test()
{
    description("This test checks that iframe with percentage height within anonymous table cell has the correct height (strict mode).");

    shouldBe("getHeight('iframe-100')", "window.innerHeight");

    isSuccessfullyParsed();

    if (window.testRunner) {
        testRunner.notifyDone();
    }
}
</script>
<style>
html, body {
    height: 100%;
}
</style>
</head>
<body onload="test()">
<p id="description"></p>
<div id="console"></div>

<div style="display:table; height: 100%;">
<div style="display:table-row; height: 100%;">
<iframe id="iframe-100" frameborder="0px" style="height: 100%;" src=""></iframe>
</div>
</div>
</body>
</html>