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

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 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)
« no previous file with comments | « Source/core/inspector/InspectorAnimationAgent.h ('k') | Source/devtools/front_end/elements/AnimationTimeline.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698