Bug 1421507 - Test cases for position:absolute element. r?boris draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 05 Jan 2018 10:30:17 +0900
changeset 716042 3ee6415bc0ad7513decacbf68aed95f86d52e3ca
parent 716014 3acb14b949150529ec761f845f9a3d61ee341dac
child 716043 971b5014b21dd4ffe8341c4cb096763daae81db8
push id94309
push userbmo:hikezoe@mozilla.com
push dateFri, 05 Jan 2018 01:31:14 +0000
reviewersboris
bugs1421507
milestone59.0a1
Bug 1421507 - Test cases for position:absolute element. r?boris MozReview-Commit-ID: IRPsvJ5WAQF
dom/animation/test/mozilla/file_restyles.html
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -1138,16 +1138,62 @@ waitForAllPaints(() => {
     var markers = await observeStyling(5);
     is(markers.length, 0,
        'CSS animation on an out-of-view element with pre-transform should be ' +
        'throttled.');
 
     await ensureElementRemoval(scrollDiv);
   });
 
+  add_task(
+    async function throttling_animations_in_out_of_view_position_absolute_element() {
+      if (!offscreenThrottlingEnabled) {
+        return;
+      }
+
+      var parentDiv = addDiv(null,
+                             { style: 'position: absolute; top: -1000px;' });
+      var targetDiv = addDiv(null,
+                             { style: 'animation: background-color 100s;' });
+      parentDiv.appendChild(targetDiv);
+
+      var animation = targetDiv.getAnimations()[0];
+      await animation.ready;
+
+      var markers = await observeStyling(5);
+      is(markers.length, 0,
+         'CSS animation in an out-of-view position absolute element should ' +
+         'be throttled');
+
+      await ensureElementRemoval(parentDiv);
+    }
+  );
+
+  add_task(
+    async function throttling_animations_on_out_of_view_position_absolute_element() {
+      if (!offscreenThrottlingEnabled) {
+        return;
+      }
+
+      var div = addDiv(null,
+                       { style: 'animation: background-color 100s; ' +
+                                'position: absolute; top: -1000px;' });
+
+      var animation = div.getAnimations()[0];
+      await animation.ready;
+
+      var markers = await observeStyling(5);
+      is(markers.length, 0,
+         'CSS animation on an out-of-view position absolute element should ' +
+         'be throttled');
+
+      await ensureElementRemoval(div);
+    }
+  );
+
   add_task_if_omta_enabled(
     async function no_restyling_for_compositor_animation_on_unrelated_style_change() {
       var div = addDiv(null);
       var animation = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
 
       await animation.ready;
       ok(SpecialPowers.wrap(animation).isRunningOnCompositor,
          'The opacity animation is running on the compositor');