Bug 1133439 patch 1 - Split eRestyle_StyleAttribute into eRestyle_StyleAttribute and eRestyle_StyleAttributeAnimations. r=birtles

This commit is contained in:
L. David Baron 2015-02-19 21:22:05 +13:00
parent 0112797e79
commit 88d26a6cac
4 changed files with 26 additions and 12 deletions

View File

@ -1803,7 +1803,12 @@ Element::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
if (doc) {
nsCOMPtr<nsIPresShell> 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);
}
}
}

View File

@ -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));

View File

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

View File

@ -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<SVGAttrAnimationRuleProcessor*>(
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 =