blob: 51cce3ee9a4d6ccb4c62ae2780f996c208d705e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Transition Between Transform Operation Lists Which Match</title>
<style type="text/css" media="screen">
#box {
height: 100px;
width: 100px;
background-color: blue;
-webkit-transform: translateX(0px) rotate(0deg);
-webkit-transition-duration: 2s;
-webkit-transition-timing-function: linear;
-webkit-transition-property: -webkit-transform;
}
</style>
<script type="text/javascript" charset="utf-8">
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
result = "PASS";
const defaultTolerance = 10;
function isEqual(actual, desired, tolerance)
{
if (tolerance == undefined || tolerance == 0)
tolerance = defaultTolerance;
var diff = Math.abs(actual - desired);
return diff < tolerance;
}
function changeValues()
{
var box = document.getElementById('box');
box.style.webkitTransitionDuration = "0.1s";
}
function check(expected)
{
if (result != "PASS")
return;
var t = window.getComputedStyle(document.getElementById('box')).webkitTransform;
var a = t.split("(");
a = a[1].split(",");
var angle = Math.acos(a[0]) * 180 / Math.PI;
if (!isEqual(angle, expected))
result = "FAIL(was:"+t.m41+", s/b:0)";
}
function startTimeout()
{
setTimeout("check(135)", 500);
setTimeout("check(90)", 1000);
window.setTimeout(function() {
document.getElementById('result').innerHTML = result;
if (window.layoutTestController)
layoutTestController.notifyDone();
}, 1100);
}
function start()
{
var box = document.getElementById('box');
box.style.webkitTransform = 'translateX(0px) rotate(540deg)';
window.setTimeout("startTimeout()", 0);
}
window.addEventListener('load', start, false);
</script>
</head>
<body>
<p>
Box should spin 540 degrees because that is the specified rotation and the transform operation lists match,
so we should animate each operation separately.
</p>
<div id="box">
</div>
<div id="result">
</div>
</body>
</html>
|