Bug 1058346 patch 2 - Add eRestyle_SVGAttrAnimations and support it in nsStyleSet::RuleNodeWithReplacement. r=birtles

This allows posting a restyle that says that only the rule(s) from the
SVGAttrAnimationSheet cascade level will be replaced, which avoids running
selector matching.

This is needed to land bug 977991 prior to landing bug 960465, since
that requires replacing all levels that contain animations.

(I'll rename this to match the name determined in bug 1057231.)
This commit is contained in:
L. David Baron 2014-09-13 06:17:35 -07:00
Родитель 87487f1ab0
Коммит 80f5a01d0c
3 изменённых файлов: 30 добавлений и 3 удалений

Просмотреть файл

@ -305,14 +305,21 @@ enum nsRestyleHint {
// work.)
eRestyle_CSSAnimations = (1<<4),
// Replace the style data coming from SVG animations (SMIL Animations)
// without updating any other style data. If a new style context
// results, update style contexts on the descendants. (Irrelevant if
// eRestyle_Self or eRestyle_Subtree is also set, since those imply a
// superset of the work.)
eRestyle_SVGAttrAnimations = (1<<5),
// Continue the restyling process to the current frame's children even
// if this frame's restyling resulted in no style changes.
eRestyle_Force = (1<<5),
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.)
eRestyle_ForceDescendants = (1<<6),
eRestyle_ForceDescendants = (1<<9),
};

Просмотреть файл

@ -76,17 +76,26 @@ SVGAttrAnimationRuleProcessor::MediumFeaturesChanged(nsPresContext* aPresContext
/* virtual */ void
SVGAttrAnimationRuleProcessor::RulesMatching(PseudoElementRuleProcessorData* aData)
{
// If SMIL Animation of SVG attributes can ever target
// pseudo-elements, we need to adjust either
// nsStyleSet::RuleNodeWithReplacement or the test in
// ElementRestyler::RestyleSelf (added in bug 977991 patch 4) to
// handle such styles.
}
/* virtual */ void
SVGAttrAnimationRuleProcessor::RulesMatching(AnonBoxRuleProcessorData* aData)
{
// If SMIL Animation of SVG attributes can ever target anonymous boxes,
// see comment in RulesMatching(PseudoElementRuleProcessorData*).
}
#ifdef MOZ_XUL
/* virtual */ void
SVGAttrAnimationRuleProcessor::RulesMatching(XULTreeRuleProcessorData* aData)
{
// If SMIL Animation of SVG attributes can ever target XUL tree pseudos,
// see comment in RulesMatching(PseudoElementRuleProcessorData*).
}
#endif

Просмотреть файл

@ -1335,7 +1335,7 @@ static const CascadeLevel gCascadeLevels[] = {
{ nsStyleSet::eAgentSheet, false, nsRestyleHint(0) },
{ nsStyleSet::eUserSheet, false, nsRestyleHint(0) },
{ nsStyleSet::ePresHintSheet, false, nsRestyleHint(0) },
{ nsStyleSet::eSVGAttrAnimationSheet, false, nsRestyleHint(0) },
{ nsStyleSet::eSVGAttrAnimationSheet, false, eRestyle_SVGAttrAnimations },
{ nsStyleSet::eDocSheet, false, nsRestyleHint(0) },
{ nsStyleSet::eScopedDocSheet, false, nsRestyleHint(0) },
{ nsStyleSet::eStyleAttrSheet, false, nsRestyleHint(0) },
@ -1358,6 +1358,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
{
NS_ABORT_IF_FALSE(!(aReplacements & ~(eRestyle_CSSTransitions |
eRestyle_CSSAnimations |
eRestyle_SVGAttrAnimations |
eRestyle_Force |
eRestyle_ForceDescendants)),
// FIXME: Once bug 979133 lands we'll have a better
@ -1431,6 +1432,16 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement,
}
break;
}
case eRestyle_SVGAttrAnimations: {
SVGAttrAnimationRuleProcessor* ruleProcessor =
static_cast<SVGAttrAnimationRuleProcessor*>(
mRuleProcessors[eSVGAttrAnimationSheet].get());
if (ruleProcessor &&
aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
ruleProcessor->ElementRulesMatching(aElement, &ruleWalker);
}
break;
}
default:
break;
}