OLD | NEW |
---|---|
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 Loading... | |
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()); |
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 | |
262 KeyframeVector newFrames; | |
263 // Copy frames | |
264 for (int i = 0; i < 3; i++) | |
dgozman
2015/03/26 10:30:05
Why exactly 3 elements?
dstockwell
2015/03/26 22:56:16
ASSERT that there are exactly 3 keyframes
samli
2015/03/30 00:22:55
dstockwell: Done.
dgozman: Our internal representa
| |
265 newFrames.append(toAnimatableValueKeyframe(frames[i]->clone().get()) ); | |
266 // Update delay | |
dstockwell
2015/03/26 22:56:16
// Update delay, represented by the distance betwe
samli
2015/03/30 00:22:55
Done.
| |
267 newFrames[1]->setOffset(delay / (delay + duration)); | |
dgozman
2015/03/26 10:30:05
Why only first frame?
samli
2015/03/30 00:22:55
As per updated comment, transition delays are repr
| |
268 effect->setFrames(newFrames); | |
269 // Update duration | |
dgozman
2015/03/26 10:30:05
These comments seem unnecessary.
samli
2015/03/30 00:22:55
Done.
| |
270 RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timin g(); | |
271 UnrestrictedDoubleOrString unrestrictedDuration; | |
272 unrestrictedDuration.setUnrestrictedDouble(duration + delay); | |
273 timing->setDuration(unrestrictedDuration); | |
274 } else { | |
275 RefPtrWillBeRawPtr<AnimationNodeTiming> timing = player->source()->timin g(); | |
276 UnrestrictedDoubleOrString unrestrictedDuration; | |
277 unrestrictedDuration.setUnrestrictedDouble(duration); | |
278 timing->setDuration(unrestrictedDuration); | |
279 timing->setDelay(delay); | |
280 } | |
260 } | 281 } |
261 | 282 |
262 void InspectorAnimationAgent::didCreateAnimationPlayer(AnimationPlayer* player) | 283 void InspectorAnimationAgent::didCreateAnimationPlayer(AnimationPlayer* player) |
263 { | 284 { |
264 const String& playerId = String::number(player->sequenceNumber()); | 285 const String& playerId = String::number(player->sequenceNumber()); |
265 if (m_idToAnimationPlayer.get(playerId)) | 286 if (m_idToAnimationPlayer.get(playerId)) |
266 return; | 287 return; |
267 | 288 |
268 // Check threshold | 289 // Check threshold |
269 double latestStartTime = 0; | 290 double latestStartTime = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 { | 323 { |
303 #if ENABLE(OILPAN) | 324 #if ENABLE(OILPAN) |
304 visitor->trace(m_pageAgent); | 325 visitor->trace(m_pageAgent); |
305 visitor->trace(m_domAgent); | 326 visitor->trace(m_domAgent); |
306 visitor->trace(m_idToAnimationPlayer); | 327 visitor->trace(m_idToAnimationPlayer); |
307 #endif | 328 #endif |
308 InspectorBaseAgent::trace(visitor); | 329 InspectorBaseAgent::trace(visitor); |
309 } | 330 } |
310 | 331 |
311 } | 332 } |
OLD | NEW |