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

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: Address review comments 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)
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 KeyframeEffectModelBase* effect = toKeyframeEffectModelBase(animation->e ffect());
dgozman 2015/03/30 10:38:58 Can we assert before calling |toKeyframeEffectMode
samli 2015/03/30 23:14:17 Done.
258 timing->setDuration(unrestrictedDuration); 258 ASSERT(effect->isAnimatableValueKeyframeEffectModel());
259 timing->setDelay(delay); 259 const AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueK eyframeEffectModel(effect);
260 const KeyframeVector& frames = oldEffect->getFrames();
261 ASSERT(frames.size() == 3);
dgozman 2015/03/30 10:38:58 Is there any documentation/explanation about the d
samli 2015/03/30 23:14:17 Done. There isn't really much to it, except for th
262 KeyframeVector newFrames;
263 for (int i = 0; i < 3; i++)
264 newFrames.append(toAnimatableValueKeyframe(frames[i]->clone().get()) );
265 // Update delay, represented by the distance between the first two keyfr ames
dgozman 2015/03/30 10:38:58 nit: full stop please.
samli 2015/03/30 23:14:17 Done.
266 newFrames[1]->setOffset(delay / (delay + duration));
267 effect->setFrames(newFrames);
268
269 RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timin g();
270 UnrestrictedDoubleOrString unrestrictedDuration;
271 unrestrictedDuration.setUnrestrictedDouble(duration + delay);
272 timing->setDuration(unrestrictedDuration);
273 } else {
274 RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timin g();
275 UnrestrictedDoubleOrString unrestrictedDuration;
276 unrestrictedDuration.setUnrestrictedDouble(duration);
277 timing->setDuration(unrestrictedDuration);
278 timing->setDelay(delay);
279 }
260 } 280 }
261 281
262 void InspectorAnimationAgent::didCreateAnimationPlayer(AnimationPlayer* player) 282 void InspectorAnimationAgent::didCreateAnimationPlayer(AnimationPlayer* player)
263 { 283 {
264 const String& playerId = String::number(player->sequenceNumber()); 284 const String& playerId = String::number(player->sequenceNumber());
265 if (m_idToAnimationPlayer.get(playerId)) 285 if (m_idToAnimationPlayer.get(playerId))
266 return; 286 return;
267 287
268 // Check threshold 288 // Check threshold
269 double latestStartTime = 0; 289 double latestStartTime = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 { 322 {
303 #if ENABLE(OILPAN) 323 #if ENABLE(OILPAN)
304 visitor->trace(m_pageAgent); 324 visitor->trace(m_pageAgent);
305 visitor->trace(m_domAgent); 325 visitor->trace(m_domAgent);
306 visitor->trace(m_idToAnimationPlayer); 326 visitor->trace(m_idToAnimationPlayer);
307 #endif 327 #endif
308 InspectorBaseAgent::trace(visitor); 328 InspectorBaseAgent::trace(visitor);
309 } 329 }
310 330
311 } 331 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698