<html>
<head>
<style>
@font-face {
 font-family: "test-xheight";
 src: url(../../resources/Ahem.otf);
 font-style: normal;
 font-weight: 700;
}
.test {
    font-family:"test-xheight","helvetica","arial",sans-serif;
    height: 1ex;
}
</style>
</height>
<body onload="test()">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=39682">bug 39682</a>:
WebKit nightly adding insane height to div at random.</p>
<p id=result>Testing...</p>

<div id=test>
<div class=test style="font-size: 10px">XXXX</div>
<div class=test style="font-size: 11px">XXXX</div>
<div class=test style="font-size: 12px">XXXX</div>
<div class=test style="font-size: 13px">XXXX</div>
<div class=test style="font-size: 14px">XXXX</div>
<div class=test style="font-size: 15px">XXXX</div>
<div class=test style="font-size: 16px">XXXX</div>
<div class=test style="font-size: 17px">XXXX</div>
<div class=test style="font-size: 18px">XXXX</div>
<div class=test style="font-size: 19px">XXXX</div>
<div class=test style="font-size: 20px">XXXX</div>
<div class=test style="font-size: 21px">XXXX</div>
<div class=test style="font-size: 22px">XXXX</div>
<div class=test style="font-size: 23px">XXXX</div>
<div class=test style="font-size: 24px">XXXX</div>
</div>

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

function test()
{
    var totalHeight = document.defaultView.getComputedStyle(document.getElementById("test"), null).getPropertyCSSValue("height");
    totalHeight = totalHeight.getFloatValue(CSSPrimitiveValue.CSS_PX);
    if (totalHeight > 150 && totalHeight < 300)
        document.getElementById("result").innerHTML = "PASS";
    else
        document.getElementById("result").innerHTML = "FAIL: " + totalHeight + "px";
}
</script>
</body>
</html>
