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
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