Bug 1226118 part 1 - Add EffectSet::GetEffectSet(const nsIFrame*); r=dholbert

This commit is contained in:
Brian Birtles 2015-12-04 08:32:52 +09:00
parent 8a2568e4ac
commit 1525268b3d
2 changed files with 37 additions and 0 deletions

View File

@ -41,6 +41,42 @@ EffectSet::GetEffectSet(dom::Element* aElement,
return static_cast<EffectSet*>(aElement->GetProperty(propName));
}
/* static */ EffectSet*
EffectSet::GetEffectSet(const nsIFrame* aFrame)
{
nsIContent* content = aFrame->GetContent();
if (!content) {
return nullptr;
}
nsIAtom* propName;
if (aFrame->IsGeneratedContentFrame()) {
nsIFrame* parent = aFrame->GetParent();
if (parent->IsGeneratedContentFrame()) {
return nullptr;
}
nsIAtom* name = content->NodeInfo()->NameAtom();
if (name == nsGkAtoms::mozgeneratedcontentbefore) {
propName = nsGkAtoms::animationEffectsForBeforeProperty;
} else if (name == nsGkAtoms::mozgeneratedcontentafter) {
propName = nsGkAtoms::animationEffectsForAfterProperty;
} else {
return nullptr;
}
content = content->GetParent();
if (!content) {
return nullptr;
}
} else {
if (!content->MayHaveAnimations()) {
return nullptr;
}
propName = nsGkAtoms::animationEffectsProperty;
}
return static_cast<EffectSet*>(content->GetProperty(propName));
}
/* static */ EffectSet*
EffectSet::GetOrCreateEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType)

View File

@ -45,6 +45,7 @@ public:
static EffectSet* GetEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType);
static EffectSet* GetEffectSet(const nsIFrame* aFrame);
static EffectSet* GetOrCreateEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType);