Bug 1057231 patch 4 - Move SVG Attribute Animation rules from the pres hint level to their own cascade level. r=dholbert

This is only a very slight reordering of their position in the cascade,
since they were previously walked at the end of
nsSVGElement::WalkContentStyleRules, which was called near the end of
nsHTMLStyleSheet::RulesMatching.  So the only change should be that they
now take priority over the xml:lang rule added by nsHTMLStyleSheet, a
rule with which they do not interact.
This commit is contained in:
L. David Baron 2014-09-13 06:17:35 -07:00
parent 702140ab45
commit 4b2c9728a9
3 changed files with 15 additions and 2 deletions

View File

@ -905,6 +905,12 @@ nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
aRuleWalker->Forward(mContentStyleRule);
}
return NS_OK;
}
void
nsSVGElement::WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker)
{
// Update & walk the animated content style rule, to include style from
// animated mapped attributes. But first, get nsPresContext to check
// whether this is a "no-animation restyle". (This should match the check
@ -933,8 +939,6 @@ nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
aRuleWalker->Forward(animContentStyleRule);
}
}
return NS_OK;
}
NS_IMETHODIMP_(bool)

View File

@ -113,6 +113,7 @@ public:
virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) MOZ_OVERRIDE;
void WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -11,8 +11,11 @@
*/
#include "SVGAttrAnimationRuleProcessor.h"
#include "nsRuleProcessorData.h"
#include "nsSVGElement.h"
using namespace mozilla;
using namespace mozilla::dom;
SVGAttrAnimationRuleProcessor::SVGAttrAnimationRuleProcessor()
{
@ -27,6 +30,11 @@ NS_IMPL_ISUPPORTS(SVGAttrAnimationRuleProcessor, nsIStyleRuleProcessor)
/* virtual */ void
SVGAttrAnimationRuleProcessor::RulesMatching(ElementRuleProcessorData* aData)
{
Element* element = aData->mElement;
if (element->IsSVG()) {
static_cast<nsSVGElement*>(element)->
WalkAnimatedContentStyleRules(aData->mRuleWalker);
}
}
/* virtual */ nsRestyleHint