87 lines
2.7 KiB
HTML
87 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
<head>
|
|
<style>
|
|
#target {
|
|
position: absolute;
|
|
left: 0px;
|
|
height: 200px;
|
|
width: 200px;
|
|
background-color: red;
|
|
-webkit-transform: translateX(100px);
|
|
-webkit-transition-property: -webkit-transform;
|
|
-webkit-transition-duration: 4s;
|
|
-webkit-transition-timing-function: linear;
|
|
}
|
|
|
|
.dot {
|
|
width: 10px;
|
|
height: 10px;
|
|
top: 100px;
|
|
background-color: yellow;
|
|
position:absolute;
|
|
}
|
|
</style>
|
|
<script src="resources/transition-test-helpers.js"></script>
|
|
<script type="text/javascript">
|
|
function checkResult(pos, isIn)
|
|
{
|
|
var elt = document.elementFromPoint(pos, 150);
|
|
var good = isIn ? "inside" : "outside";
|
|
var bad = isIn ? "outside" : "inside";
|
|
return (isIn == (elt.id == "target")) ?
|
|
"<span style='color:green'>PASS</span> - " + pos + "px was " + good + " as it should be" + "<br>" :
|
|
"<span style='color:red'>FAIL</span> - " + pos + "px was " + bad + " and should have been " + good + "<br>";
|
|
}
|
|
|
|
function checkResults()
|
|
{
|
|
// Test before (150), in (300) and after (450)
|
|
var result = "";
|
|
result += checkResult(150, false);
|
|
result += checkResult(300, true);
|
|
result += checkResult(450, false);
|
|
document.getElementById('result').innerHTML = result;
|
|
}
|
|
|
|
function doTest()
|
|
{
|
|
if (window.testRunner) {
|
|
var target = document.getElementById('target');
|
|
if (!pauseTransitionAtTimeOnElement("-webkit-transform", 2.0, target))
|
|
throw("Transition is not running");
|
|
|
|
checkResults();
|
|
testRunner.notifyDone();
|
|
}
|
|
else {
|
|
window.setTimeout("checkResults()", 2000);
|
|
}
|
|
}
|
|
|
|
function startTest()
|
|
{
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
testRunner.waitUntilDone();
|
|
}
|
|
|
|
document.getElementById("target").style.webkitTransform = "translateX(300px)";
|
|
waitForAnimationStart(doTest);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="startTest()">
|
|
<div>
|
|
This test starts a transition of the '-webkit-transform' property and then does elementFromPoint calls
|
|
at the shown yellow dots to see if hit testing works
|
|
</div>
|
|
<div id="target"></div>
|
|
<div class="dot" style="left:150px"></div>
|
|
<div class="dot" style="left:300px"></div>
|
|
<div class="dot" style="left:450px"></div>
|
|
<div id="result"></div>
|
|
</body>
|
|
</html>
|