OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 if (m_pendingUpdate.isEmpty()) | 358 if (m_pendingUpdate.isEmpty()) |
359 return; | 359 return; |
360 | 360 |
361 m_previousActiveInterpolationsForAnimations.swap(m_pendingUpdate.activeInter
polationsForAnimations()); | 361 m_previousActiveInterpolationsForAnimations.swap(m_pendingUpdate.activeInter
polationsForAnimations()); |
362 | 362 |
363 // FIXME: cancelling, pausing, unpausing animations all query compositingSta
te, which is not necessarily up to date here | 363 // FIXME: cancelling, pausing, unpausing animations all query compositingSta
te, which is not necessarily up to date here |
364 // since we call this from recalc style. | 364 // since we call this from recalc style. |
365 // https://code.google.com/p/chromium/issues/detail?id=339847 | 365 // https://code.google.com/p/chromium/issues/detail?id=339847 |
366 DisableCompositingQueryAsserts disabler; | 366 DisableCompositingQueryAsserts disabler; |
367 | 367 |
368 const Vector<size_t>& cancelledIndices = m_pendingUpdate.cancelledAnimationI
ndices(); | |
369 for (size_t i = cancelledIndices.size(); i-- > 0;) { | |
370 ASSERT(i == cancelledIndices.size() - 1 || cancelledIndices[i] < cancell
edIndices[i + 1]); | |
371 Animation& animation = *m_runningAnimations[cancelledIndices[i]]->animat
ion; | |
372 animation.cancel(); | |
373 animation.update(TimingUpdateOnDemand); | |
374 m_runningAnimations.remove(cancelledIndices[i]); | |
375 } | |
376 | |
377 for (size_t pausedIndex : m_pendingUpdate.animationIndicesWithPauseToggled()
) { | 368 for (size_t pausedIndex : m_pendingUpdate.animationIndicesWithPauseToggled()
) { |
378 Animation& animation = *m_runningAnimations[pausedIndex]->animation; | 369 Animation& animation = *m_runningAnimations[pausedIndex]->animation; |
379 if (animation.paused()) | 370 if (animation.paused()) |
380 animation.unpause(); | 371 animation.unpause(); |
381 else | 372 else |
382 animation.pause(); | 373 animation.pause(); |
383 if (animation.outdated()) | 374 if (animation.outdated()) |
384 animation.update(TimingUpdateOnDemand); | 375 animation.update(TimingUpdateOnDemand); |
385 } | 376 } |
386 | 377 |
387 for (const auto& animation : m_pendingUpdate.updatedCompositorKeyframes()) | 378 for (const auto& animation : m_pendingUpdate.updatedCompositorKeyframes()) |
388 animation->setCompositorPending(true); | 379 animation->setCompositorPending(true); |
389 | 380 |
390 for (const auto& entry : m_pendingUpdate.animationsWithUpdates()) { | 381 for (const auto& entry : m_pendingUpdate.animationsWithUpdates()) { |
391 KeyframeEffect* effect = toKeyframeEffect(entry.animation->effect()); | 382 KeyframeEffect* effect = toKeyframeEffect(entry.animation->effect()); |
392 | 383 |
393 effect->setModel(entry.effect->model()); | 384 effect->setModel(entry.effect->model()); |
394 effect->updateSpecifiedTiming(entry.effect->specifiedTiming()); | 385 effect->updateSpecifiedTiming(entry.effect->specifiedTiming()); |
395 | 386 |
396 m_runningAnimations[entry.index]->update(entry); | 387 m_runningAnimations[entry.index]->update(entry); |
397 } | 388 } |
398 | 389 |
| 390 const Vector<size_t>& cancelledIndices = m_pendingUpdate.cancelledAnimationI
ndices(); |
| 391 for (size_t i = cancelledIndices.size(); i-- > 0;) { |
| 392 ASSERT(i == cancelledIndices.size() - 1 || cancelledIndices[i] < cancell
edIndices[i + 1]); |
| 393 Animation& animation = *m_runningAnimations[cancelledIndices[i]]->animat
ion; |
| 394 animation.cancel(); |
| 395 animation.update(TimingUpdateOnDemand); |
| 396 m_runningAnimations.remove(cancelledIndices[i]); |
| 397 } |
| 398 |
399 for (const auto& entry : m_pendingUpdate.newAnimations()) { | 399 for (const auto& entry : m_pendingUpdate.newAnimations()) { |
400 const InertEffect* inertAnimation = entry.effect.get(); | 400 const InertEffect* inertAnimation = entry.effect.get(); |
401 AnimationEventDelegate* eventDelegate = new AnimationEventDelegate(eleme
nt, entry.name); | 401 AnimationEventDelegate* eventDelegate = new AnimationEventDelegate(eleme
nt, entry.name); |
402 KeyframeEffect* effect = KeyframeEffect::create(element, inertAnimation-
>model(), inertAnimation->specifiedTiming(), KeyframeEffect::DefaultPriority, ev
entDelegate); | 402 KeyframeEffect* effect = KeyframeEffect::create(element, inertAnimation-
>model(), inertAnimation->specifiedTiming(), KeyframeEffect::DefaultPriority, ev
entDelegate); |
403 effect->setName(inertAnimation->name()); | 403 effect->setName(inertAnimation->name()); |
404 Animation* animation = element->document().timeline().play(effect); | 404 Animation* animation = element->document().timeline().play(effect); |
405 if (inertAnimation->paused()) | 405 if (inertAnimation->paused()) |
406 animation->pause(); | 406 animation->pause(); |
407 animation->update(TimingUpdateOnDemand); | 407 animation->update(TimingUpdateOnDemand); |
408 | 408 |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 } | 838 } |
839 | 839 |
840 DEFINE_TRACE(CSSAnimations) | 840 DEFINE_TRACE(CSSAnimations) |
841 { | 841 { |
842 visitor->trace(m_transitions); | 842 visitor->trace(m_transitions); |
843 visitor->trace(m_pendingUpdate); | 843 visitor->trace(m_pendingUpdate); |
844 visitor->trace(m_runningAnimations); | 844 visitor->trace(m_runningAnimations); |
845 } | 845 } |
846 | 846 |
847 } // namespace blink | 847 } // namespace blink |
OLD | NEW |