Index: Source/core/inspector/InspectorAnimationAgent.cpp |
diff --git a/Source/core/inspector/InspectorAnimationAgent.cpp b/Source/core/inspector/InspectorAnimationAgent.cpp |
index 2e0da3629ea6ca071ffd763925a88fd6675fd592..35bb33b61fde80fae200fd41eb16281014201737 100644 |
--- a/Source/core/inspector/InspectorAnimationAgent.cpp |
+++ b/Source/core/inspector/InspectorAnimationAgent.cpp |
@@ -246,17 +246,37 @@ void InspectorAnimationAgent::setCurrentTime(ErrorString*, double currentTime) |
m_pageAgent->inspectedFrame()->document()->timeline().setCurrentTime(currentTime); |
} |
-void InspectorAnimationAgent::setTiming(ErrorString* errorString, const String& playerId, double duration, double delay) |
+void InspectorAnimationAgent::setTiming(ErrorString* errorString, const String& playerId, double duration, double delay, bool isTransition) |
{ |
AnimationPlayer* player = assertAnimationPlayer(errorString, playerId); |
if (!player) |
return; |
- RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timing(); |
- UnrestrictedDoubleOrString unrestrictedDuration; |
- unrestrictedDuration.setUnrestrictedDouble(duration); |
- timing->setDuration(unrestrictedDuration); |
- timing->setDelay(delay); |
+ if (isTransition) { |
+ Animation* animation = toAnimation(player->source()); |
+ KeyframeEffectModelBase* effect = toKeyframeEffectModelBase(animation->effect()); |
dgozman
2015/03/30 10:38:58
Can we assert before calling |toKeyframeEffectMode
samli
2015/03/30 23:14:17
Done.
|
+ ASSERT(effect->isAnimatableValueKeyframeEffectModel()); |
+ const AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKeyframeEffectModel(effect); |
+ const KeyframeVector& frames = oldEffect->getFrames(); |
+ ASSERT(frames.size() == 3); |
dgozman
2015/03/30 10:38:58
Is there any documentation/explanation about the d
samli
2015/03/30 23:14:17
Done. There isn't really much to it, except for th
|
+ KeyframeVector newFrames; |
+ for (int i = 0; i < 3; i++) |
+ newFrames.append(toAnimatableValueKeyframe(frames[i]->clone().get())); |
+ // Update delay, represented by the distance between the first two keyframes |
dgozman
2015/03/30 10:38:58
nit: full stop please.
samli
2015/03/30 23:14:17
Done.
|
+ newFrames[1]->setOffset(delay / (delay + duration)); |
+ effect->setFrames(newFrames); |
+ |
+ RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timing(); |
+ UnrestrictedDoubleOrString unrestrictedDuration; |
+ unrestrictedDuration.setUnrestrictedDouble(duration + delay); |
+ timing->setDuration(unrestrictedDuration); |
+ } else { |
+ RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timing(); |
+ UnrestrictedDoubleOrString unrestrictedDuration; |
+ unrestrictedDuration.setUnrestrictedDouble(duration); |
+ timing->setDuration(unrestrictedDuration); |
+ timing->setDelay(delay); |
+ } |
} |
void InspectorAnimationAgent::didCreateAnimationPlayer(AnimationPlayer* player) |