Bug 1337944 part 2 - Add test of CSS Animations with SVG. r?hiro draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Mon, 13 Mar 2017 18:37:56 +0900
changeset 497420 647222d36ef1a5d6baa12749702870c77ec166a0
parent 497419 df3ba7017877a14461cd32e0e7a771ca1df6e40d
child 548882 5ddebcb00b49ff9007d61c536ada43833323143d
push id48895
push usermantaroh@gmail.com
push dateMon, 13 Mar 2017 09:38:38 +0000
reviewershiro
bugs1337944
milestone55.0a1
Bug 1337944 part 2 - Add test of CSS Animations with SVG. r?hiro MozReview-Commit-ID: 2vqYBWZa8xg
dom/animation/test/chrome/test_restyles.html
--- 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>