Index: third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/KeyframeEffect/iterationComposite.html |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/KeyframeEffect/iterationComposite.html b/third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/KeyframeEffect/iterationComposite.html |
index 743d1088783eab15003c1ce27fb4d6a9dc7d6ae4..eb5c032941b0846861dc395f06a7fad77f3497ea 100644 |
--- a/third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/KeyframeEffect/iterationComposite.html |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/KeyframeEffect/iterationComposite.html |
@@ -12,6 +12,26 @@ |
test(function(t) { |
var div = createDiv(t); |
var anim = |
+ div.animate({ alignContent: ['flex-start', 'flex-end'] }, |
+ { duration: 100 * MS_PER_SEC, |
+ easing: 'linear', |
+ iterations: 10, |
+ iterationComposite: 'accumulate' }); |
+ |
+ anim.currentTime = anim.effect.timing.duration / 2; |
+ assert_equals(getComputedStyle(div).alignContent, 'flex-end', |
+ 'Animated align-content style at 50s of the first iteration'); |
+ anim.currentTime = anim.effect.timing.duration * 2; |
+ assert_equals(getComputedStyle(div).alignContent, 'flex-start', |
+ 'Animated align-content style at 0s of the third iteration'); |
+ anim.currentTime += anim.effect.timing.duration / 2; |
+ assert_equals(getComputedStyle(div).alignContent, 'flex-end', |
+ 'Animated align-content style at 50s of the third iteration'); |
+}, 'iterationComposite of discrete type animation (align-content)'); |
+ |
+test(function(t) { |
+ var div = createDiv(t); |
+ var anim = |
div.animate({ marginLeft: ['0px', '10px'] }, |
{ duration: 100 * MS_PER_SEC, |
easing: 'linear', |
@@ -541,9 +561,35 @@ test(function(t) { |
test(function(t) { |
var div = createDiv(t); |
- // The transform list whose order is mismatched is compounded, |
- // so below animation is the same as; |
- // from matrix(2, 0, 0, 2, 0, 0) to matrix(3, 0, 0, 3, 30, 0) |
+ var anim = |
+ div.animate({ transform: ['matrix(2, 0, 0, 2, 0, 0)', |
+ 'matrix(3, 0, 0, 3, 30, 0)'] }, |
+ { duration: 100 * MS_PER_SEC, |
+ easing: 'linear', |
+ iterations: 10, |
+ iterationComposite: 'accumulate' }); |
+ anim.pause(); |
+ |
+ anim.currentTime = anim.effect.timing.duration / 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ 'matrix(2.5, 0, 0, 2.5, 15, 0)', |
+ 'Animated transform of matrix function at 50s of the first iteration'); |
+ anim.currentTime = anim.effect.timing.duration * 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ // scale(2) + (scale(3-1)*2) + translateX(30px)*2 |
+ 'matrix(6, 0, 0, 6, 60, 0)', |
+ 'Animated transform of matrix function at 0s of the third iteration'); |
+ anim.currentTime += anim.effect.timing.duration / 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ // from: matrix(6, 0, 0, 6, 60, 0) |
+ // to: matrix(7, 0, 0, 7, 90, 0) |
+ // = scale(3) + (scale(3-1)*2) + translateX(30px)*3 |
+ 'matrix(6.5, 0, 0, 6.5, 75, 0)', |
+ 'Animated transform of matrix function at 50s of the third iteration'); |
+}, 'iterationComposite of transform of matrix function'); |
+ |
+test(function(t) { |
+ var div = createDiv(t); |
var anim = |
div.animate({ transform: ['translateX(0px) scale(2)', |
'scale(3) translateX(10px)'] }, |
@@ -555,25 +601,29 @@ test(function(t) { |
anim.currentTime = anim.effect.timing.duration / 2; |
assert_equals(getComputedStyle(div).transform, |
- 'matrix(2.5, 0, 0, 2.5, 15, 0)', // scale(2.5) (0px + 30px*2) / 2 |
+ // Interpolate between matrix(2, 0, 0, 2, 0, 0) = translateX(0px) scale(2) |
+ // and matrix(3, 0, 0, 3, 30, 0) = scale(3) translateX(10px) |
+ 'matrix(2.5, 0, 0, 2.5, 15, 0)', |
'Animated transform list at 50s of the first iteration'); |
anim.currentTime = anim.effect.timing.duration * 2; |
assert_equals(getComputedStyle(div).transform, |
- 'matrix(4, 0, 0, 4, 60, 0)', // scale(2+(3-2)*2) (0px + 30px*2) |
+ // 'from' and 'to' value are mismatched, so accumulate |
+ // matrix(2, 0, 0, 2, 0, 0) onto matrix(3, 0, 0, 3, 30, 0) * 2 |
+ // = scale(2) + (scale(3-1)*2) + translateX(30px)*2 |
+ 'matrix(6, 0, 0, 6, 60, 0)', |
'Animated transform list at 0s of the third iteration'); |
anim.currentTime += anim.effect.timing.duration / 2; |
assert_equals(getComputedStyle(div).transform, |
- 'matrix(5.5, 0, 0, 5.5, 135, 0)', // scale(4+7)/2 (60px + 210px) |
+ // Interpolate between matrix(6, 0, 0, 6, 60, 0) |
+ // and matrix(7, 0, 0, 7, 210, 0) = scale(7) translate(30px) |
+ 'matrix(6.5, 0, 0, 6.5, 135, 0)', |
'Animated transform list at 50s of the third iteration'); |
}, 'iterationComposite of transform list animation whose order is mismatched'); |
test(function(t) { |
var div = createDiv(t); |
// Even if each transform list does not have functions which exist in |
- // other pair of the list, we don't fill any missing functions at all, |
- // it's just computed as compounded matrices |
- // Below animation is the same as; |
- // from matrix(1, 0, 0, 1, 0, 0) to matrix(2, 0, 0, 2, 20, 0) |
+ // other pair of the list, we don't fill any missing functions at all. |
var anim = |
div.animate({ transform: ['translateX(0px)', |
'scale(2) translateX(10px)'] }, |
@@ -585,17 +635,110 @@ test(function(t) { |
anim.currentTime = anim.effect.timing.duration / 2; |
assert_equals(getComputedStyle(div).transform, |
- 'matrix(1.5, 0, 0, 1.5, 10, 0)', // scale(1.5) (0px + 10px*2) / 2 |
+ // Interpolate between matrix(1, 0, 0, 1, 0, 0) = translateX(0px) |
+ // and matrix(2, 0, 0, 2, 20, 0) = scale(2) translateX(10px) |
+ 'matrix(1.5, 0, 0, 1.5, 10, 0)', |
'Animated transform list at 50s of the first iteration'); |
anim.currentTime = anim.effect.timing.duration * 2; |
assert_equals(getComputedStyle(div).transform, |
- 'matrix(3, 0, 0, 3, 40, 0)', // scale(1+(2-1)*2) (0px + 20px*2) |
+ // 'from' and 'to' value are mismatched, so accumulate |
+ // matrix(1, 0, 0, 1, 0, 0) onto matrix(2, 0, 0, 2, 20, 0) * 2 |
+ // = scale(1) + (scale(2-1)*2) + translateX(20px)*2 |
+ 'matrix(3, 0, 0, 3, 40, 0)', |
'Animated transform list at 0s of the third iteration'); |
anim.currentTime += anim.effect.timing.duration / 2; |
assert_equals(getComputedStyle(div).transform, |
- 'matrix(3.5, 0, 0, 3.5, 80, 0)', // scale(3+4)/2 (40px + 20px) |
+ // Interpolate between matrix(3, 0, 0, 3, 40, 0) |
+ // and matrix(4, 0, 0, 4, 120, 0) = |
+ // scale(2 + (2-1)*2) translate(10px * 3) |
+ 'matrix(3.5, 0, 0, 3.5, 80, 0)', |
'Animated transform list at 50s of the third iteration'); |
-}, 'iterationComposite of transform list animation whose order is mismatched'); |
+}, 'iterationComposite of transform list animation whose order is mismatched ' + |
+ 'because of missing functions'); |
+ |
+test(function(t) { |
+ var div = createDiv(t); |
+ var anim = |
+ div.animate({ transform: ['none', |
+ 'translateX(10px)'] }, |
+ { duration: 100 * MS_PER_SEC, |
+ easing: 'linear', |
+ iterations: 10, |
+ iterationComposite: 'accumulate' }); |
+ anim.pause(); |
+ |
+ anim.currentTime = anim.effect.timing.duration / 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ 'matrix(1, 0, 0, 1, 5, 0)', // (0px + 10px) / 2 |
+ 'Animated transform list at 50s of the first iteration'); |
+ anim.currentTime = anim.effect.timing.duration * 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ 'matrix(1, 0, 0, 1, 0, 0)', // 'none' overrides any transforms. |
+ 'Animated transform list at 0s of the third iteration'); |
+ anim.currentTime += anim.effect.timing.duration / 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ 'matrix(1, 0, 0, 1, 15, 0)', // (0px + 10px*2)/2 |
+ 'Animated transform list at 50s of the third iteration'); |
+}, 'iterationComposite of transform from none to translate'); |
+ |
+test(function(t) { |
+ var div = createDiv(t); |
+ var anim = |
+ div.animate({ transform: ['matrix3d(1, 0, 0, 0, ' + |
+ '0, 1, 0, 0, ' + |
+ '0, 0, 1, 0, ' + |
+ '0, 0, 30, 1)', |
+ 'matrix3d(1, 0, 0, 0, ' + |
+ '0, 1, 0, 0, ' + |
+ '0, 0, 1, 0, ' + |
+ '0, 0, 50, 1)'] }, |
+ { duration: 100 * MS_PER_SEC, |
+ easing: 'linear', |
+ iterations: 10, |
+ iterationComposite: 'accumulate' }); |
+ anim.pause(); |
+ |
+ anim.currentTime = anim.effect.timing.duration / 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 40, 1)', |
+ 'Animated transform of matrix3d function at 50s of the first iteration'); |
+ anim.currentTime = anim.effect.timing.duration * 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ // translateZ(30px) + (translateZ(50px)*2) |
+ 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 130, 1)', |
+ 'Animated transform of matrix3d function at 0s of the third iteration'); |
+ anim.currentTime += anim.effect.timing.duration / 2; |
+ assert_equals(getComputedStyle(div).transform, |
+ // from: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 130, 1) |
+ // to: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 150, 1) |
+ 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 140, 1)', |
+ 'Animated transform of matrix3d function at 50s of the third iteration'); |
+}, 'iterationComposite of transform of matrix3d function'); |
+ |
+test(function(t) { |
+ var div = createDiv(t); |
+ var anim = |
+ div.animate({ transform: ['rotate3d(1, 1, 0, 0deg)', |
+ 'rotate3d(1, 1, 0, 90deg)'] }, |
+ { duration: 100 * MS_PER_SEC, |
+ easing: 'linear', |
+ iterations: 10, |
+ iterationComposite: 'accumulate' }); |
+ anim.pause(); |
+ |
+ anim.currentTime = 0; |
+ assert_equals(getComputedStyle(div).transform, |
+ 'matrix(1, 0, 0, 1, 0, 0)', // Actually not rotated at all. |
+ 'Animated transform of rotate3d function at 50s of the first iteration'); |
+ anim.currentTime = anim.effect.timing.duration * 2; |
+ assert_matrix_equals(getComputedStyle(div).transform, |
+ rotate3dToMatrix3d(1, 1, 0, Math.PI), // 180deg |
+ 'Animated transform of rotate3d function at 0s of the third iteration'); |
+ anim.currentTime += anim.effect.timing.duration / 2; |
+ assert_matrix_equals(getComputedStyle(div).transform, |
+ rotate3dToMatrix3d(1, 1, 0, 225 * Math.PI / 180), //((270 + 180) * 0.5)deg |
+ 'Animated transform of rotate3d function at 50s of the third iteration'); |
+}, 'iterationComposite of transform of rotate3d function'); |
test(function(t) { |
var div = createDiv(t); |