Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1111)

Unified Diff: Source/core/inspector/InspectorAnimationAgent.cpp

Issue 993413004: Devtools Animations: Update transition timing on timeline interaction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InspectorAnimationAgent.cpp
diff --git a/Source/core/inspector/InspectorAnimationAgent.cpp b/Source/core/inspector/InspectorAnimationAgent.cpp
index 2e0da3629ea6ca071ffd763925a88fd6675fd592..e66e5c1c0b5d79a6c32a85d2ddd0bcfd8e5d02ab 100644
--- a/Source/core/inspector/InspectorAnimationAgent.cpp
+++ b/Source/core/inspector/InspectorAnimationAgent.cpp
@@ -246,17 +246,38 @@ 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());
+ ASSERT(effect->isAnimatableValueKeyframeEffectModel());
+ const AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKeyframeEffectModel(effect);
+ const KeyframeVector& frames = oldEffect->getFrames();
+
+ KeyframeVector newFrames;
+ // Copy frames
+ for (int i = 0; i < 3; i++)
dgozman 2015/03/26 10:30:05 Why exactly 3 elements?
dstockwell 2015/03/26 22:56:16 ASSERT that there are exactly 3 keyframes
samli 2015/03/30 00:22:55 dstockwell: Done. dgozman: Our internal representa
+ newFrames.append(toAnimatableValueKeyframe(frames[i]->clone().get()));
+ // Update delay
dstockwell 2015/03/26 22:56:16 // Update delay, represented by the distance betwe
samli 2015/03/30 00:22:55 Done.
+ newFrames[1]->setOffset(delay / (delay + duration));
dgozman 2015/03/26 10:30:05 Why only first frame?
samli 2015/03/30 00:22:55 As per updated comment, transition delays are repr
+ effect->setFrames(newFrames);
+ // Update duration
dgozman 2015/03/26 10:30:05 These comments seem unnecessary.
samli 2015/03/30 00:22:55 Done.
+ 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)

Powered by Google App Engine
This is Rietveld 408576698