Bug 1372335 - A reftest to check that animation styles are surely discarded when selector matching happens simultaneously. r?emilio draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 14 Jun 2017 11:56:13 +0900
changeset 593747 11e1441eefca2891d402332b193ed5d1bd7c51d5
parent 593716 6bea8e940b9c7cb5fdb769692cef7801616b983e
child 633190 0fd1d1e322880dcd510b452c8ed0dcd0a9ad271e
push id63783
push userhikezoe@mozilla.com
push dateWed, 14 Jun 2017 02:56:55 +0000
reviewersemilio
bugs1372335
milestone56.0a1
Bug 1372335 - A reftest to check that animation styles are surely discarded when selector matching happens simultaneously. r?emilio This reftest fails without the first patch. This test generates animation-only restyle by anim.cancel() and selector matching by classList.add(). MozReview-Commit-ID: 2EvOWRwr1o7
layout/reftests/web-animations/cancel-animation-with-selector-matching.html
layout/reftests/web-animations/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/web-animations/cancel-animation-with-selector-matching.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>Discard cancelled animation styles</title>
+<style>
+#test {
+  width: 100px; height: 100px;
+  background-color: white;
+}
+.changed {
+  color: red;
+}
+
+</style>
+<div id="test"></div>
+<script>
+  var target = document.getElementById("test");
+  var anim = target.animate({ backgroundColor: [ "red", "red" ] }, 100000);
+
+  anim.ready.then(() => {
+    anim.cancel();
+    // Add a class name to cause selector matching in a subsequent restyle.
+    target.classList.add("changed");
+
+    requestAnimationFrame(() => {
+      document.documentElement.classList.remove("reftest-wait");
+    });
+  });
+</script>
--- a/layout/reftests/web-animations/reftest.list
+++ b/layout/reftests/web-animations/reftest.list
@@ -16,8 +16,9 @@ test-pref(dom.animations-api.core.enable
 
 test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-changing-target-in-delay.html stacking-context-animation-changing-target-ref.html
 test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-changing-effect.html stacking-context-animation-ref.html
 test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-changing-display-property.html stacking-context-animation-ref.html
 test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-losing-css-animation-in-delay.html stacking-context-animation-ref.html
 test-pref(dom.animations-api.core.enabled,true) == style-updates-on-iteration-composition-changed-from-accumulate-to-replace.html style-updates-for-iteration-composite-ref.html
 test-pref(dom.animations-api.core.enabled,true) == style-updates-on-iteration-composition-changed-from-replace-to-accumulate.html style-updates-for-iteration-composite-ref.html
 test-pref(dom.animations-api.core.enabled,true) == style-updates-on-current-iteration-changed.html style-updates-for-iteration-composite-ref.html
+test-pref(dom.animations-api.core.enabled,true) == cancel-animation-with-selector-matching.html about:blank