Bug 1334036 - Part 6: Trigger restyle if important rules are changed.
If we add/remove important rules, we should call MaybeUpdateCascadeResults()
to make sure EffectSet::mPropertiesWithImportantRules is correct, and so we can
avoid that these important rules are overridden by animations running on
compositor. Currently, we call MaybeUpdateCascadeResults only while iterating
elements which needs to be restyled, so we should request a restyle on this
element whose important rules are changed.
MozReview-Commit-ID: 87MBQrirVto
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -536,20 +536,32 @@ Gecko_UpdateAnimations(RawGeckoElementBo
if (aTasks & UpdateAnimationsTasks::CSSTransitions) {
MOZ_ASSERT(aOldComputedValues);
const ServoComputedValuesWithParent oldServoValues =
{ aOldComputedValues, nullptr };
presContext->TransitionManager()->
UpdateTransitions(const_cast<dom::Element*>(aElement), pseudoType,
oldServoValues, servoValues);
}
+
if (aTasks & UpdateAnimationsTasks::EffectProperties) {
presContext->EffectCompositor()->UpdateEffectProperties(
servoValues, const_cast<dom::Element*>(aElement), pseudoType);
}
+
+ if (aTasks & UpdateAnimationsTasks::CascadeResults) {
+ // This task will be scheduled if we detected any changes to !important
+ // rules. We post a restyle here so that we can update the cascade
+ // results in the pre-traversal of the next restyle.
+ presContext->EffectCompositor()
+ ->RequestRestyle(const_cast<Element*>(aElement),
+ pseudoType,
+ EffectCompositor::RestyleType::Standard,
+ EffectCompositor::CascadeLevel::Animations);
+ }
}
}
bool
Gecko_ElementHasAnimations(RawGeckoElementBorrowed aElement)
{
nsIAtom* pseudoTag = PseudoTagAndCorrectElementForAnimation(aElement);
CSSPseudoElementType pseudoType =