Bug 1318697 - Part 1: Don't request restyle for animations level if there is no animations' level effect. r?birtles
MozReview-Commit-ID: H7Onymm50Fk
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -765,17 +765,18 @@ EffectCompositor::UpdateCascadeResults(E
return;
}
// If properties for compositor are newly overridden by !important rules, or
// released from being overridden by !important rules, we need to update
// layers for animations level because it's a trigger to send animations to
// the compositor or pull animations back from the compositor.
if (prevCompositorPropertiesWithImportantRules !=
- compositorPropertiesInSet(propertiesWithImportantRules)) {
+ compositorPropertiesInSet(propertiesWithImportantRules) &&
+ !compositorPropertiesInSet(propertiesForAnimationsLevel).none()) {
presContext->EffectCompositor()->
RequestRestyle(aElement, aPseudoType,
EffectCompositor::RestyleType::Layer,
EffectCompositor::CascadeLevel::Animations);
}
// If we have transition properties for compositor and if the same propery
// for animations level is newly added or removed, we need to update layers
// for transitions level because composite order has been changed now.
--- a/layout/reftests/css-transitions/reftest.list
+++ b/layout/reftests/css-transitions/reftest.list
@@ -1,8 +1,9 @@
== transitions-inline-already-wrapped-1.html transitions-inline-ref.html
== transitions-inline-already-wrapped-2.html transitions-inline-ref.html
== transitions-inline-rewrap-1.html transitions-inline-ref.html
== transitions-inline-rewrap-2.html transitions-inline-ref.html
== stacking-context-opacity-lose-to-animation.html stacking-context-transition-ref.html
== stacking-context-transform-lose-to-animation.html stacking-context-transition-ref.html
== stacking-context-opacity-wins-over-important-style.html stacking-context-transition-ref.html
== stacking-context-transform-wins-over-important-style.html stacking-context-transition-ref.html
+== transitions-by-important-rule-change.html transitions-by-important-rule-change-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-transitions/transitions-by-important-rule-change-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<title>A reference of 100x100 blue box</title>
+<style>
+div {
+ width: 100px; height: 100px;
+ background: blue;
+}
+</style>
+<div></div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-transitions/transitions-by-important-rule-change.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>
+Opacity transition and transform transition by changing transform style with
+!important rule
+</title>
+<style>
+div {
+ width: 100px; height: 100px;
+ background: blue;
+}
+</style>
+<div id="target"></div>
+<script>
+window.addEventListener("load", () => {
+ var target = document.getElementById("target");
+ target.style = "opacity: 0.5; transform: translateY(300px);";
+
+ getComputedStyle(target).transform;
+
+ target.style = "transition: opacity 1s -0.9s steps(1, end), " +
+ "transform 1s -0.9s steps(1, end); " +
+ "transform: translateY(0px) !important; " +
+ "opacity: 1;"
+
+ target.addEventListener("transitionend", () => {
+ document.documentElement.classList.remove("reftest-wait");
+ }, false);
+});
+</script>