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

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 fe063f4aeca66c36c81f83ed303828bff05e5ceb..99fc461a20b4b78d794c9eb5446dd2b0457b2d81 100644
--- a/Source/core/inspector/InspectorAnimationAgent.cpp
+++ b/Source/core/inspector/InspectorAnimationAgent.cpp
@@ -265,11 +265,32 @@ void InspectorAnimationAgent::setTiming(ErrorString* errorString, const String&
if (!player)
return;
- RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timing();
- UnrestrictedDoubleOrString unrestrictedDuration;
- unrestrictedDuration.setUnrestrictedDouble(duration);
- timing->setDuration(unrestrictedDuration);
- timing->setDelay(delay);
+ AnimationType type = m_idToAnimationType.get(playerId);
+ if (type == AnimationType::CSSTransition) {
+ Animation* animation = toAnimation(player->source());
+ KeyframeEffectModelBase* effect = toKeyframeEffectModelBase(animation->effect());
+ 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 if (type == AnimationType::WebAnimation) {
+ 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/animation/KeyframeEffectModel.cpp ('k') | Source/devtools/front_end/elements/AnimationTimeline.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698