Bug 1428692 - Don't use tweakExpectedRestyleCount in the case where we don't use the returned count for observeStyling called right after. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 30 Jan 2018 06:41:31 +0900
changeset 748472 a47893d69a291bd0c03177125831a30c24cb6d22
parent 748403 117e0c0d1ebe2cf5bdffc3474744add2416fc511
push id97179
push userhikezoe@mozilla.com
push dateMon, 29 Jan 2018 21:42:16 +0000
reviewersbirtles
bugs1428692
milestone60.0a1
Bug 1428692 - Don't use tweakExpectedRestyleCount in the case where we don't use the returned count for observeStyling called right after. r?birtles tweakExpectedRestyleCount() is supposed to work with observeStyle() which is called right after tweakExpectedRestyleCount(). That's because tweakExpectedRestyleCount() adjusts the expected restyle count which will happen in continuous frames that begins from the startsRightNow() call, especially a redundant restyle might be observed in the last frame if the animation did not begin at the current timeline time and if the Promise inside the last requestAnimationFrame is fulfilled after restyling happened. Instead of using tweakExpectedRestyleCount(), we need to check whether the animation begun at the current timeline time when the animation started, and if the animation begun at the current timeline time, we don't observe the superfluous restyle in a frame after the animation element was re-attached. MozReview-Commit-ID: 6TLQERSSbjU
dom/animation/test/mozilla/file_restyles.html
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -997,17 +997,17 @@ waitForAllPaints(() => {
 
     await animation.ready;
 
     div.remove();
 
     // It's possible that the animation begins at this moment.  If this is the
     // case, an additional superfluous restyle request that we will check later
     // can't be observed.
-    const expectedRestyleCount = tweakExpectedRestyleCount(animation, 1);
+    const superfluousRestyle = startsRightNow(animation) ? 0 : 1;
 
     var markers = await observeStyling(5);
     is(markers.length, 0,
        'Animation on orphaned element should not cause restyles');
 
     document.body.appendChild(div);
 
     markers = await observeStyling(1);
@@ -1022,17 +1022,17 @@ waitForAllPaints(() => {
       // layer restyle (bug 1388557) before fixing important_rules_change in
       // compute_style() so that it no longer dispatches a needless standard
       // restyle (bug 1388560), we should add a test case that fails if we
       // continue to unnecessarily request a standard restyle.
       //
       // Bug 1417354: There will be an additional superfluous restyle request
       // which results when we detach an element from the document between
       // the Animation tick and styling, and then re-attach it.
-      is(markers.length, expectedRestyleCount,
+      is(markers.length, 1 + superfluousRestyle,
          'We should observe one restyle in the first frame right after ' +
          're-attaching to the document');
     } else {
       // Bug 1388557: We should call RequestRestyle(Layer) when an element which
       // has running script animations is attached to a document.
       todo_is(markers.length, 1,
               'Bug 1388557 We should observe one restyle in the first frame ' +
               'right after re-attaching to the document');