Index: Source/core/inspector/InspectorAnimationAgent.cpp |
diff --git a/Source/core/inspector/InspectorAnimationAgent.cpp b/Source/core/inspector/InspectorAnimationAgent.cpp |
index 7d3068ba83fd43dba20412ccbd001dd69b5cb3bb..ee6c2911508b5c20ec7243acb63280b7be359a30 100644 |
--- a/Source/core/inspector/InspectorAnimationAgent.cpp |
+++ b/Source/core/inspector/InspectorAnimationAgent.cpp |
@@ -246,17 +246,39 @@ 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) |
dgozman
2015/03/31 05:11:29
Can you check |isTransition| flag here on backend
samli
2015/03/31 06:17:00
No. The way I classify if a created animation is a
|
{ |
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()); |
+ ASSERT(animation->effect()->isKeyframeEffectModel()); |
+ KeyframeEffectModelBase* effect = toKeyframeEffectModelBase(animation->effect()); |
+ ASSERT(effect->isAnimatableValueKeyframeEffectModel()); |
+ const AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKeyframeEffectModel(effect); |
+ // Refer to CSSAnimations::calculateTransitionUpdateForProperty() for the structure of transitions. |
+ const KeyframeVector& frames = oldEffect->getFrames(); |
+ ASSERT(frames.size() == 3); |
+ 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. |
+ 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) |