Bug 1085769: Merge ContentOrAncestorHasAnimation/Transition r=birtles

This commit is contained in:
David Zbarsky 2014-11-19 21:48:42 -05:00
parent 3e883018cf
commit 7d60c708ba
4 changed files with 14 additions and 30 deletions

View File

@ -878,8 +878,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
#ifdef DEBUG
// reget frame from content since it may have been regenerated...
if (changeData->mContent) {
if (!nsAnimationManager::ContentOrAncestorHasAnimation(changeData->mContent) &&
!nsTransitionManager::ContentOrAncestorHasTransition(changeData->mContent)) {
if (!css::CommonAnimationManager::ContentOrAncestorHasAnimation(changeData->mContent)) {
nsIFrame* frame = changeData->mContent->GetPrimaryFrame();
if (frame) {
DebugVerifyStyleTree(frame);

View File

@ -79,6 +79,19 @@ public:
nsCSSPseudoElements::Type aPseudoType,
bool aCreateIfNeeded);
// Returns true if aContent or any of its ancestors has an animation
// or transition.
static bool ContentOrAncestorHasAnimation(nsIContent* aContent) {
do {
if (aContent->GetProperty(nsGkAtoms::animationsProperty) ||
aContent->GetProperty(nsGkAtoms::transitionsProperty)) {
return true;
}
} while ((aContent = aContent->GetParent()));
return false;
}
// Notify this manager that one of its collections of animation players,
// has been updated.
void NotifyCollectionUpdated(AnimationPlayerCollection& aCollection);

View File

@ -161,17 +161,6 @@ public:
aContent, nsGkAtoms::animationsProperty, aProperty);
}
// Returns true if aContent or any of its ancestors has an animation.
static bool ContentOrAncestorHasAnimation(nsIContent* aContent) {
do {
if (aContent->GetProperty(nsGkAtoms::animationsProperty)) {
return true;
}
} while ((aContent = aContent->GetParent()));
return false;
}
void UpdateStyleAndEvents(mozilla::AnimationPlayerCollection* aEA,
mozilla::TimeStamp aRefreshTime,
mozilla::EnsureStyleRuleFlags aFlags);

View File

@ -99,23 +99,6 @@ public:
typedef mozilla::AnimationPlayerCollection AnimationPlayerCollection;
static AnimationPlayerCollection*
GetTransitions(nsIContent* aContent) {
return static_cast<AnimationPlayerCollection*>
(aContent->GetProperty(nsGkAtoms::transitionsProperty));
}
// Returns true if aContent or any of its ancestors has a transition.
static bool ContentOrAncestorHasTransition(nsIContent* aContent) {
do {
if (GetTransitions(aContent)) {
return true;
}
} while ((aContent = aContent->GetParent()));
return false;
}
static AnimationPlayerCollection*
GetAnimationsForCompositor(nsIContent* aContent, nsCSSProperty aProperty)
{