Bug 1310096 - Replace the wait for the second MozAfterPaint with rAF callback to avoid intermittent failure on Android. r?boris draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Wed, 19 Oct 2016 14:41:50 +0900
changeset 426839 413c0efe1fc175adc19c245dcd960b2591803445
parent 426483 01ab78dd98805e150b0311cce2351d5b408f3001
child 534278 55bd9efb20a1576e14845176e4622ce6d5e8b043
push id32815
push userbmo:hiikezoe@mozilla-japan.org
push dateWed, 19 Oct 2016 06:39:57 +0000
reviewersboris
bugs1310096
milestone52.0a1
Bug 1310096 - Replace the wait for the second MozAfterPaint with rAF callback to avoid intermittent failure on Android. r?boris MozReview-Commit-ID: AamMljHkbM4
layout/reftests/css-animations/no-stacking-context-opacity-removing-animation-in-delay.html
layout/reftests/css-animations/no-stacking-context-transform-removing-animation-in-delay.html
--- a/layout/reftests/css-animations/no-stacking-context-opacity-removing-animation-in-delay.html
+++ b/layout/reftests/css-animations/no-stacking-context-opacity-removing-animation-in-delay.html
@@ -23,25 +23,26 @@ span {
 <span></span>
 <div id="test"></div>
 <script>
 window.addEventListener("load", () => {
   var target = document.getElementById("test");
   target.style.animation = "Opacity0 100s 100s";
 
   // We need to wait for MozAfterPaint instead of requestAnimationFrame to
-  // ensure the stacking context has been updated (removed) on the compositor
-  // before we snapshot.
+  // ensure the stacking context has been updated on the compositor.
   window.addEventListener("MozAfterPaint", function firstPaint() {
     window.removeEventListener("MozAfterPaint", firstPaint, false);
     // Here we have CSS animation on 100% opacity style element, so
     // there should be a stacking context.
 
     target.style.animation = "";
-    window.addEventListener("MozAfterPaint", function secondPaint() {
-      window.removeEventListener("MozAfterPaint", secondPaint, false);
+
+    // This time we don't need to wait for MozAfterPaint because reftest tool
+    // will be received MozAferPaint event.
+    requestAnimationFrame(() => {
       // Now we have only 100% opacity style, so we should not create any
       // stacking context.
       document.documentElement.classList.remove("reftest-wait");
-    }, false);
+    });
   }, false);
 });
 </script>
--- a/layout/reftests/css-animations/no-stacking-context-transform-removing-animation-in-delay.html
+++ b/layout/reftests/css-animations/no-stacking-context-transform-removing-animation-in-delay.html
@@ -23,25 +23,25 @@ span {
 <span></span>
 <div id="test"></div>
 <script>
 window.addEventListener("load", () => {
   var target = document.getElementById("test");
   target.style.animation = "TransformNone 100s 100s";
 
   // We need to wait for MozAfterPaint instead of requestAnimationFrame to
-  // ensure the stacking context has been updated (removed) on the compositor
-  // before we snapshot.
+  // ensure the stacking context has been updated on the compositor.
   window.addEventListener("MozAfterPaint", function firstPaint() {
     window.removeEventListener("MozAfterPaint", firstPaint, false);
     // Here we have CSS animation on transform:none style element, so
     // there should be a stacking context.
 
     target.style.animation = "";
-    window.addEventListener("MozAfterPaint", function secondPaint() {
-      window.removeEventListener("MozAfterPaint", secondPaint, false);
+    // This time we don't need to wait for MozAfterPaint because reftest tool
+    // will be received MozAferPaint event.
+    requestAnimationFrame(() => {
       // Now we have only transform:none style, so we should not create any
       // stacking context.
       document.documentElement.classList.remove("reftest-wait");
-    }, false);
+    });
   }, false);
 });
 </script>