Bug 1337944 part 2 - Add test of CSS Animations with SVG. r?hiro
MozReview-Commit-ID: 2vqYBWZa8xg
--- a/dom/animation/test/chrome/test_restyles.html
+++ b/dom/animation/test/chrome/test_restyles.html
@@ -16,16 +16,20 @@
@keyframes background-color {
from { background-color: red; }
to { background-color: blue; }
}
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
+@keyframes fill {
+ from { fill: red; }
+ to { fill: lime; }
+}
div {
/* Element needs geometry to be eligible for layerization */
width: 100px;
height: 100px;
background-color: white;
}
</style>
</head>
@@ -862,12 +866,53 @@ waitForAllPaints(function() {
var markers = yield observeStyling(5);
is(markers.length, 0,
'Animation running on the main-thread while computed timing is not ' +
'changed should never cause restyles');
yield ensureElementRemoval(div);
});
+ add_task(function* no_resting_while_svg_element_is_in_display_none_subtree() {
+ var div = addDiv(null);
+ var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
+ var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
+ rect.setAttribute('width', '100%');
+ rect.setAttribute('height', '100%');
+ rect.setAttribute('fill', 'blue');
+ svg.appendChild(rect);
+ div.appendChild(svg);
+
+ rect.style.animation = 'fill 1s';
+ var animation = rect.getAnimations()[0];
+ yield animation.ready;
+
+ var displayMarkers = yield observeStyling(5);
+ // FIXME: Bug 866411: SMIL animations sometimes skip restyles when the
+ // target element is newly associated with an nsIFrame.
+ ok(displayMarkers.length == 5 || displayMarkers.length == 4,
+ 'should restyle in most frames');
+
+ div.style.display = 'none';
+ animation = rect.getAnimations()[0];
+
+ var displayNoneMarkers = yield observeStyling(5);
+ // FIXME: Bug 866411: SMIL animations sometimes skip restyles when the
+ // target element is newly associated with an nsIFrame.
+ ok(displayNoneMarkers.length == 1 || displayNoneMarkers.length == 0,
+ 'should never restyle if display:none');
+
+ div.style.display = '';
+ animation = rect.getAnimations()[0];
+ yield animation.ready;
+
+ var displayAgainMarkers = yield observeStyling(5);
+ // FIXME: Bug 866411: SMIL animations sometimes skip restyles when the
+ // target element is newly associated with an nsIFrame.
+ ok(displayMarkers.length == 5 || displayMarkers.length == 4,
+ "should restyle again");
+
+ yield ensureElementRemoval(div);
+ });
});
</script>
</body>