Bug 1036287 part 5 - Drop aTime param from IsRunning(At) and IsCurrent(At), since they now use the current timeline time; r=dholbert

This commit is contained in:
Brian Birtles 2014-07-16 09:02:33 +09:00
Родитель f7c2a452ed
Коммит 7aff661646
5 изменённых файлов: 14 добавлений и 27 удалений

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

@ -2868,12 +2868,6 @@ Element::MozRequestPointerLock()
void
Element::GetAnimationPlayers(nsTArray<nsRefPtr<ElementAnimation> >& aPlayers)
{
mozilla::TimeStamp now = OwnerDoc()->Timeline()->GetCurrentTimeStamp();
if (now.IsNull()) {
// If the timeline doesn't have a current time, return an empty list.
return;
}
nsIAtom* properties[] = { nsGkAtoms::transitionsProperty,
nsGkAtoms::animationsProperty };
for (size_t propIdx = 0; propIdx < MOZ_ARRAY_LENGTH(properties);
@ -2888,7 +2882,7 @@ Element::GetAnimationPlayers(nsTArray<nsRefPtr<ElementAnimation> >& aPlayers)
animIdx < collection->mAnimations.Length();
animIdx++) {
ElementAnimation* anim = collection->mAnimations[animIdx];
if (anim->IsCurrentAt(now)) {
if (anim->IsCurrent()) {
aPlayers.AppendElement(anim);
}
}

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

@ -374,12 +374,9 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
ElementAnimationPtrArray& aAnimations,
Layer* aLayer, AnimationData& aData,
bool aPending) {
mozilla::TimeStamp currentTime =
aFrame->PresContext()->RefreshDriver()->MostRecentRefresh();
for (uint32_t animIdx = 0; animIdx < aAnimations.Length(); animIdx++) {
mozilla::ElementAnimation* anim = aAnimations[animIdx];
if (!(anim->HasAnimationOfProperty(aProperty) &&
anim->IsRunningAt(currentTime))) {
if (!(anim->HasAnimationOfProperty(aProperty) && anim->IsRunning())) {
continue;
}
AddAnimationForProperty(aFrame, aProperty, anim, aLayer, aData, aPending);

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

@ -325,12 +325,10 @@ nsLayoutUtils::HasCurrentAnimations(nsIContent* aContent,
if (!aContent->MayHaveAnimations())
return false;
TimeStamp now = aPresContext->RefreshDriver()->MostRecentRefresh();
ElementAnimationCollection* collection =
static_cast<ElementAnimationCollection*>(
aContent->GetProperty(aAnimationProperty));
return (collection && collection->HasCurrentAnimationsAt(now));
return (collection && collection->HasCurrentAnimations());
}
static gfxSize

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

@ -454,7 +454,7 @@ ElementAnimation::CurrentTime() const
}
bool
ElementAnimation::IsRunningAt(TimeStamp aTime) const
ElementAnimation::IsRunning() const
{
if (IsPaused() || IsFinishedTransition()) {
return false;
@ -465,7 +465,7 @@ ElementAnimation::IsRunningAt(TimeStamp aTime) const
}
bool
ElementAnimation::IsCurrentAt(TimeStamp aTime) const
ElementAnimation::IsCurrent() const
{
if (IsFinishedTransition()) {
return false;
@ -728,11 +728,9 @@ ElementAnimationCollection::CanPerformOnCompositorThread(
return false;
}
TimeStamp now = frame->PresContext()->RefreshDriver()->MostRecentRefresh();
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
const ElementAnimation* anim = mAnimations[animIdx];
bool isRunning = anim->IsRunningAt(now);
bool isRunning = anim->IsRunning();
for (uint32_t propIdx = 0, propEnd = anim->mProperties.Length();
propIdx != propEnd; ++propIdx) {
if (IsGeometricProperty(anim->mProperties[propIdx].mProperty) &&
@ -746,7 +744,7 @@ ElementAnimationCollection::CanPerformOnCompositorThread(
bool existsProperty = false;
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
const ElementAnimation* anim = mAnimations[animIdx];
if (!anim->IsRunningAt(now)) {
if (!anim->IsRunning()) {
continue;
}
@ -1061,10 +1059,10 @@ ElementAnimationCollection::UpdateAnimationGeneration(
}
bool
ElementAnimationCollection::HasCurrentAnimationsAt(TimeStamp aTime)
ElementAnimationCollection::HasCurrentAnimations()
{
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
if (mAnimations[animIdx]->IsCurrentAt(aTime)) {
if (mAnimations[animIdx]->IsCurrent()) {
return true;
}
}

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

@ -360,8 +360,8 @@ public:
}
bool HasAnimationOfProperty(nsCSSProperty aProperty) const;
bool IsRunningAt(mozilla::TimeStamp aTime) const;
bool IsCurrentAt(mozilla::TimeStamp aTime) const;
bool IsRunning() const;
bool IsCurrent() const;
// Return the duration since the start of the delay period, taking into
// account the pause state. May be negative.
@ -571,9 +571,9 @@ struct ElementAnimationCollection : public PRCList
// Update mAnimationGeneration to nsCSSFrameConstructor's count
void UpdateAnimationGeneration(nsPresContext* aPresContext);
// Returns true if there is an animation in the before or active phase at
// the given time.
bool HasCurrentAnimationsAt(mozilla::TimeStamp aTime);
// Returns true if there is an animation in the before or active phase
// at the current time.
bool HasCurrentAnimations();
// The refresh time associated with mStyleRule.
TimeStamp mStyleRuleRefreshTime;