blob: dccd1b4f578a280bccce5c0e66014dcf0a8c06d7 [file] [log] [blame]
<html>
<head>
<title>Point mapping through 3D transforms with origins</title>
<script src="point-mapping-helpers.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
function test()
{
// Scroll so that frame view offsets are non-zero
// window.scrollTo(20, 100);
// document.getElementById('overflow').scrollLeft = 80;
// document.getElementById('overflow').scrollTop = 60;
// In non-test mode, show the mouse coords for testing
if (!window.testRunner)
document.body.addEventListener('mousemove', mousemoved, false);
dispatchEvent(48, 48, 'box1', 6, 6);
dispatchEvent(70, 41, 'box2', 3, 3);
dispatchEvent(185, 164, 'box2', 97, 97);
dispatchEvent(338, 64, 'box7', 3, 3);
dispatchEvent(92, 310, 'box10', 3, 3);
dispatchEvent(217, 444, 'box10', 96, 96);
dispatchEvent(337, 309, 'box13', 2, 2);
dispatchEvent(360, 334, 'box14', 2, 2);
dispatchEvent(500, 484, 'box14', 96, 96);
}
</script>
<style type="text/css" media="screen">
body {
margin: 0;
border: 1px solid black;
cursor: crosshair;
}
.test {
display: inline-block;
height: 200px;
width: 200px;
border: 1px solid black;
margin: 20px;
}
.box {
height: 100px;
width: 100px;
-webkit-box-sizing: border-box;
background-color: #DDD;
border: 1px solid black;
}
.box:hover {
outline: 3px solid orange;
}
.container {
height: 140px;
width: 140px;
margin: 20px;
border: 1px solid black;
-webkit-box-sizing: border-box;
-webkit-perspective: 400;
-webkit-perspective-origin: 20% 80%;
}
.transformed {
position: relative;
height: 100px;
width: 100px;
padding: 20px;
margin: 20px;
border: 1px solid black;
background-color: #AAA;
-webkit-box-sizing: border-box;
-webkit-transform: translateZ(100px) rotateY(-40deg);
-webkit-transform-origin: 20% 40%;
}
.layer {
padding: 20px;
background-color: #C0D69E;
}
.inner {
background-color: blue;
}
#results {
position: absolute;
left: 30px;
top: 500px;
}
#mousepos {
position: absolute;
left: 30px;
top: 700px;
color: gray;
font-size: smaller;
}
</style>
</head>
<body onclick="clicked(event)">
<div id="results"></div>
<div class="test">
<!-- Simple transformed div in perpsective -->
<div class="container box" id="box1">
<div class="transformed box" id="box2">
</div>
</div>
</div>
<div class="test">
<!-- Transformed div in perpsective with non-layer child -->
<div class="container box" id="box5">
<div class="transformed box" id="box6">
<div class="inner box" id="box7">
</div>
</div>
</div>
</div>
<br>
<div class="test">
<!-- Transformed div in perpsective with layer child -->
<div class="container box" id="box8">
<div class="transformed box" id="box9">
<div class="inner box" style="position: relative" id="box10">
</div>
</div>
</div>
</div>
<div class="test">
<!-- Transformed div in perpsective with child having layer child -->
<div class="container box" id="box11">
<div class="transformed box" id="box12">
<div class="layer box" id="box13">
<div class="inner box" style="position: relative" id="box14">
</div>
</div>
</div>
</div>
</div>
<div id="mousepos"></div>
</body>
</html>