<!DOCTYPE html>
<html>
<head>
<title>Document::nodesFromRect : CSS scale transforms - bug 85792</title>
<style type="text/css">
#sandbox {
position: absolute;
left: 0px;
top: 0px;
width: 600px;
height: 600px;
}
#layer {
position: absolute;
left: 200px;
top: 200px;
width: 200px;
height: 200px;
}
.scaleup { transform: scale(2); }
.scaledown { transform: scale(0.5); }
#layer > #fleft { float: left; width: 50px; height: 200px; }
#layer > #fright { float: right; width: 50px; height: 200px; }
#layer > .hbox { height: 100px; margin-right: 50px; margin-left: 50px }
</style>
<script src="../../../resources/js-test.js"></script>
<script src="resources/nodesFromRect.js"></script>
</head>
<body>
<div id=sandbox>
<div id=layer>
<div id=fleft></div>
<div id=fright></div>
<div id=box1 class=hbox></div>
<div id=box2 class=hbox></div>
</div>
</div>
<script>
function runTest()
{
description(document.title);
var e = {};
// Set up shortcut access to elements
['sandbox', 'layer', 'fleft', 'fright', 'box1', 'box2', 'box3'].forEach(function(a) {
e[a] = document.getElementById(a);
});
window.scrollTo(0, 0);
debug('Check unscaled area-testing for sanity');
check(120, 120, 61, 61, [e.sandbox]);
check(210, 210, 21, 21, [e.fleft]);
check(360, 210, 21, 21, [e.fright]);
check(260, 210, 21, 21, [e.box1]);
check(260, 310, 21, 21, [e.box2]);
check(210, 260, 61, 61, [e.fleft, e.box2, e.box1, e.layer]);
check(180, 210, 31, 21, [e.fleft, e.layer, e.sandbox]);
check(260, 280, 21, 31, [e.box2, e.box1, e.layer]);
check(150, 210, 31, 21, [e.sandbox]);
debug('Check scaling 2X');
e['layer'].setAttribute('class', 'scaleup');
check(120, 120, 61, 61, [e.fleft]);
check(420, 120, 61, 61, [e.fright]);
check(340, 210, 21, 21, [e.box1]);
check(340, 410, 21, 21, [e.box2]);
check(120, 220, 121, 121, [e.fleft, e.box2, e.box1, e.layer]);
check(60, 120, 61, 41, [e.fleft, e.layer, e.sandbox]);
check(220, 260, 41, 61, [e.box2, e.box1, e.layer]);
check(0, 120, 61, 41, [e.sandbox]);
debug('Check scaling 0.5X');
e['layer'].setAttribute('class', 'scaledown');
check(210, 210, 31, 31, [e.sandbox]);
check(255, 255, 11, 11, [e.fleft]);
check(330, 255, 11, 11, [e.fright]);
check(280, 255, 11, 11, [e.box1]);
check(280, 305, 11, 11, [e.box2]);
check(255, 280, 31, 31, [e.fleft, e.box2, e.box1, e.layer]);
check(240, 255, 16, 11, [e.fleft, e.layer, e.sandbox]);
check(280, 290, 11, 16, [e.box2, e.box1, e.layer]);
check(225, 255, 16, 11, [e.sandbox]);
}
window.onload = runTest;
</script>
<p id='description'></p>
<span id="console"></span>
</body>
</html>