blob: 63f1410ba91db68cbd8ca3cfddda71940486b53d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>This tests that offset* and client* can return fractional values.</title>
<style>
div {
position: fixed;
border-style: solid;
border-color: red;
}
</style>
</head>
<body>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var container = document.body;
w = 0;
h = 0;
adjustment = 0.1;
for (i = 0; i < 20; ++i) {
adjustment+=0.1;
for (j = 0; j < 20; ++j) {
var e = document.createElement("div");
e.style.top = (w * i + j * adjustment) + "px";
e.style.left = (w * j + i * adjustment) + "px";
e.style.width = w + "px";
e.style.height = h + "px";
e.style.borderWidth = adjustment/4 + "px";
container.appendChild(e);
w+=0.1;
h+=0.1;
}
}
var result = "";
var divs = document.getElementsByTagName("div");
for (i = 0; i < divs.length; ++i) {
var element = divs[i];
result+="offsetTop:" + element.offsetTop.toFixed(2) + " offsetLeft:" + element.offsetLeft.toFixed(2) + " offsetWidth:" + element.offsetWidth.toFixed(2) + " offsetHeight:" + element.offsetHeight.toFixed(2) + "</br> clientTop:" + element.clientTop.toFixed(2) + " clientLeft:" + element.clientLeft.toFixed(2) + " clientWidth:" + element.clientWidth.toFixed(2) + " clientHeight:" + element.clientHeight.toFixed(2) + "</br>";
}
document.body.innerHTML = result;
</script>
</body>
</html>