Bug 1237454 - Test for an animation in the parent element whose visibility is changed. r?boris draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 09 Feb 2018 10:43:10 +0900
changeset 752906 783b483eb0d958cc126a7374e322cb01accdef1e
parent 752905 598fb5eda6c8b224826d326da3c99df6051065f9
child 752907 dde7ec2c2fa27642a92f695240c907f8fe7839a1
push id98428
push userbmo:hikezoe@mozilla.com
push dateFri, 09 Feb 2018 10:01:48 +0000
reviewersboris
bugs1237454
milestone60.0a1
Bug 1237454 - Test for an animation in the parent element whose visibility is changed. r?boris MozReview-Commit-ID: BBMOuPimlPH
dom/animation/test/mozilla/file_restyles.html
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -748,16 +748,49 @@ waitForAllPaints(() => {
       is(markers.length, 5,
          'Animations running that was on visibility hidden element which ' +
          'gets visible should not throttle restyling any more');
 
       await ensureElementRemoval(div);
     }
   );
 
+  add_task(async function restyling_animations_in_visibility_changed_parent() {
+    var parentDiv = addDiv(null, { style: 'visibility: hidden' });
+    var div = addDiv(null, { style: 'animation: background-color 100s;' });
+    parentDiv.appendChild(div);
+
+    var animation = div.getAnimations()[0];
+
+    await animation.ready;
+    var markers = await observeStyling(5);
+
+    todo_is(markers.length, 0,
+            'Animations running in visibility hidden parent should never cause ' +
+            'restyles');
+
+    parentDiv.style.visibility = 'visible';
+    await waitForNextFrame();
+
+    var markers = await observeStyling(5);
+    is(markers.length, 5,
+       'Animations that was in visibility hidden parent should not ' +
+       'throttle restyling any more');
+
+    parentDiv.style.visibility = 'hidden';
+    await waitForNextFrame();
+
+    var markers = await observeStyling(5);
+    todo_is(markers.length, 0,
+            'Animations that the parent element became visible should throttle ' +
+            'restyling again');
+
+    await ensureElementRemoval(parentDiv);
+  });
+
   add_task_if_omta_enabled(async function no_restyling_compositor_animations_after_pause_is_called() {
     var div = addDiv(null, { style: 'animation: opacity 100s' });
     var animation = div.getAnimations()[0];
 
     await animation.ready;
     ok(SpecialPowers.wrap(animation).isRunningOnCompositor);
 
     animation.pause();