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

Side by Side 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, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "core/inspector/InspectorAnimationAgent.h" 7 #include "core/inspector/InspectorAnimationAgent.h"
8 8
9 #include "core/animation/Animation.h" 9 #include "core/animation/Animation.h"
10 #include "core/animation/AnimationEffect.h" 10 #include "core/animation/AnimationEffect.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (frame->isLocalFrame()) 239 if (frame->isLocalFrame())
240 toLocalFrame(frame)->document()->timeline().setPlaybackRate(playback Rate); 240 toLocalFrame(frame)->document()->timeline().setPlaybackRate(playback Rate);
241 } 241 }
242 } 242 }
243 243
244 void InspectorAnimationAgent::setCurrentTime(ErrorString*, double currentTime) 244 void InspectorAnimationAgent::setCurrentTime(ErrorString*, double currentTime)
245 { 245 {
246 m_pageAgent->inspectedFrame()->document()->timeline().setCurrentTime(current Time); 246 m_pageAgent->inspectedFrame()->document()->timeline().setCurrentTime(current Time);
247 } 247 }
248 248
249 void InspectorAnimationAgent::setTiming(ErrorString* errorString, const String& playerId, double duration, double delay) 249 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
250 { 250 {
251 AnimationPlayer* player = assertAnimationPlayer(errorString, playerId); 251 AnimationPlayer* player = assertAnimationPlayer(errorString, playerId);
252 if (!player) 252 if (!player)
253 return; 253 return;
254 254
255 RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timing(); 255 if (isTransition) {
256 UnrestrictedDoubleOrString unrestrictedDuration; 256 Animation* animation = toAnimation(player->source());
257 unrestrictedDuration.setUnrestrictedDouble(duration); 257 ASSERT(animation->effect()->isKeyframeEffectModel());
258 timing->setDuration(unrestrictedDuration); 258 KeyframeEffectModelBase* effect = toKeyframeEffectModelBase(animation->e ffect());
259 timing->setDelay(delay); 259 ASSERT(effect->isAnimatableValueKeyframeEffectModel());
260 const AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueK eyframeEffectModel(effect);
261 // Refer to CSSAnimations::calculateTransitionUpdateForProperty() for th e structure of transitions.
262 const KeyframeVector& frames = oldEffect->getFrames();
263 ASSERT(frames.size() == 3);
264 KeyframeVector newFrames;
265 for (int i = 0; i < 3; i++)
266 newFrames.append(toAnimatableValueKeyframe(frames[i]->clone().get()) );
267 // Update delay, represented by the distance between the first two keyfr ames.
268 newFrames[1]->setOffset(delay / (delay + duration));
269 effect->setFrames(newFrames);
270
271 RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timin g();
272 UnrestrictedDoubleOrString unrestrictedDuration;
273 unrestrictedDuration.setUnrestrictedDouble(duration + delay);
274 timing->setDuration(unrestrictedDuration);
275 } else {
276 RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timin g();
277 UnrestrictedDoubleOrString unrestrictedDuration;
278 unrestrictedDuration.setUnrestrictedDouble(duration);
279 timing->setDuration(unrestrictedDuration);
280 timing->setDelay(delay);
281 }
260 } 282 }
261 283
262 void InspectorAnimationAgent::didCreateAnimationPlayer(AnimationPlayer* player) 284 void InspectorAnimationAgent::didCreateAnimationPlayer(AnimationPlayer* player)
263 { 285 {
264 const String& playerId = String::number(player->sequenceNumber()); 286 const String& playerId = String::number(player->sequenceNumber());
265 if (m_idToAnimationPlayer.get(playerId)) 287 if (m_idToAnimationPlayer.get(playerId))
266 return; 288 return;
267 289
268 // Check threshold 290 // Check threshold
269 double latestStartTime = 0; 291 double latestStartTime = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 { 324 {
303 #if ENABLE(OILPAN) 325 #if ENABLE(OILPAN)
304 visitor->trace(m_pageAgent); 326 visitor->trace(m_pageAgent);
305 visitor->trace(m_domAgent); 327 visitor->trace(m_domAgent);
306 visitor->trace(m_idToAnimationPlayer); 328 visitor->trace(m_idToAnimationPlayer);
307 #endif 329 #endif
308 InspectorBaseAgent::trace(visitor); 330 InspectorBaseAgent::trace(visitor);
309 } 331 }
310 332
311 } 333 }
OLDNEW
« 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