From 717246367dd9ea70868d24962bcd3d17d3a02983 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 15 Apr 2015 08:48:21 +0900 Subject: [PATCH] Bug 1153734 part 3 - Rename AnimationPlayer.source to AnimationPlayer.effect; r=smaug There are still some other references to "source" in AnimationPlayer such as HasInPlayerSource and UpdateSourceContent. These are renamed in a subsequent patch (that doesn't require DOM peer review). --- dom/animation/AnimationPlayer.cpp | 42 +++++++++---------- dom/animation/AnimationPlayer.h | 14 +++---- .../test_animation-player-currenttime.html | 30 ++++++------- .../test_animation-player-starttime.html | 20 ++++----- .../test/css-animations/test_effect-name.html | 6 +-- .../css-animations/test_effect-target.html | 2 +- .../test_element-get-animation-players.html | 2 +- .../test_animation-player-currenttime.html | 14 +++---- .../test_animation-player-starttime.html | 8 ++-- .../css-transitions/test_effect-name.html | 2 +- .../css-transitions/test_effect-target.html | 2 +- dom/base/nsDOMMutationObserver.cpp | 2 +- dom/base/nsNodeUtils.cpp | 2 +- dom/webidl/AnimationPlayer.webidl | 4 +- layout/base/nsDisplayList.cpp | 8 ++-- layout/base/nsLayoutUtils.cpp | 4 +- layout/style/AnimationCommon.cpp | 10 ++--- layout/style/nsAnimationManager.cpp | 24 +++++------ layout/style/nsTransitionManager.cpp | 38 ++++++++--------- toolkit/devtools/server/actors/animation.js | 8 ++-- 20 files changed, 121 insertions(+), 121 deletions(-) diff --git a/dom/animation/AnimationPlayer.cpp b/dom/animation/AnimationPlayer.cpp index b1f826f6c4c..2fc01645276 100644 --- a/dom/animation/AnimationPlayer.cpp +++ b/dom/animation/AnimationPlayer.cpp @@ -18,7 +18,7 @@ namespace mozilla { namespace dom { NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AnimationPlayer, mTimeline, - mSource, mReady, mFinished) + mEffect, mReady, mFinished) NS_IMPL_CYCLE_COLLECTING_ADDREF(AnimationPlayer) NS_IMPL_CYCLE_COLLECTING_RELEASE(AnimationPlayer) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationPlayer) @@ -266,14 +266,14 @@ AnimationPlayer::SetCurrentTimeAsDouble(const Nullable& aCurrentTime, } void -AnimationPlayer::SetSource(KeyframeEffectReadonly* aSource) +AnimationPlayer::SetEffect(KeyframeEffectReadonly* aEffect) { - if (mSource) { - mSource->SetParentTime(Nullable()); + if (mEffect) { + mEffect->SetParentTime(Nullable()); } - mSource = aSource; - if (mSource) { - mSource->SetParentTime(GetCurrentTime()); + mEffect = aEffect; + if (mEffect) { + mEffect->SetParentTime(GetCurrentTime()); } UpdateRelevance(); } @@ -387,9 +387,9 @@ AnimationPlayer::UpdateRelevance() bool AnimationPlayer::CanThrottle() const { - if (!mSource || - mSource->IsFinishedTransition() || - mSource->Properties().IsEmpty()) { + if (!mEffect || + mEffect->IsFinishedTransition() || + mEffect->Properties().IsEmpty()) { return true; } @@ -414,7 +414,7 @@ AnimationPlayer::ComposeStyle(nsRefPtr& aStyleRule, nsCSSPropertySet& aSetProperties, bool& aNeedsRefreshes) { - if (!mSource || mSource->IsFinishedTransition()) { + if (!mEffect || mEffect->IsFinishedTransition()) { return; } @@ -482,7 +482,7 @@ AnimationPlayer::ComposeStyle(nsRefPtr& aStyleRule, } } - mSource->ComposeStyle(aStyleRule, aSetProperties); + mEffect->ComposeStyle(aStyleRule, aSetProperties); if (updatedHoldTime) { UpdateTiming(); @@ -708,8 +708,8 @@ AnimationPlayer::UpdateFinishedState(bool aSeekFlag) void AnimationPlayer::UpdateSourceContent() { - if (mSource) { - mSource->SetParentTime(GetCurrentTime()); + if (mEffect) { + mEffect->SetParentTime(GetCurrentTime()); UpdateRelevance(); } } @@ -825,24 +825,24 @@ AnimationPlayer::IsPossiblyOrphanedPendingPlayer() const StickyTimeDuration AnimationPlayer::SourceContentEnd() const { - if (!mSource) { + if (!mEffect) { return StickyTimeDuration(0); } - return mSource->Timing().mDelay - + mSource->GetComputedTiming().mActiveDuration; + return mEffect->Timing().mDelay + + mEffect->GetComputedTiming().mActiveDuration; } nsIDocument* AnimationPlayer::GetRenderedDocument() const { - if (!mSource) { + if (!mEffect) { return nullptr; } Element* targetElement; nsCSSPseudoElements::Type pseudoType; - mSource->GetTarget(targetElement, pseudoType); + mEffect->GetTarget(targetElement, pseudoType); if (!targetElement) { return nullptr; } @@ -871,11 +871,11 @@ AnimationPlayer::GetCollection() const if (!manager) { return nullptr; } - MOZ_ASSERT(mSource, "A player with an animation manager must have a source"); + MOZ_ASSERT(mEffect, "A player with an animation manager must have an effect"); Element* targetElement; nsCSSPseudoElements::Type targetPseudoType; - mSource->GetTarget(targetElement, targetPseudoType); + mEffect->GetTarget(targetElement, targetPseudoType); MOZ_ASSERT(targetElement, "A player with an animation manager must have a target"); diff --git a/dom/animation/AnimationPlayer.h b/dom/animation/AnimationPlayer.h index 36776876fe7..bcb6eec10d9 100644 --- a/dom/animation/AnimationPlayer.h +++ b/dom/animation/AnimationPlayer.h @@ -80,7 +80,7 @@ public: }; // AnimationPlayer methods - KeyframeEffectReadonly* GetSource() const { return mSource; } + KeyframeEffectReadonly* GetEffect() const { return mEffect; } DocumentTimeline* Timeline() const { return mTimeline; } Nullable GetStartTime() const { return mStartTime; } void SetStartTime(const Nullable& aNewStartTime); @@ -113,7 +113,7 @@ public: // CSSAnimationPlayer::PauseFromJS so we leave it for now. void PauseFromJS() { Pause(); } - void SetSource(KeyframeEffectReadonly* aSource); + void SetEffect(KeyframeEffectReadonly* aEffect); void Tick(); /** @@ -203,7 +203,7 @@ public: const nsString& Name() const { - return mSource ? mSource->Name() : EmptyString(); + return mEffect ? mEffect->Name() : EmptyString(); } bool IsPausedOrPausing() const @@ -214,15 +214,15 @@ public: bool HasInPlaySource() const { - return GetSource() && GetSource()->IsInPlay(*this); + return GetEffect() && GetEffect()->IsInPlay(*this); } bool HasCurrentSource() const { - return GetSource() && GetSource()->IsCurrent(*this); + return GetEffect() && GetEffect()->IsCurrent(*this); } bool HasInEffectSource() const { - return GetSource() && GetSource()->IsInEffect(); + return GetEffect() && GetEffect()->IsInEffect(); } /** @@ -303,7 +303,7 @@ protected: AnimationPlayerCollection* GetCollection() const; nsRefPtr mTimeline; - nsRefPtr mSource; + nsRefPtr mEffect; // The beginning of the delay period. Nullable mStartTime; // Timeline timescale Nullable mHoldTime; // Player timescale diff --git a/dom/animation/test/css-animations/test_animation-player-currenttime.html b/dom/animation/test/css-animations/test_animation-player-currenttime.html index c304946a9a4..4f1267778fe 100644 --- a/dom/animation/test/css-animations/test_animation-player-currenttime.html +++ b/dom/animation/test/css-animations/test_animation-player-currenttime.html @@ -208,11 +208,11 @@ function checkStateOnSettingCurrentTimeToZero(animation) 'Animation.playState should be "running" at the start of ' + 'the start delay'); - assert_equals(animation.source.target.style.animationPlayState, 'running', - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, 'running', + 'Animation.effect.target.style.animationPlayState should be ' + '"running" at the start of the start delay'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, UNANIMATED_POSITION, 'the computed value of margin-left should be unaffected ' + @@ -233,11 +233,11 @@ function checkStateOnReadyPromiseResolved(animation) 'Animation.playState should be "running" on the first paint ' + 'tick after animation creation'); - assert_equals(animation.source.target.style.animationPlayState, 'running', - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, 'running', + 'Animation.effect.target.style.animationPlayState should be ' + '"running" on the first paint tick after animation creation'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, UNANIMATED_POSITION, 'the computed value of margin-left should be unaffected ' + @@ -253,11 +253,11 @@ function checkStateAtActiveIntervalStartTime(animation) 'Animation.playState should be "running" at the start of ' + 'the active interval'); - assert_equals(animation.source.target.style.animationPlayState, 'running', - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, 'running', + 'Animation.effect.target.style.animationPlayState should be ' + '"running" at the start of the active interval'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_between_inclusive(marginLeft, INITIAL_POSITION, TEN_PCT_POSITION, 'the computed value of margin-left should be close to the value at the ' + @@ -268,7 +268,7 @@ function checkStateAtFiftyPctOfActiveInterval(animation) { // We don't test animation.currentTime since our caller just set it. - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, FIFTY_PCT_POSITION, 'the computed value of margin-left should be half way through the ' + @@ -284,11 +284,11 @@ function checkStateAtActiveIntervalEndTime(animation) 'Animation.playState should be "finished" at the end of ' + 'the active interval'); - assert_equals(animation.source.target.style.animationPlayState, "running", - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, "running", + 'Animation.effect.target.style.animationPlayState should be ' + '"finished" at the end of the active interval'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, UNANIMATED_POSITION, 'the computed value of margin-left should be unaffected ' + @@ -314,8 +314,8 @@ test(function(t) 'Animation.playState should be "pending" when an animation ' + 'is initially created'); - assert_equals(animation.source.target.style.animationPlayState, 'running', - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, 'running', + 'Animation.effect.target.style.animationPlayState should be ' + '"running" when an animation is initially created'); // XXX Ideally we would have a test to check the ready Promise is initially diff --git a/dom/animation/test/css-animations/test_animation-player-starttime.html b/dom/animation/test/css-animations/test_animation-player-starttime.html index 236af034946..bd98420569e 100644 --- a/dom/animation/test/css-animations/test_animation-player-starttime.html +++ b/dom/animation/test/css-animations/test_animation-player-starttime.html @@ -210,11 +210,11 @@ function checkStateOnReadyPromiseResolved(animation) 'Animation.playState should be "running" on the first paint ' + 'tick after animation creation'); - assert_equals(animation.source.target.style.animationPlayState, 'running', - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, 'running', + 'Animation.effect.target.style.animationPlayState should be ' + '"running" on the first paint tick after animation creation'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, UNANIMATED_POSITION, 'the computed value of margin-left should be unaffected ' + @@ -230,11 +230,11 @@ function checkStateAtActiveIntervalStartTime(animation) 'Animation.playState should be "running" at the start of ' + 'the active interval'); - assert_equals(animation.source.target.style.animationPlayState, 'running', - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, 'running', + 'Animation.effect.target.style.animationPlayState should be ' + '"running" at the start of the active interval'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_between_inclusive(marginLeft, INITIAL_POSITION, TEN_PCT_POSITION, 'the computed value of margin-left should be close to the value at the ' + @@ -245,7 +245,7 @@ function checkStateAtFiftyPctOfActiveInterval(animation) { // We don't test animation.startTime since our caller just set it. - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, FIFTY_PCT_POSITION, 'the computed value of margin-left should be half way through the ' + @@ -261,11 +261,11 @@ function checkStateAtActiveIntervalEndTime(animation) 'Animation.playState should be "finished" at the end of ' + 'the active interval'); - assert_equals(animation.source.target.style.animationPlayState, "running", - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, "running", + 'Animation.effect.target.style.animationPlayState should be ' + '"finished" at the end of the active interval'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, UNANIMATED_POSITION, 'the computed value of margin-left should be unaffected ' + diff --git a/dom/animation/test/css-animations/test_effect-name.html b/dom/animation/test/css-animations/test_effect-name.html index a432748b534..634f11531a5 100644 --- a/dom/animation/test/css-animations/test_effect-name.html +++ b/dom/animation/test/css-animations/test_effect-name.html @@ -15,21 +15,21 @@ test(function(t) { var div = addDiv(t); div.style.animation = 'xyz 100s'; - assert_equals(div.getAnimations()[0].source.name, 'xyz', + assert_equals(div.getAnimations()[0].effect.name, 'xyz', 'Animation effect name matches keyframes rule name'); }, 'Effect name makes keyframe rule'); test(function(t) { var div = addDiv(t); div.style.animation = 'x\\yz 100s'; - assert_equals(div.getAnimations()[0].source.name, 'xyz', + assert_equals(div.getAnimations()[0].effect.name, 'xyz', 'Escaped animation effect name matches keyframes rule name'); }, 'Escaped animation name'); test(function(t) { var div = addDiv(t); div.style.animation = 'x\\79 z 100s'; - assert_equals(div.getAnimations()[0].source.name, 'xyz', + assert_equals(div.getAnimations()[0].effect.name, 'xyz', 'Hex-escaped animation name matches keyframes rule' + ' name'); }, 'Animation name with hex-escape'); diff --git a/dom/animation/test/css-animations/test_effect-target.html b/dom/animation/test/css-animations/test_effect-target.html index 5d6f71e6ab2..c812213f711 100644 --- a/dom/animation/test/css-animations/test_effect-target.html +++ b/dom/animation/test/css-animations/test_effect-target.html @@ -14,7 +14,7 @@ test(function(t) { var div = addDiv(t); div.style.animation = 'anim 100s'; var animation = div.getAnimations()[0]; - assert_equals(animation.source.target, div, + assert_equals(animation.effect.target, div, 'Animation.target is the animatable div'); }, 'Returned CSS animations have the correct Animation.target'); diff --git a/dom/animation/test/css-animations/test_element-get-animation-players.html b/dom/animation/test/css-animations/test_element-get-animation-players.html index f207cc68f23..5ecf4f51b9d 100644 --- a/dom/animation/test/css-animations/test_element-get-animation-players.html +++ b/dom/animation/test/css-animations/test_element-get-animation-players.html @@ -243,7 +243,7 @@ test(function(t) { // Update duration (an Animation change) div.style.animationDuration = '200s'; var extendedAnimation = div.getAnimations()[0]; - // FIXME: Check extendedAnimation.source.timing.duration has changed once the + // FIXME: Check extendedAnimation.effect.timing.duration has changed once the // API is available assert_equals(originalAnimation, extendedAnimation, 'getAnimations returns the same objects even when their' diff --git a/dom/animation/test/css-transitions/test_animation-player-currenttime.html b/dom/animation/test/css-transitions/test_animation-player-currenttime.html index 62fb7858a3a..e0a106a8161 100644 --- a/dom/animation/test/css-transitions/test_animation-player-currenttime.html +++ b/dom/animation/test/css-transitions/test_animation-player-currenttime.html @@ -194,11 +194,11 @@ function checkStateOnSettingCurrentTimeToZero(animation) 'Animation.playState should be "running" at the start of ' + 'the start delay'); - assert_equals(animation.source.target.style.animationPlayState, 'running', - 'Animation.source.target.style.animationPlayState should be ' + + assert_equals(animation.effect.target.style.animationPlayState, 'running', + 'Animation.effect.target.style.animationPlayState should be ' + '"running" at the start of the start delay'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, UNANIMATED_POSITION, 'the computed value of margin-left should be unaffected ' + @@ -219,7 +219,7 @@ function checkStateOnReadyPromiseResolved(animation) 'Animation.playState should be "running" on the first paint ' + 'tick after animation creation'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, INITIAL_POSITION, 'the computed value of margin-left should be unaffected ' + @@ -235,7 +235,7 @@ function checkStateAtActiveIntervalStartTime(animation) 'Animation.playState should be "running" at the start of ' + 'the active interval'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_between_inclusive(marginLeft, INITIAL_POSITION, TEN_PCT_POSITION, 'the computed value of margin-left should be close to the value at the ' + @@ -246,7 +246,7 @@ function checkStateAtFiftyPctOfActiveInterval(animation) { // We don't test animation.currentTime since our caller just set it. - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, FIFTY_PCT_POSITION, 'the computed value of margin-left should be half way through the ' + @@ -262,7 +262,7 @@ function checkStateAtActiveIntervalEndTime(animation) 'Animation.playState should be "finished" at the end of ' + 'the active interval'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, END_POSITION, 'the computed value of margin-left should be the final transitioned-to ' + diff --git a/dom/animation/test/css-transitions/test_animation-player-starttime.html b/dom/animation/test/css-transitions/test_animation-player-starttime.html index f70a821025f..e662d056960 100644 --- a/dom/animation/test/css-transitions/test_animation-player-starttime.html +++ b/dom/animation/test/css-transitions/test_animation-player-starttime.html @@ -200,7 +200,7 @@ function checkStateOnReadyPromiseResolved(animation) 'Animation.playState should be "running" on the first paint ' + 'tick after animation creation'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, INITIAL_POSITION, 'the computed value of margin-left should be unaffected ' + @@ -216,7 +216,7 @@ function checkStateAtActiveIntervalStartTime(animation) 'Animation.playState should be "running" at the start of ' + 'the active interval'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_between_inclusive(marginLeft, INITIAL_POSITION, TEN_PCT_POSITION, 'the computed value of margin-left should be close to the value at the ' + @@ -227,7 +227,7 @@ function checkStateAtFiftyPctOfActiveInterval(animation) { // We don't test animation.startTime since our caller just set it. - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, FIFTY_PCT_POSITION, 'the computed value of margin-left should be half way through the ' + @@ -243,7 +243,7 @@ function checkStateAtActiveIntervalEndTime(animation) 'Animation.playState should be "finished" at the end of ' + 'the active interval'); - var div = animation.source.target; + var div = animation.effect.target; var marginLeft = parseFloat(getComputedStyle(div).marginLeft); assert_equals(marginLeft, END_POSITION, 'the computed value of margin-left should be the final transitioned-to ' + diff --git a/dom/animation/test/css-transitions/test_effect-name.html b/dom/animation/test/css-transitions/test_effect-name.html index d53a8aa791d..19012b88d04 100644 --- a/dom/animation/test/css-transitions/test_effect-name.html +++ b/dom/animation/test/css-transitions/test_effect-name.html @@ -16,7 +16,7 @@ test(function(t) { div.style.transition = 'all 100s'; div.style.left = '100px'; - assert_equals(div.getAnimations()[0].source.name, 'left', + assert_equals(div.getAnimations()[0].effect.name, 'left', 'The name for the transitions corresponds to the property ' + 'being transitioned'); }, 'Effect name for transitions'); diff --git a/dom/animation/test/css-transitions/test_effect-target.html b/dom/animation/test/css-transitions/test_effect-target.html index c63b9a57187..2f0c723d9d7 100644 --- a/dom/animation/test/css-transitions/test_effect-target.html +++ b/dom/animation/test/css-transitions/test_effect-target.html @@ -16,7 +16,7 @@ test(function(t) { div.style.left = '100px'; var animation = div.getAnimations()[0]; - assert_equals(animation.source.target, div, + assert_equals(animation.effect.target, div, 'Animation.target is the animatable div'); }, 'Returned CSS transitions have the correct Animation.target'); diff --git a/dom/base/nsDOMMutationObserver.cpp b/dom/base/nsDOMMutationObserver.cpp index 7ddd68bc8d8..3aa9fd7a934 100644 --- a/dom/base/nsDOMMutationObserver.cpp +++ b/dom/base/nsDOMMutationObserver.cpp @@ -328,7 +328,7 @@ void nsAnimationReceiver::RecordAnimationMutation(AnimationPlayer* aPlayer, AnimationMutation aMutationType) { - KeyframeEffectReadonly* effect = aPlayer->GetSource(); + KeyframeEffectReadonly* effect = aPlayer->GetEffect(); if (!effect) { return; } diff --git a/dom/base/nsNodeUtils.cpp b/dom/base/nsNodeUtils.cpp index e4e79750db4..994e5a372bf 100644 --- a/dom/base/nsNodeUtils.cpp +++ b/dom/base/nsNodeUtils.cpp @@ -218,7 +218,7 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer, static inline Element* GetTarget(AnimationPlayer* aPlayer) { - KeyframeEffectReadonly* effect = aPlayer->GetSource(); + KeyframeEffectReadonly* effect = aPlayer->GetEffect(); if (!effect) { return nullptr; } diff --git a/dom/webidl/AnimationPlayer.webidl b/dom/webidl/AnimationPlayer.webidl index c7aaaf59038..8c72a07d23c 100644 --- a/dom/webidl/AnimationPlayer.webidl +++ b/dom/webidl/AnimationPlayer.webidl @@ -14,11 +14,11 @@ enum AnimationPlayState { "idle", "pending", "running", "paused", "finished" }; [Func="nsDocument::IsWebAnimationsEnabled"] interface AnimationPlayer { - // Bug 1049975: Make 'source' writeable + // Bug 1049975: Make 'effect' writeable // FIXME: In a later patch in this series we'll rename KeyframeEffectReadonly // with AnimationEffectReadonly [Pure] - readonly attribute KeyframeEffectReadonly? source; + readonly attribute KeyframeEffectReadonly? effect; readonly attribute AnimationTimeline timeline; [BinaryName="startTimeAsDouble"] attribute double? startTime; diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index cc0c2208503..236d6499e72 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -352,9 +352,9 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty, AnimationData& aData, bool aPending) { MOZ_ASSERT(aLayer->AsContainerLayer(), "Should only animate ContainerLayer"); - MOZ_ASSERT(aPlayer->GetSource(), + MOZ_ASSERT(aPlayer->GetEffect(), "Should not be adding an animation for a player without" - " an animation"); + " an effect"); nsStyleContext* styleContext = aFrame->StyleContext(); nsPresContext* presContext = aFrame->PresContext(); nsRect bounds = nsDisplayTransform::GetFrameBoundsForTransform(aFrame); @@ -364,7 +364,7 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty, aLayer->AddAnimationForNextTransaction() : aLayer->AddAnimation(); - const AnimationTiming& timing = aPlayer->GetSource()->Timing(); + const AnimationTiming& timing = aPlayer->GetEffect()->Timing(); Nullable startTime = aPlayer->GetCurrentOrPendingStartTime(); animation->startTime() = startTime.IsNull() ? TimeStamp() @@ -421,7 +421,7 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty, if (!player->IsPlaying()) { continue; } - dom::KeyframeEffectReadonly* effect = player->GetSource(); + dom::KeyframeEffectReadonly* effect = player->GetEffect(); MOZ_ASSERT(effect, "A playing player should have a target effect"); const AnimationProperty* property = effect->GetAnimationOfProperty(aProperty); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 325253e0738..cdce7e84628 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -502,10 +502,10 @@ GetMinAndMaxScaleForAnimationProperty(nsIContent* aContent, { for (size_t playerIdx = aPlayers->mPlayers.Length(); playerIdx-- != 0; ) { AnimationPlayer* player = aPlayers->mPlayers[playerIdx]; - if (!player->GetSource() || player->GetSource()->IsFinishedTransition()) { + if (!player->GetEffect() || player->GetEffect()->IsFinishedTransition()) { continue; } - dom::KeyframeEffectReadonly* effect = player->GetSource(); + dom::KeyframeEffectReadonly* effect = player->GetEffect(); for (size_t propIdx = effect->Properties().Length(); propIdx-- != 0; ) { AnimationProperty& prop = effect->Properties()[propIdx]; if (prop.mProperty == eCSSProperty_transform) { diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index 8b758a9f619..30173188f05 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -606,7 +606,7 @@ AnimationPlayerCollection::CanPerformOnCompositorThread( continue; } - const KeyframeEffectReadonly* effect = player->GetSource(); + const KeyframeEffectReadonly* effect = player->GetEffect(); MOZ_ASSERT(effect, "A playing player should have an effect"); for (size_t propIdx = 0, propEnd = effect->Properties().Length(); @@ -625,7 +625,7 @@ AnimationPlayerCollection::CanPerformOnCompositorThread( continue; } - const KeyframeEffectReadonly* effect = player->GetSource(); + const KeyframeEffectReadonly* effect = player->GetEffect(); MOZ_ASSERT(effect, "A playing player should have an effect"); existsProperty = existsProperty || effect->Properties().Length() > 0; @@ -655,7 +655,7 @@ AnimationPlayerCollection::PostUpdateLayerAnimations() { nsCSSPropertySet propsHandled; for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) { - const auto& properties = mPlayers[playerIdx]->GetSource()->Properties(); + const auto& properties = mPlayers[playerIdx]->GetEffect()->Properties(); for (size_t propIdx = properties.Length(); propIdx-- != 0; ) { nsCSSProperty prop = properties[propIdx].mProperty; if (nsCSSProps::PropHasFlags(prop, @@ -679,7 +679,7 @@ AnimationPlayerCollection::HasAnimationOfProperty( nsCSSProperty aProperty) const { for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) { - const KeyframeEffectReadonly* effect = mPlayers[playerIdx]->GetSource(); + const KeyframeEffectReadonly* effect = mPlayers[playerIdx]->GetEffect(); if (effect && effect->HasAnimationOfProperty(aProperty) && !effect->IsFinishedTransition()) { return true; @@ -929,7 +929,7 @@ AnimationPlayerCollection::HasCurrentAnimationsForProperties( { for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) { const AnimationPlayer& player = *mPlayers[playerIdx]; - const KeyframeEffectReadonly* effect = player.GetSource(); + const KeyframeEffectReadonly* effect = player.GetEffect(); if (effect && effect->IsCurrent(player) && effect->HasAnimationOfProperties(aProperties, aPropertyCount)) { diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index 3942bba4f27..dcdcda5c88a 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -91,11 +91,11 @@ CSSAnimationPlayer::PauseFromStyle() void CSSAnimationPlayer::QueueEvents(EventArray& aEventsToDispatch) { - if (!mSource) { + if (!mEffect) { return; } - ComputedTiming computedTiming = mSource->GetComputedTiming(); + ComputedTiming computedTiming = mEffect->GetComputedTiming(); if (computedTiming.mPhase == ComputedTiming::AnimationPhase_Null) { return; // do nothing @@ -133,7 +133,7 @@ CSSAnimationPlayer::QueueEvents(EventArray& aEventsToDispatch) dom::Element* target; nsCSSPseudoElements::Type targetPseudoType; - mSource->GetTarget(target, targetPseudoType); + mEffect->GetTarget(target, targetPseudoType); uint32_t message; @@ -147,7 +147,7 @@ CSSAnimationPlayer::QueueEvents(EventArray& aEventsToDispatch) // First notifying for start of 0th iteration by appending an // 'animationstart': StickyTimeDuration elapsedTime = - std::min(StickyTimeDuration(mSource->InitialAdvance()), + std::min(StickyTimeDuration(mEffect->InitialAdvance()), computedTiming.mActiveDuration); AnimationEventInfo ei(target, Name(), NS_ANIMATION_START, elapsedTime, @@ -163,10 +163,10 @@ CSSAnimationPlayer::QueueEvents(EventArray& aEventsToDispatch) if (message == NS_ANIMATION_START || message == NS_ANIMATION_ITERATION) { - TimeDuration iterationStart = mSource->Timing().mIterationDuration * + TimeDuration iterationStart = mEffect->Timing().mIterationDuration * computedTiming.mCurrentIteration; elapsedTime = StickyTimeDuration(std::max(iterationStart, - mSource->InitialAdvance())); + mEffect->InitialAdvance())); } else { MOZ_ASSERT(message == NS_ANIMATION_END); elapsedTime = computedTiming.mActiveDuration; @@ -355,9 +355,9 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext, // Update the old from the new so we can keep the original object // identity (and any expando properties attached to it). - if (oldPlayer->GetSource() && newPlayer->GetSource()) { - KeyframeEffectReadonly* oldEffect = oldPlayer->GetSource(); - KeyframeEffectReadonly* newEffect = newPlayer->GetSource(); + if (oldPlayer->GetEffect() && newPlayer->GetEffect()) { + KeyframeEffectReadonly* oldEffect = oldPlayer->GetEffect(); + KeyframeEffectReadonly* newEffect = newPlayer->GetEffect(); animationChanged = oldEffect->Timing() != newEffect->Timing() || oldEffect->Properties() != newEffect->Properties(); @@ -532,7 +532,7 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext, new KeyframeEffectReadonly(mPresContext->Document(), aTarget, aStyleContext->GetPseudoType(), timing, src.GetName()); - dest->SetSource(destEffect); + dest->SetEffect(destEffect); // Even in the case where we call PauseFromStyle below, we still need to // call PlayFromStyle first. This is because a newly-created player is idle @@ -755,7 +755,7 @@ nsAnimationManager::UpdateCascadeResults( for (size_t playerIdx = aElementAnimations->mPlayers.Length(); playerIdx-- != 0; ) { const AnimationPlayer* player = aElementAnimations->mPlayers[playerIdx]; - const KeyframeEffectReadonly* effect = player->GetSource(); + const KeyframeEffectReadonly* effect = player->GetEffect(); if (!effect) { continue; } @@ -804,7 +804,7 @@ nsAnimationManager::UpdateCascadeResults( playerIdx-- != 0; ) { CSSAnimationPlayer* player = aElementAnimations->mPlayers[playerIdx]->AsCSSAnimationPlayer(); - KeyframeEffectReadonly* effect = player->GetSource(); + KeyframeEffectReadonly* effect = player->GetEffect(); player->mInEffectForCascadeResults = player->HasInEffectSource(); diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 96947e1a22b..6061e8e4400 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -321,7 +321,7 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement, do { --i; AnimationPlayer* player = players[i]; - dom::KeyframeEffectReadonly* effect = player->GetSource(); + dom::KeyframeEffectReadonly* effect = player->GetEffect(); MOZ_ASSERT(effect && effect->Properties().Length() == 1, "Should have one animation property for a transition"); MOZ_ASSERT(effect && effect->Properties()[0].mSegments.Length() == 1, @@ -340,7 +340,7 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement, currentValue) || currentValue != segment.mToValue) { // stop the transition - if (!player->GetSource()->IsFinishedTransition()) { + if (!player->GetEffect()->IsFinishedTransition()) { player->Cancel(); collection->UpdateAnimationGeneration(mPresContext); } @@ -436,7 +436,7 @@ nsTransitionManager::ConsiderStartingTransition( AnimationPlayerPtrArray& players = aElementTransitions->mPlayers; for (size_t i = 0, i_end = players.Length(); i < i_end; ++i) { const ElementPropertyTransition *iPt = - players[i]->GetSource()->AsTransition(); + players[i]->GetEffect()->AsTransition(); if (iPt->TransitionProperty() == aProperty) { haveCurrentTransition = true; currentIndex = i; @@ -568,10 +568,10 @@ nsTransitionManager::ConsiderStartingTransition( nsRefPtr player = new CSSTransitionPlayer(timeline); // The order of the following two calls is important since PlayFromStyle - // will add the player to the PendingPlayerTracker of its source content's - // document. When we come to make source writeable (bug 1049975) we should - // remove this dependency. - player->SetSource(pt); + // will add the player to the PendingPlayerTracker of its effect's document. + // When we come to make effect writeable (bug 1049975) we should remove this + // dependency. + player->SetEffect(pt); player->PlayFromStyle(); if (!aElementTransitions) { @@ -588,8 +588,8 @@ nsTransitionManager::ConsiderStartingTransition( for (size_t i = 0, i_end = players.Length(); i < i_end; ++i) { MOZ_ASSERT( i == currentIndex || - (players[i]->GetSource() && - players[i]->GetSource()->AsTransition()->TransitionProperty() + (players[i]->GetEffect() && + players[i]->GetEffect()->AsTransition()->TransitionProperty() != aProperty), "duplicate transitions for property"); } @@ -681,10 +681,10 @@ nsTransitionManager::UpdateCascadeResults( bool changed = false; AnimationPlayerPtrArray& players = aTransitions->mPlayers; for (size_t playerIdx = players.Length(); playerIdx-- != 0; ) { - MOZ_ASSERT(players[playerIdx]->GetSource() && - players[playerIdx]->GetSource()->Properties().Length() == 1, + MOZ_ASSERT(players[playerIdx]->GetEffect() && + players[playerIdx]->GetEffect()->Properties().Length() == 1, "Should have one animation property for a transition"); - AnimationProperty& prop = players[playerIdx]->GetSource()->Properties()[0]; + AnimationProperty& prop = players[playerIdx]->GetEffect()->Properties()[0]; bool newWinsInCascade = !propertiesUsed.HasProperty(prop.mProperty); if (prop.mWinsInCascade != newWinsInCascade) { changed = true; @@ -809,16 +809,16 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags) do { --i; AnimationPlayer* player = collection->mPlayers[i]; - if (!player->GetSource()->IsFinishedTransition()) { - MOZ_ASSERT(player->GetSource(), - "Transitions should have source content"); + if (!player->GetEffect()->IsFinishedTransition()) { + MOZ_ASSERT(player->GetEffect(), + "Transitions should have an effect"); ComputedTiming computedTiming = - player->GetSource()->GetComputedTiming(); + player->GetEffect()->GetComputedTiming(); if (computedTiming.mPhase == ComputedTiming::AnimationPhase_After) { nsCSSProperty prop = - player->GetSource()->AsTransition()->TransitionProperty(); + player->GetEffect()->AsTransition()->TransitionProperty(); TimeDuration duration = - player->GetSource()->Timing().mIterationDuration; + player->GetEffect()->Timing().mIterationDuration; events.AppendElement( TransitionEventInfo(collection->mElement, prop, duration, @@ -831,7 +831,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags) // a non-animation style change that would affect it, we need // to know not to start a new transition for the transition // from the almost-completed value to the final value. - player->GetSource()->SetIsFinishedTransition(); + player->GetEffect()->SetIsFinishedTransition(); collection->UpdateAnimationGeneration(mPresContext); transitionStartedOrEnded = true; } else if ((computedTiming.mPhase == diff --git a/toolkit/devtools/server/actors/animation.js b/toolkit/devtools/server/actors/animation.js index 93c174623c9..de10b185feb 100644 --- a/toolkit/devtools/server/actors/animation.js +++ b/toolkit/devtools/server/actors/animation.js @@ -59,7 +59,7 @@ let AnimationPlayerActor = ActorClass({ Actor.prototype.initialize.call(this, animationsActor.conn); this.player = player; - this.node = player.source.target; + this.node = player.effect.target; this.playerIndex = playerIndex; this.styles = this.node.ownerDocument.defaultView.getComputedStyle(this.node); }, @@ -115,7 +115,7 @@ let AnimationPlayerActor = ActorClass({ // the list. names = names.split(",").map(n => n.trim()); for (let i = 0; i < names.length; i ++) { - if (names[i] === this.player.source.name) { + if (names[i] === this.player.effect.name) { return i; } } @@ -207,7 +207,7 @@ let AnimationPlayerActor = ActorClass({ currentTime: this.player.currentTime, playState: this.player.playState, playbackRate: this.player.playbackRate, - name: this.player.source.name, + name: this.player.effect.name, duration: this.getDuration(), delay: this.getDelay(), iterationCount: this.getIterationCount(), @@ -552,7 +552,7 @@ let AnimationsActor = exports.AnimationsActor = ActorClass({ continue; } let actor = AnimationPlayerActor( - this, player, player.source.target.getAnimations().indexOf(player)); + this, player, player.effect.target.getAnimations().indexOf(player)); this.actors.push(actor); eventData.push({ type: "added",