blob: f64a0aea439a0d7db4ca312df02dd096a5abc49a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Document::nodesFromRect : inline image - bug 85849</title>
<script src="../../../resources/js-test-pre.js"></script>
<script src="resources/nodesFromRect.js"></script>
<style>
#sandbox {
position: absolute;
left: 0px;
top: 0px;
width: 400px;
height: 200px;
}
#sandbox #container { padding: 2px; padding-bottom: 10px; }
#sandbox #container span { font-size: 36px; }
#sandbox img { background-color: black; }
</style>
</head>
<body id="body">
<div id=sandbox>
<div id=container>
<span>
<img width="100" height="100"></img>
</span>
</div>
</div>
<p id="description"></p>
<span id="console"></span>
<script type="application/javascript">
function runTest()
{
description(document.title);
window.scrollTo(0, 0);
/* Point based test over the img only. */
checkRect(20, 20, 1, 1, "IMG");
/* Rect based test over the img only. */
checkRect(15, 15, 10, 10, "IMG");
/* Rect based test over the div only. */
checkRect(0, 0, 2, 2, "DIV#container");
/* Rect based test over the span only. */
checkRect(3, 103, 2, 2, "SPAN");
/* Note that for the tests below, the img bounds are considered to be (2, 2) x (100, 100). */
/* Rect based test over the entire img. */
checkRect(2, 2, 100, 100, "IMG");
/* Point based test over the img and the span. */
checkRect(2, 99, 1, 1, "IMG");
/* Rect based test over the img and the span with the img fully covering the hit region. */
checkRect(2, 98, 2, 2, "IMG");
/* Rect based test over the img and the span with the img not fully covering the hit region. */
checkRect(3, 101, 2, 5, "IMG, SPAN");
/* Rect based test over the img, span and their container. */
checkRect(3, 101, 2, 18, "IMG, SPAN, DIV#container");
/* Rect based test over just span and its container. */
checkRect(3, 103, 2, 16, "SPAN, DIV#container");
/* Rect based test over the img that is not over span with the img not fully covering the hit region. */
checkRect(1, 1, 3, 3, "IMG, DIV#container");
}
runTest();
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>