diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 1e88be2e5c4..95659f02b81 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -1803,7 +1803,12 @@ Element::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule, if (doc) { nsCOMPtr shell = doc->GetShell(); if (shell) { - shell->RestyleForAnimation(this, eRestyle_StyleAttribute); + // Pass both eRestyle_StyleAttribute and + // eRestyle_StyleAttribute_Animations since we don't know if + // this style represents only the ticking of an existing + // animation or whether it's a new or changed animation. + shell->RestyleForAnimation(this, eRestyle_StyleAttribute | + eRestyle_StyleAttribute_Animations); } } } diff --git a/dom/smil/nsSMILAnimationController.cpp b/dom/smil/nsSMILAnimationController.cpp index 3c6f9486282..8bb9572a4c5 100644 --- a/dom/smil/nsSMILAnimationController.cpp +++ b/dom/smil/nsSMILAnimationController.cpp @@ -832,7 +832,7 @@ nsSMILAnimationController::AddStyleUpdate(AnimationElementPtrKey* aKey, // Element::GetSMILOverrideStyleRule (via nsSMILCSSProperty objects), // and mIsCSS false means the rules are nsSMILMappedAttribute objects // returned from nsSVGElement::GetAnimatedContentStyleRule. - nsRestyleHint rshint = key.mIsCSS ? eRestyle_StyleAttribute + nsRestyleHint rshint = key.mIsCSS ? eRestyle_StyleAttribute_Animations : eRestyle_SVGAttrAnimations; restyleTracker->AddPendingRestyle(key.mElement, rshint, nsChangeHint(0)); diff --git a/layout/base/nsChangeHint.h b/layout/base/nsChangeHint.h index a8b3d981e69..edc497ce13a 100644 --- a/layout/base/nsChangeHint.h +++ b/layout/base/nsChangeHint.h @@ -348,24 +348,30 @@ enum nsRestyleHint { // work.) Supported only for element style contexts and not for // pseudo-elements or anonymous boxes, on which it converts to // eRestyle_Self. + // If the change is for the advance of a declarative animation, use + // the value below instead. eRestyle_StyleAttribute = (1<<6), + // Same as eRestyle_StyleAttribute, but for when the change results + // from the advance of a declarative animation. + eRestyle_StyleAttribute_Animations = (1<<7), + // Continue the restyling process to the current frame's children even // if this frame's restyling resulted in no style changes. - eRestyle_Force = (1<<7), + eRestyle_Force = (1<<8), // Continue the restyling process to all of the current frame's // descendants, even if any frame's restyling resulted in no style // changes. (Implies eRestyle_Force.) Note that this is weaker than // eRestyle_Subtree, which makes us rerun selector matching on all // descendants rather than just continuing the restyling process. - eRestyle_ForceDescendants = (1<<8), + eRestyle_ForceDescendants = (1<<9), // Useful unions: eRestyle_AllHintsWithAnimations = eRestyle_CSSTransitions | eRestyle_CSSAnimations | eRestyle_SVGAttrAnimations | - eRestyle_StyleAttribute, + eRestyle_StyleAttribute_Animations, }; // The functions below need an integral type to cast to to avoid diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index e3f3292b3d8..7c54892eb65 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -1378,12 +1378,14 @@ static const CascadeLevel gCascadeLevels[] = { { nsStyleSet::eSVGAttrAnimationSheet, false, false, eRestyle_SVGAttrAnimations }, { nsStyleSet::eDocSheet, false, false, nsRestyleHint(0) }, { nsStyleSet::eScopedDocSheet, false, false, nsRestyleHint(0) }, - { nsStyleSet::eStyleAttrSheet, false, true, eRestyle_StyleAttribute }, + { nsStyleSet::eStyleAttrSheet, false, true, eRestyle_StyleAttribute | + eRestyle_StyleAttribute_Animations }, { nsStyleSet::eOverrideSheet, false, false, nsRestyleHint(0) }, { nsStyleSet::eAnimationSheet, false, false, eRestyle_CSSAnimations }, { nsStyleSet::eScopedDocSheet, true, false, nsRestyleHint(0) }, { nsStyleSet::eDocSheet, true, false, nsRestyleHint(0) }, - { nsStyleSet::eStyleAttrSheet, true, false, eRestyle_StyleAttribute }, + { nsStyleSet::eStyleAttrSheet, true, false, eRestyle_StyleAttribute | + eRestyle_StyleAttribute_Animations }, { nsStyleSet::eOverrideSheet, true, false, nsRestyleHint(0) }, { nsStyleSet::eUserSheet, true, false, nsRestyleHint(0) }, { nsStyleSet::eAgentSheet, true, false, nsRestyleHint(0) }, @@ -1409,6 +1411,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, eRestyle_CSSAnimations | eRestyle_SVGAttrAnimations | eRestyle_StyleAttribute | + eRestyle_StyleAttribute_Animations | eRestyle_Force | eRestyle_ForceDescendants)), "unexpected replacement bits"); @@ -1449,8 +1452,8 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, level->mCheckForImportantRules && doReplace); if (doReplace) { - switch (level->mLevelReplacementHint) { - case eRestyle_CSSAnimations: { + switch (level->mLevel) { + case nsStyleSet::eAnimationSheet: { if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement || aPseudoType == nsCSSPseudoElements::ePseudo_before || aPseudoType == nsCSSPseudoElements::ePseudo_after) { @@ -1462,7 +1465,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, } break; } - case eRestyle_CSSTransitions: { + case nsStyleSet::eTransitionSheet: { if (aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement || aPseudoType == nsCSSPseudoElements::ePseudo_before || aPseudoType == nsCSSPseudoElements::ePseudo_after) { @@ -1474,7 +1477,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, } break; } - case eRestyle_SVGAttrAnimations: { + case nsStyleSet::eSVGAttrAnimationSheet: { SVGAttrAnimationRuleProcessor* ruleProcessor = static_cast( mRuleProcessors[eSVGAttrAnimationSheet].get()); @@ -1484,7 +1487,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, } break; } - case eRestyle_StyleAttribute: { + case nsStyleSet::eStyleAttrSheet: { if (!level->mIsImportant) { // First time through, we handle the non-!important rule. nsHTMLCSSStyleSheet* ruleProcessor =