Bug 1237454 - Test for an animation on a visibility:hidden element which has a child. r?boris draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 09 Feb 2018 10:43:10 +0900
changeset 752907 dde7ec2c2fa27642a92f695240c907f8fe7839a1
parent 752906 783b483eb0d958cc126a7374e322cb01accdef1e
child 752908 00e9b906be02cea0eca5abc1e21f0bc2ac4ba873
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 on a visibility:hidden element which has a child. r?boris MozReview-Commit-ID: AfmQJThhp8d
dom/animation/test/mozilla/file_restyles.html
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -781,16 +781,66 @@ waitForAllPaints(() => {
     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(
+    async function restyling_animations_on_visibility_hidden_element_with_visibility_changed_children() {
+      var div = addDiv(null,
+       { style: 'animation: background-color 100s; visibility: hidden' });
+      var animation = div.getAnimations()[0];
+
+      await animation.ready;
+      var markers = await observeStyling(5);
+
+      todo_is(markers.length, 0,
+              'Animations on visibility hidden element having no visible children ' +
+              'should never cause restyles');
+
+      var childElement = addDiv(null, { style: 'visibility: visible' });
+      div.appendChild(childElement);
+      await waitForNextFrame();
+
+      var markers = await observeStyling(5);
+      is(markers.length, 5,
+         'Animations running on visibility hidden element but the element has ' +
+         'a visible child should not throttle restyling');
+
+      childElement.style.visibility = 'hidden';
+      await waitForNextFrame();
+
+      var markers = await observeStyling(5);
+      todo_is(markers.length, 0,
+              'Animations running on visibility hidden element that a child ' +
+              'has become invisible should throttle restyling');
+
+      childElement.style.visibility = 'visible';
+      await waitForNextFrame();
+
+      var markers = await observeStyling(5);
+      is(markers.length, 5,
+         'Animations running on visibility hidden element should not throttle ' +
+         'restyling after the invisible element changed to visible');
+
+      childElement.remove();
+      await waitForNextFrame();
+
+      var markers = await observeStyling(5);
+      todo_is(markers.length, 0,
+              'Animations running on visibility hidden element should throttle ' +
+              'restyling again after all visible descendants were removed');
+
+      await ensureElementRemoval(div);
+    }
+  );
+
   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();