author | Ryan VanderMeulen <ryanvm@gmail.com> |
Tue, 24 Mar 2015 09:13:06 -0400 | |
changeset 235262 | 5329cda711c8f3ca57768a3f37e6a4f17996acd9 |
parent 235261 | 5627301b95de8f603d8a1624d1a9f826474cef20 |
child 235263 | 4460210c41b57e7c15c2a93dab6639f09217f81c |
child 235308 | 08f09b24606efcb5afcc69dc612dcc426f7f20ec |
push id | 57384 |
push user | ryanvm@gmail.com |
push date | Tue, 24 Mar 2015 13:14:53 +0000 |
treeherder | mozilla-inbound@5329cda711c8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1061364, 1117603 |
milestone | 39.0a1 |
backs out | aaf374ba062f13185c09a044e419ee5b5438bba4 67fece2790496af172de79b63ffe9e334e05d279 fe8ba59678a2f1c53e9b2af0f9e8e557429f3e8b |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
layout/style/AnimationCommon.cpp | file | annotate | diff | comparison | revisions | |
layout/style/AnimationCommon.h | file | annotate | diff | comparison | revisions |
--- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -94,49 +94,33 @@ CommonAnimationManager::RemoveAllElement AnimationPlayerCollection* head = static_cast<AnimationPlayerCollection*>( PR_LIST_HEAD(&mElementCollections)); head->Destroy(); } } void -CommonAnimationManager::MaybeStartObservingRefreshDriver() -{ - if (mIsObservingRefreshDriver || !NeedsRefresh()) { - return; - } - - mPresContext->RefreshDriver()->AddRefreshObserver(this, Flush_Style); - mIsObservingRefreshDriver = true; -} - -void -CommonAnimationManager::MaybeStartOrStopObservingRefreshDriver() -{ - bool needsRefresh = NeedsRefresh(); - if (needsRefresh && !mIsObservingRefreshDriver) { - mPresContext->RefreshDriver()->AddRefreshObserver(this, Flush_Style); - } else if (!needsRefresh && mIsObservingRefreshDriver) { - mPresContext->RefreshDriver()->RemoveRefreshObserver(this, Flush_Style); - } - mIsObservingRefreshDriver = needsRefresh; -} - -bool -CommonAnimationManager::NeedsRefresh() const +CommonAnimationManager::CheckNeedsRefresh() { for (PRCList *l = PR_LIST_HEAD(&mElementCollections); l != &mElementCollections; l = PR_NEXT_LINK(l)) { if (static_cast<AnimationPlayerCollection*>(l)->mNeedsRefreshes) { - return true; + if (!mIsObservingRefreshDriver) { + mPresContext->RefreshDriver()->AddRefreshObserver(this, Flush_Style); + mIsObservingRefreshDriver = true; + } + return; } } - return false; + if (mIsObservingRefreshDriver) { + mIsObservingRefreshDriver = false; + mPresContext->RefreshDriver()->RemoveRefreshObserver(this, Flush_Style); + } } AnimationPlayerCollection* CommonAnimationManager::GetAnimationsForCompositor(nsIContent* aContent, nsIAtom* aElementProperty, nsCSSProperty aProperty) { if (!aContent->MayHaveAnimations()) @@ -287,17 +271,17 @@ CommonAnimationManager::AddStyleUpdatesT } } } void CommonAnimationManager::NotifyCollectionUpdated(AnimationPlayerCollection& aCollection) { - MaybeStartObservingRefreshDriver(); + CheckNeedsRefresh(); mPresContext->ClearLastStyleUpdateForAllAnimations(); mPresContext->RestyleManager()->IncrementAnimationGeneration(); aCollection.UpdateAnimationGeneration(mPresContext); aCollection.PostRestyleForAnimation(mPresContext); } /* static */ bool CommonAnimationManager::ExtractComputedValueForTransition( @@ -387,19 +371,31 @@ CommonAnimationManager::GetAnimationRule return nullptr; } RestyleManager* restyleManager = mPresContext->RestyleManager(); if (restyleManager->SkipAnimationRules()) { return nullptr; } - collection->EnsureStyleRuleFor( - mPresContext->RefreshDriver()->MostRecentRefresh(), - EnsureStyleRule_IsNotThrottled); + // Animations should already be refreshed, but transitions may not be. + // Note that this is temporary, we would like both animations and transitions + // to both be refreshed by this point. + if (IsAnimationManager()) { + NS_WARN_IF_FALSE(!collection->mNeedsRefreshes || + collection->mStyleRuleRefreshTime == + mPresContext->RefreshDriver()->MostRecentRefresh(), + "should already have refreshed style rule"); + } else { + // FIXME: Remove this assignment. See bug 1061364. + collection->mNeedsRefreshes = true; + collection->EnsureStyleRuleFor( + mPresContext->RefreshDriver()->MostRecentRefresh(), + EnsureStyleRule_IsNotThrottled); + } return collection->mStyleRule; } /* static */ const CommonAnimationManager::LayerAnimationRecord CommonAnimationManager::sLayerAnimationInfo[] = { { eCSSProperty_transform, nsDisplayItem::TYPE_TRANSFORM, @@ -739,17 +735,17 @@ AnimationPlayerCollection::EnsureStyleRu nsCSSPropertySet properties; for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) { mPlayers[playerIdx]->ComposeStyle(mStyleRule, properties, mNeedsRefreshes); } } - mManager->MaybeStartObservingRefreshDriver(); + mManager->CheckNeedsRefresh(); // If one of our animations just started or stopped filling, we need // to notify the transition manager. This does the notification a bit // more than necessary, but it's easier than doing it exactly. if (mManager->IsAnimationManager()) { mManager->mPresContext->TransitionManager()-> UpdateCascadeResultsWithAnimations(this); }
--- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -126,25 +126,21 @@ public: protected: virtual ~CommonAnimationManager(); // For ElementCollectionRemoved friend struct mozilla::AnimationPlayerCollection; void AddElementCollection(AnimationPlayerCollection* aCollection); - void ElementCollectionRemoved() { MaybeStartOrStopObservingRefreshDriver(); } + void ElementCollectionRemoved() { CheckNeedsRefresh(); } void RemoveAllElementCollections(); - // We should normally only call MaybeStartOrStopObservingRefreshDriver in - // situations where we will also queue events since otherwise we may stop - // getting refresh driver ticks before we queue the necessary events. - void MaybeStartObservingRefreshDriver(); - void MaybeStartOrStopObservingRefreshDriver(); - bool NeedsRefresh() const; + // Check to see if we should stop or start observing the refresh driver + void CheckNeedsRefresh(); virtual nsIAtom* GetAnimationsAtom() = 0; virtual nsIAtom* GetAnimationsBeforeAtom() = 0; virtual nsIAtom* GetAnimationsAfterAtom() = 0; virtual bool IsAnimationManager() { return false; }