Chromium Code Reviews| Index: Source/core/inspector/InspectorAnimationAgent.cpp |
| diff --git a/Source/core/inspector/InspectorAnimationAgent.cpp b/Source/core/inspector/InspectorAnimationAgent.cpp |
| index 593e0444e17eb2c4742d781672625fa1f5371abd..81e0ab2581a5c71385bf63f26c7880a1456531c8 100644 |
| --- a/Source/core/inspector/InspectorAnimationAgent.cpp |
| +++ b/Source/core/inspector/InspectorAnimationAgent.cpp |
| @@ -9,6 +9,7 @@ |
| #include "core/animation/Animation.h" |
| #include "core/animation/AnimationEffect.h" |
| #include "core/animation/AnimationEffectTiming.h" |
| +#include "core/animation/AnimationInputHelpers.h" |
| #include "core/animation/ComputedTimingProperties.h" |
| #include "core/animation/EffectModel.h" |
| #include "core/animation/ElementAnimation.h" |
| @@ -152,7 +153,7 @@ PassRefPtr<TypeBuilder::Animation::AnimationPlayer> InspectorAnimationAgent::bui |
| } else { |
| // Keyframe based animations |
| keyframeRule = buildObjectForAnimationKeyframes(toKeyframeEffect(player.source())); |
| - animationType = cssAnimations.isAnimationForInspector(player) ? AnimationType::WebAnimation : AnimationType::CSSAnimation; |
| + animationType = cssAnimations.isAnimationForInspector(player) ? AnimationType::CSSAnimation : AnimationType::WebAnimation; |
| } |
| String id = String::number(player.sequenceNumber()); |
| @@ -259,6 +260,33 @@ void InspectorAnimationAgent::setTiming(ErrorString* errorString, const String& |
| } |
| } |
| +void InspectorAnimationAgent::setEasing(ErrorString* errorString, const String& playerId, const String& easing) |
| +{ |
| + Animation* animation = assertAnimation(errorString, playerId); |
| + if (!animation) |
| + return; |
| + |
| + AnimationType type = m_idToAnimationType.get(playerId); |
| + if (type == AnimationType::CSSTransition) { |
| + KeyframeEffect* effect = toKeyframeEffect(animation->source()); |
| + KeyframeEffectModelBase* model = toKeyframeEffectModelBase(effect->model()); |
| + const AnimatableValueKeyframeEffectModel* oldModel = toAnimatableValueKeyframeEffectModel(model); |
| + // Refer to CSSAnimations::calculateTransitionUpdateForProperty() for the structure of transitions. |
| + const KeyframeVector& frames = oldModel->getFrames(); |
| + ASSERT(frames.size() == 3); |
| + KeyframeVector newFrames; |
| + for (int i = 0; i < 3; i++) |
| + newFrames.append(toAnimatableValueKeyframe(frames[i]->clone().get())); |
| + // Update easing of the transition, represented by the second keyframe |
| + if (RefPtr<TimingFunction> timingFunction = AnimationInputHelpers::parseTimingFunction(easing)) |
|
dgozman
2015/05/23 00:53:26
Code up to this line may be extracted into helper
samli
2015/05/25 01:55:38
Done.
|
| + newFrames[1]->setEasing(timingFunction); |
| + model->setFrames(newFrames); |
| + } else if (type == AnimationType::WebAnimation) { |
| + RefPtrWillBeRawPtr<AnimationEffectTiming> timing = animation->source()->timing(); |
| + timing->setEasing(easing); |
| + } |
| +} |
| + |
| void InspectorAnimationAgent::didCreateAnimation(Animation* player) |
| { |
| const String& playerId = String::number(player->sequenceNumber()); |