blob: 2334edf28bba71577f25230ac0facaa61bcd5fc0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
* { box-sizing: border-box; }
body { margin: 0; }
span { position: absolute; top: 0; left: 0;; }
.tiny { position: absolute; top: 500px; left: 500px; width: 1px; height: 1px; background-color: blue; }
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function output(s)
{
window.log.innerText += s + "\n";
}
function runTest()
{
if (!window.internals) {
output("This test cannot be run outside of WebKitTestRunner.");
return;
}
function dumpIndicatorBoundsForElement(el)
{
var indicatorOptions = {"useBoundingRectAndPaintAllContentForComplexRanges": true};
var range = internals.rangeFromLocationAndLength(el, 0, 1);
var indicator = window.internals.textIndicatorForRange(range, indicatorOptions);
var rect = indicator.textBoundingRectInRootViewCoordinates;
output(`${el.id}: ${rect.x} ${rect.y} ${rect.width} ${rect.height}`);
}
dumpIndicatorBoundsForElement(document.getElementById("elementWithTinyChild"));
}
</script>
</head>
<body onload="runTest()">
<span id="elementWithTinyChild"><img src="../images/resources/green-256x256.jpg" width="32px" height="32px"><div class="tiny"></div></span>
<pre id="log"></pre>
</body>
</html>