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).
This commit is contained in:
Brian Birtles 2015-04-15 08:48:21 +09:00
parent ec581c1cbf
commit 717246367d
20 changed files with 121 additions and 121 deletions

View File

@ -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<double>& aCurrentTime,
}
void
AnimationPlayer::SetSource(KeyframeEffectReadonly* aSource)
AnimationPlayer::SetEffect(KeyframeEffectReadonly* aEffect)
{
if (mSource) {
mSource->SetParentTime(Nullable<TimeDuration>());
if (mEffect) {
mEffect->SetParentTime(Nullable<TimeDuration>());
}
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<css::AnimValuesStyleRule>& aStyleRule,
nsCSSPropertySet& aSetProperties,
bool& aNeedsRefreshes)
{
if (!mSource || mSource->IsFinishedTransition()) {
if (!mEffect || mEffect->IsFinishedTransition()) {
return;
}
@ -482,7 +482,7 @@ AnimationPlayer::ComposeStyle(nsRefPtr<css::AnimValuesStyleRule>& 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");

View File

@ -80,7 +80,7 @@ public:
};
// AnimationPlayer methods
KeyframeEffectReadonly* GetSource() const { return mSource; }
KeyframeEffectReadonly* GetEffect() const { return mEffect; }
DocumentTimeline* Timeline() const { return mTimeline; }
Nullable<TimeDuration> GetStartTime() const { return mStartTime; }
void SetStartTime(const Nullable<TimeDuration>& 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<DocumentTimeline> mTimeline;
nsRefPtr<KeyframeEffectReadonly> mSource;
nsRefPtr<KeyframeEffectReadonly> mEffect;
// The beginning of the delay period.
Nullable<TimeDuration> mStartTime; // Timeline timescale
Nullable<TimeDuration> mHoldTime; // Player timescale

View File

@ -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

View File

@ -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 ' +

View File

@ -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');

View File

@ -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');

View File

@ -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'

View File

@ -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 ' +

View File

@ -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 ' +

View File

@ -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');

View File

@ -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');

View File

@ -328,7 +328,7 @@ void
nsAnimationReceiver::RecordAnimationMutation(AnimationPlayer* aPlayer,
AnimationMutation aMutationType)
{
KeyframeEffectReadonly* effect = aPlayer->GetSource();
KeyframeEffectReadonly* effect = aPlayer->GetEffect();
if (!effect) {
return;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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<TimeDuration> 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);

View File

@ -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) {

View File

@ -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)) {

View File

@ -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();

View File

@ -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<CSSTransitionPlayer> 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 ==

View File

@ -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",